GNOME Bugzilla – Bug 593786
support OpenGL es in autofoo
Last modified: 2010-02-09 11:20:38 UTC
Right now one cannot build against opengles under linux using autofoo (configure/make).
Created attachment 142238 [details] [review] WIP: assume openGLES2 if no opengl found This patch gets me going, bu still fails with: gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I../../../gst-libs -I../../../gst-libs -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -Wall -Wdeclaration-after-statement -Wpointer-arith -Werror -g -DGST_DISABLE_DEPRECATED -g -O2 -MT libgstgl_0.10_la-gstglbuffer.lo -MD -MP -MF .deps/libgstgl_0.10_la-gstglbuffer.Tpo -c gstglbuffer.c -fPIC -DPIC -o .libs/libgstgl_0.10_la-gstglbuffer.o cc1: warnings being treated as errors gstgles2.h:32: warning: 'glewGetString' defined but not used gstgles2.h:38: warning: 'glewInit' defined but not used gstgles2.h:44: warning: 'glewGetErrorString' defined but not used gstgles2.h:131: warning: 'glReadBuffer' defined but not used gstgles2.h:136: warning: 'glTexEnvi' defined but not used make[4]: *** [libgstgl_0.10_la-gstglbuffer.lo] Error 1 make[4]: Leaving directory `/home/ensonic/projects/multimedia/git/gst-plugins-gl/gst-libs/gst/gl' Any ideas?
For example glewGetString is used in gstgldisplay.c line 575 (see http://cgit.freedesktop.org/gstreamer/gst-plugins-gl/tree/gst-libs/gst/gl/gstgldisplay.c ) Maybe having a gstgles2.c would resolve the problem. (if you those definitions in this .c)
Julien, how does this then build for you on e.g. wince?
I do not have this warning on vs9 build for wince. You could try the gst-plugins-gl\unixES\codeblocks build.. This is the build I used when I developed gstglwindow_x11ES.c. Does it compile if you temporarily disable "warnings being treated as errors" ?
Created attachment 142381 [details] [review] WIP: assume openGLES2 if no opengl found Small update. Now I get much further when supressing warnings=errors > CFLAGS="-Wno-error" ./autoregen.sh Problem with the warnings are that there is gstgles2.h. I think it would be better to have a gles2.c and only have protos in gles2.h. gles2.c is added to the sources when ES2 targets are build. Feel free to pick chunks from the current patch, as this already helps. Now the build stops at gstglbumper.c, should some of thse not be build against opengles2? gstglbumper.c: In function 'gst_gl_bumper_callback': gstglbumper.c:380: warning: implicit declaration of function 'glMatrixMode' gstglbumper.c:380: error: 'GL_PROJECTION' undeclared (first use in this function) gstglbumper.c:380: error: (Each undeclared identifier is reported only once gstglbumper.c:380: error: for each function it appears in.) gstglbumper.c:381: warning: implicit declaration of function 'gluLookAt' gstglbumper.c:382: error: 'GL_MODELVIEW' undeclared (first use in this function) gstglbumper.c:387: error: 'GL_PERSPECTIVE_CORRECTION_HINT' undeclared (first use in this function) gstglbumper.c:388: warning: implicit declaration of function 'glShadeModel' gstglbumper.c:388: error: 'GL_SMOOTH' undeclared (first use in this function) gstglbumper.c:391: warning: implicit declaration of function 'glLightfv' gstglbumper.c:391: error: 'GL_LIGHT0' undeclared (first use in this function) gstglbumper.c:391: error: 'GL_POSITION' undeclared (first use in this function) gstglbumper.c:392: error: 'GL_DIFFUSE' undeclared (first use in this function) gstglbumper.c:393: error: 'GL_LIGHT1' undeclared (first use in this function) gstglbumper.c:395: warning: implicit declaration of function 'glMaterialfv' gstglbumper.c:396: warning: implicit declaration of function 'glColorMaterial' gstglbumper.c:397: error: 'GL_COLOR_MATERIAL' undeclared (first use in this function) gstglbumper.c:398: error: 'GL_LIGHTING' undeclared (first use in this function) gstglbumper.c:419: warning: implicit declaration of function 'glRotatef' gstglbumper.c:424: warning: implicit declaration of function 'glBegin' gstglbumper.c:424: error: 'GL_QUADS' undeclared (first use in this function) gstglbumper.c:427: warning: implicit declaration of function 'glNormal3d' gstglbumper.c:428: warning: implicit declaration of function 'glVertexAttrib3dARB' gstglbumper.c:429: warning: implicit declaration of function 'glMultiTexCoord2dARB' gstglbumper.c:431: warning: implicit declaration of function 'glVertex3d' gstglbumper.c:527: warning: implicit declaration of function 'glEnd'
(In reply to comment #5) >Now I get much further when supressing warnings=errors > > CFLAGS="-Wno-error" ./autoregen.sh > Problem with the warnings are that there is gstgles2.h. I think it would be > better to have a gles2.c and only have protos in gles2.h. gles2.c is added to > the sources when ES2 targets are build. I agree. > > Feel free to pick chunks from the current patch, as this already helps. > > Now the build stops at gstglbumper.c, should some of thse not be build against > opengles2? > > gstglbumper.c: In function 'gst_gl_bumper_callback': > gstglbumper.c:380: warning: implicit declaration of function 'glMatrixMode' > gstglbumper.c:380: error: 'GL_PROJECTION' undeclared (first use in this Yes only those elements have to be build (for now): glupload gldownload glimagesink glfiltercube see: http://cgit.freedesktop.org/gstreamer/gst-plugins-gl/tree/gst/gl/gstopengl.c I have not yet made the stuffs for the other elements regarding OpenGL ES 2.0. (OpenGL ES 2.0 only uses shaders, even for basic stuffs)
I'll upload a new patch soon. I've got most things to build (the tests dir still fails). Now trying this on the target gives me: # gst-launch -v videotestsrc ! glupload ! glimagesink Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1 Pipeline is PREROLLING ... 0:00:00.631164554 1807 0xab920 ERROR gldisplay gstgldisplay.c:2072:gst_gl_display_check_framebuffer_status: GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS ** ERROR:gstgldisplay.c:2468:gst_gl_display_thread_init_upload_fbo: assertion failed: (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT) Any ideas?
Created attachment 142913 [details] [review] WIP: assume openGLES2 if no opengl found Julien, would it be okay to commit this and then progress from there.
Thx for the patch. I am ok with it. Can you commit it ? (I put a comment to reply to #7, one hour ago and it still not there. I will wait a little bit before to rewrite it)
Are you using a opengl es 2.0 emulator (I was using the ati one at home. But since jaunty I have to use mesa, old version etcc blabla so no video acceleration). But here I have a nvidia. I can try to install the same emulator than you tomorrow. Just tell me how to setup. (or maybe you get the error on the embedded device directly ?) Anyway, try to just comment the assert. I remember I got something like that but I thought I fixed it. Well, gst-launch videotestsrc ! "video/x-raw-rgb" ! glimagesink should work because this pipeline does not use FBO (framebuffer object, related to the error you got)(other filters or yuv are using fbo)
I am testing this on my N900. I'll apply the patch on monday and also try disabling the assert. Thanks for the support so far!
ok. If the comment does not work you could ask to the maemo opengl team if they provide (or ported) an opengl debugger. It would be easy to find what's going wrong. Here on win32 using the ati opengl ES 2.0 emulator there is no pbs. Maybe on maemo the driver is more restrictive. Often the same opengl code can work on some drivers and not on others ... Anyway, GST_DEBUG=gldisplay:3 GST_GL_WINDOW_DEBUG=1 GST_GL_SHADER_DEBUG=1 gst-launch-0.10 videotestsrc ! glimagesink will output more debug.
and some more informations that could help: the error occurs in the "gst_gl_display_thread_init_upload_fbo". This function initialize one framebuffer object that will be used for uploading the raw data buffer. So it attempts to attach a texture to a FBO and then the rendering is made in this texture. That's why you got a gstglbuffer at the output of the glupload element. Well to initialize the framebuffer, we have to attach a fake texture. (fake means that this texture will be deleted just after the init of the fbo) It's just to set the correct dimension of the fbo. Well the error you got means this: GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS : Not all attached images have the same width and height. according to: http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml So this is weird because at this point we only attach one texture to the fbo: the fake texture. So this is not possible. What you can do is to print the width and height: line 2443: glGenTextures (1, &fake_texture); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, fake_texture); glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, display->upload_width, display->upload_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); g_print ("%d x %d\n", display->upload_width, display->upload_height); (print if you can't use a debugger) You can also try to put glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); just before to call "gst_gl_display_thread_init_upload_fbo" I have no other ideas at the moment. Maybe the opengl maemo team would help on it. Good Luck
I have commented out the assert and now it runs, but the screen is black. I have also added a GST_INFO to print the size. GST_DEBUG=gld*:3 GST_GL_WINDOW_DEBUG=1 GST_GL_SHADER_DEBUG=1 gst-launch-0.10 videotestsrc ! glupload ! glimagesink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... 0:00:00.600219752 1720 0x16980 INFO gldisplay gstgldisplay.c:555:gst_gl_display_thread_create_context: gl window created 0:00:00.601562526 1720 0x16980 INFO gldisplay gstgldisplay.c:574:gst_gl_display_thread_create_context: GL_VERSION: OpenGL ES 2.0 0:00:00.602355983 1720 0x16980 INFO gldisplay gstgldisplay.c:575:gst_gl_display_thread_create_context: GLEW_VERSION: 1.5.1 0:00:00.603149440 1720 0x16980 INFO gldisplay gstgldisplay.c:578:gst_gl_display_thread_create_context: GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 1.00 0:00:00.603881862 1720 0x16980 INFO gldisplay gstgldisplay.c:582:gst_gl_display_thread_create_context: GL_VENDOR: Imagination Technologies 0:00:00.604705836 1720 0x16980 INFO gldisplay gstgldisplay.c:583:gst_gl_display_thread_create_context: GL_RENDERER: PowerVR SGX 530 0:00:00.605590846 1720 0x16918 INFO gldisplay gstgldisplay.c:2116:gst_gl_display_create_context: gl thread created 0:00:00.607635523 1720 0x16980 INFO gldisplay gstgldisplay.c:844:gst_gl_display_thread_init_upload: Context, ARB_fragment_shader supported: yes 0:00:00.608612086 1720 0x16980 INFO gldisplay gstgldisplay.c:2428:gst_gl_display_thread_init_upload_fbo: Context, EXT_framebuffer_object supported: yes 0:00:00.609588648 1720 0x16980 INFO gldisplay gstgldisplay.c:2448:gst_gl_display_thread_init_upload_fbo: 320 x 240 0:00:00.619354274 1720 0x16980 ERROR gldisplay gstgldisplay.c:2072:gst_gl_display_check_framebuffer_status: GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock 0:00:01.090332056 1720 0x16980 INFO gldisplay gstgldisplay.c:2010:gst_gl_display_gldel_texture: one more sub texture pool inserted: 20971760 0:00:01.091522242 1720 0x16980 INFO gldisplay gstgldisplay.c:2012:gst_gl_display_gldel_texture: nb sub texture pools: 1
gst_gl_display_thread_init_upload_fbo() is called from several places in gst_gl_display_thread_init_upload(). So i tried adding glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); to the begin of gst_gl_display_thread_init_upload(), but its not helping.
something is not normal in the debug output of GST_GL_WINDOW_DEBUG=1 You should have some outputs "...GstGLWindow-DEBUG.... egl initialized: ... " etc.. (those debug should come from gstglwindow_x11es.c) >>gst_gl_display_thread_init_upload_fbo() is called from several places in >>gst_gl_display_thread_init_upload(). but only ONE is called for one execution >>So i tried adding glBindTexture >>(GL_TEXTURE_RECTANGLE_ARB, 0); to the begin of >>gst_gl_display_thread_init_upload(), but its not helping. So It has not the same behaviour I suggest. Ok I re read what I wrote and I did a mistake: >>>>You can also try to put >>>>glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); >>>>just before to call "gst_gl_display_thread_init_upload_fbo" it's not "gst_gl_display_thread_init_upload_fbo", it's "gst_gl_display_check_framebuffer_status ();" in gst_gl_display_thread_init_upload_fbo
Also the glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0) in gst_gl_display_thread_init_upload_fbo() does not change anything. I've also tried the videotestsrc ! glimagesink without the upload and it too is just black. Regarding the output from GST_GL_WINDOW_DEBUG=1 - our glib send it to syslog: Jan 1 09:54:01 Nokia-N900-38-10 gst-launch-0.10[1806]: GLIB DEBUG GstGLWindow - Quit loop message 62914562d Jan 1 09:54:01 Nokia-N900-38-10 gst-launch-0.10[1806]: GLIB DEBUG GstGLWindow - end loop Jan 1 09:54:01 Nokia-N900-38-10 gst-launch-0.10[1806]: GLIB DEBUG GstGLWindow - failed to release opengl context Jan 1 09:54:01 Nokia-N900-38-10 gst-launch-0.10[1806]: GLIB DEBUG GstGLWindow - display receiver closed Jan 1 09:54:01 Nokia-N900-38-10 gst-launch-0.10[1806]: GLIB DEBUG GstGLWindow - display sender closed
(In reply to comment #17) ok > Regarding the output from GST_GL_WINDOW_DEBUG=1 - our glib send it to syslog: > > Jan 1 09:54:01 Nokia-N900-38-10 gst-launch-0.10[1806]: GLIB DEBUG GstGLWindow > - Quit loop message 62914562d It should have other debug output before this one. Could you put the whole trace ?
Sorry, the log was busy and I missed the start - here is the full output (I have cut the timestamps and log levels for readability) GstGLWindow - gl device id: 726016 GstGLWindow - gl display sender: 738816 GstGLWindow - gl root id: 68d GstGLWindow - gl window id: 65011714d GstGLWindow - gl window props: x:20 y:20 w:320 h:240 GstGLWindow - egl initialized: 1.4 GstGLWindow - config set: 11, 1 GstGLWindow - surface created: 800400 GstGLWindow - gl context created: 802368 GstGLWindow - begin loop GstGLWindow - unknow GstGLWindow - unknow GstGLWindow - Quit loop message 65011714d GstGLWindow - end loop GstGLWindow - failed to release opengl context GstGLWindow - display receiver closed GstGLWindow - display sender closed
Ok i do not see anything not normal. So it seems that the error you got: >>gstgldisplay.c:2072:gst_gl_display_check_framebuffer_status: >>GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS is a real error. Can you try this exact pipeline: gst-launch videotestsrc ! "video/x-raw-rgb" ! glimagesink ? (because this one does not use FBO, so you can't have the same error with this pipeline) (whereas with yuv, it uses FBO)
Then about the error I can't do more without debugging it by my self. Do you think I could have access to the device ? (by vnc ?) Are you able to reproduce the pb with the SDK ? If yes, maybe I could debug here. If no to all my questions then I can't do more.
(just to keep a trace, the "Khronos OpenGL ES 2.0 SDKs" is there: http://www.imgtec.com/powerVR/insider/sdkdownloads/index.asp) Available for linux and win
(In reply to comment #20) > Ok i do not see anything not normal. > > So it seems that the error you got: > >>gstgldisplay.c:2072:gst_gl_display_check_framebuffer_status: > >>GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS > > is a real error. > > Can you try this exact pipeline: > gst-launch videotestsrc ! "video/x-raw-rgb" ! glimagesink > ? > (because this one does not use FBO, so you can't have the same error with this > pipeline) > (whereas with yuv, it uses FBO) \o/ gst-launch videotestsrc ! "video/x-raw-rgb" ! glimagesink works!
Created attachment 144379 [details] [review] Fix for GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS while running in begleboard I am using gst-plugins-gl (commit id: 18f5c4875006606b28aa9aa366abbc5dd1e16b60) in beagleboard (OMAP3). While running this I saw this error GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS and abort during init. After some digging I think the failure is due to this As per http://www.khronos.org/opengles/sdk/docs/man/glRenderbufferStorage.xml glRenderbufferStorage takes only one of these as internalformat (GL_RGBA4,GL_RGB565,GL_RGB5_A1,GL_DEPTH_COMPONENT16, GL_STENCIL_INDEX8) so IMG driver implementation for SGX530 is complying to this whereas gst-plugins-gl uses GL_DEPTH_COMPONENT for GLES now. With attached patch I can run filtercube plugin in beagleboard.
Stefan, could you try this patch on your N900 ? if it's ok then please commit it. (I could refactor opengles ifdefs later)
with the patch applied I still have no luck :/ gst-launch-0.10 videotestsrc ! glupload ! glfiltercube ! glimagesink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ** ERROR:gstgldisplay.c:1586:gst_gl_display_thread_gen_fbo: assertion failed: (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT) Pratheeh, what is the exact gst-launch command you could run?
Stefan, I ran this. gst-launch filesrc location= $1 ! qtdemux ! TIViddec2 ! glupload ! glfiltercube ! glimagesink qos=false sync=true ts-offset=20000
TIViddec2 does H.264 decode and generates UYVY output. Works well for QVGA (320x240) streams on beagleboard.
(In reply to comment #26) > with the patch applied I still have no luck :/ > > gst-launch-0.10 videotestsrc ! glupload ! glfiltercube ! glimagesink > Setting pipeline to PAUSED ... > Pipeline is PREROLLING ... > ** > ERROR:gstgldisplay.c:1586:gst_gl_display_thread_gen_fbo: assertion failed: > (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) == > GL_FRAMEBUFFER_COMPLETE_EXT) > Stefan, Is it also an error about "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS" ? Pratheesh, Did you see any other possible error around FBO in gstgldisplay.c (like the one you resolved) ?
I did not notice any other error. Some more details which may help to debug - I am using 1.3.13.1832(cat /proc/pvr/version) version of IMG binaries from OMAP3 Graphics SDK 3.00.00.09. Basically track which call actually fails using glCheckFramebufferStatusEXT after each API invocation... I found that DEPTH_ATTACHMENT_EXT is the one fails. Initially commented out DEPTH_ATTACHMENT_EXT to workaround GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS error. Later figured out that the root cause is glRenderbufferStorageEXT . Please see http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=87a9e6b4f556808aef42bf8f89d2740379e97727 for details.
Stefan, Could you try to apply the patch and then put GL_UNSIGNED_SHORT_5_6_5 instead of GL_UNSIGNED_BYTE just after using GL_DEPTH_COMPONENT16 (3 times, see the patch) in glTexImage2D. If you still have an error, is it at the same place and is it also "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS" ?
I just realized you got first an error in "gst_gl_display_thread_init_upload_fbo" but after the Pratheesh Gangadhar 's patch the error is now later, in "gst_gl_display_thread_gen_fbo". You can commit his patch so.
Review of attachment 144379 [details] [review]: Actually the patch is wrong for some parts. Maybe due to a copy past, for example; +#ifndef OPENGL_ES2 glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, - display->gen_fbo_width, display->gen_fbo_height); + display->download_width, display->download_height); +#else + glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, + display->download_width, display->download_height); +#endif it should be gen_fbo_width and height and not download ...
also see: commit 455868cd2999ce39a2fa25d4745c6bd64d428f94 Author: Julien Isorce <julien.isorce@gmail.com> Date: Thu Oct 15 15:40:11 2009 +0200 ES2.0: remove warnings Partially fix #593786 Anyway, about GL_DEPTH_COMPONENT16, could you rewrite a patch ?
I am going to make it by the end of the week so ...
commit a17e7ad3dfc221a2b14bdba1df47939d1c1b2883 Author: Pratheesh Gangadhar <pratheesh.gangadhar@gmail.com> Date: Tue Oct 27 17:02:23 2009 +0100 gstgldisplay: use of GL_DEPTH_COMPONENT16 if OpenGL ES 2.0 glRenderbufferStorage does not accept GL_DEPTH_COMPONENT in OpenGL ES 2.0. Fix bug #593786
I closed this bug because its subject is now resolved.
\o/ just retested and it works on N900 now. Now need to add ifdefs to e.g. the tests to make the whole package build.