GNOME Bugzilla – Bug 728940
gst-omx: port testegl example to new libgstgl
Last modified: 2015-11-13 18:08:03 UTC
libgstegl has been removed and libgstgl contains both egl and gl stuffs. I have started to port http://cgit.freedesktop.org/gstreamer/gst-omx/tree/examples/egl/testegl.c from libgstegl to libgstgl here: https://bug703343.bugzilla-attachments.gnome.org/attachment.cgi?id=272777 The remaining changed are to use GLESv2 instead of GLESv1 as there is no GLESv1 support in libgstgl. This test will also serve as an example about how to use libgstgl with an external sink/app, see https://bugzilla.gnome.org/show_bug.cgi?id=723674
Created attachment 275435 [details] [review] glfilter: refactor template caps to make it more readable
Created attachment 275436 [details] [review] glfilter: can output caps with memory:EGLImage feature only if it wants to preserve it
Created attachment 275437 [details] [review] glcolorscale: wants to preserve EGLImage
So those 3 attached patches are required to make the new gst-omx:testegl.c work which is here: http://cgit.collabora.com/git/user/julien/gst-omx.git/log/?h=port_testegl
Review of attachment 275435 [details] [review]: Looks fine
Review of attachment 275436 [details] [review]: I feel this could be implemented more generically rather than relying on the presence of eglimage.
Review of attachment 275437 [details] [review]: Looks fine
(In reply to comment #6) > Review of attachment 275436 [details] [review]: > > I feel this could be implemented more generically rather than relying on the > presence of eglimage. Right, also maybe later we could imagine having a glfiter that first upload the EGLImage and then apply some shaders, render the result to a gltexture and create another EGLImage from it. Don't know in which scenario it could be useful but it's possible. 1- Also maybe here for my need it should be enough to set glcolorscale to passthrough if input and ouput caps are equals. 2- We still need to do some work in glfilter because right now, on egl platform, videotestsrc ! gleffects ! glimagesink -v prints: "video/x-raw(memory:EGLImage)" between gleffects and glimagesink, whereas it should be "video/x-raw(meta:GstVideoGLTextureUploadMeta)" :) Speaking about that, now that EGLIMage memory has its meta upload (http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/gst-libs/gst/gl/egl/gsteglimagememory.c#n555), should it be "video/x-raw(meta:GstVideoGLTextureUploadMeta)" too ? So that we could remove "video/x-raw(memory:EGLImage)", after all there is also memory:GLMemory but we still set "video/x-raw(meta:GstVideoGLTextureUploadMeta)".
What's the status here?
It's here http://cgit.collabora.com/git/user/julien/gst-omx.git/log/?h=port_testegl (the last 3 commits). I remember it depends on some gstgl patches being upstream. I hope I can find time to finalize it this week.
Comment on attachment 275437 [details] [review] glcolorscale: wants to preserve EGLImage See https://bugzilla.gnome.org/show_bug.cgi?id=732178
Comment on attachment 275436 [details] [review] glfilter: can output caps with memory:EGLImage feature only if it wants to preserve it See https://bugzilla.gnome.org/show_bug.cgi?id=732178
Comment on attachment 275435 [details] [review] glfilter: refactor template caps to make it more readable See https://bugzilla.gnome.org/show_bug.cgi?id=732178
commit e1a1e5f3351b9eb926c4c9c9d999412bb5000ded Author: Julien Isorce <julien.isorce@collabora.co.uk> Date: Fri Apr 25 13:25:05 2014 +0100 example: enable testegl See https://bugzilla.gnome.org/show_bug.cgi?id=728940 commit 3d0b891e42b67c108bd6604bb3e2ff9ed6faaf4a Author: Julien Isorce <julien.isorce@collabora.co.uk> Date: Wed Jun 25 10:19:54 2014 +0100 testegl: do matrix mutlplication in the shader See https://bugzilla.gnome.org/show_bug.cgi?id=728940 commit 91c6e34217a5badfd49a76b1b333b49f69cb278f Author: Julien Isorce <julien.isorce@collabora.co.uk> Date: Wed Jun 25 09:36:38 2014 +0100 testegl: add a comment for the parse command See https://bugzilla.gnome.org/show_bug.cgi?id=728940 commit 31cd1fd77b893c6273c447e972f1fe975d188605 Author: Julien Isorce <julien.isorce@collabora.co.uk> Date: Fri Apr 25 17:32:16 2014 +0100 testegl: convert code from GLESv1 to GLESv2 See https://bugzilla.gnome.org/show_bug.cgi?id=728940 commit f1c76ef92112acc7855d5715ac149a3620559f6a Author: Julien Isorce <julien.isorce@collabora.co.uk> Date: Fri Apr 25 13:21:59 2014 +0100 testegl: port to gstgl API - append a glfilter just before fakesink So that we get gltexture or eglimages - propagate our EGLDisplay to the pipeline see GST_QUERY_CONTEXT - share our EGLContext with the iternal gl context of the pipeline, see GST_QUERY_ALLOCATION - use GstVideoGLTextureUploadMeta to upload the incoming gltexture or eglimage to our gl texture TODO: convert from GLESv1 to GLESv2 See https://bugzilla.gnome.org/show_bug.cgi?id=728940
Result: https://drive.google.com/file/d/0Bw6t368wtIMYRldmLUlOWnJ6VzQ/edit?usp=sharing
This patch seems to have caused a regression on the Raspberry Pi: Making all in examples make[2]: Entering directory '/home/pi/packages/gstreamer-1.5/gst-omx/examples' Making all in egl make[3]: Entering directory '/home/pi/packages/gstreamer-1.5/gst-omx/examples/egl' CC testegl-testegl.o testegl.c: In function 'init_textures': testegl.c:734:37: error: 'GL_RGBA8' undeclared (first use in this function) glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, meta->width, meta->height, 0, ^ testegl.c:734:37: note: each undeclared identifier is reported only once for each function it appears in testegl.c: In function 'query_cb': testegl.c:1081:14: error: too few arguments to function 'gst_gl_handle_context_query' return gst_gl_handle_context_query (state->pipeline, query, ^ In file included from /usr/local/include/gstreamer-1.0/gst/gl/gl.h:36:0, from testegl.c:61: /usr/local/include/gstreamer-1.0/gst/gl/gstglutils.h:102:10: note: declared here gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query, ^ Makefile:509: recipe for target 'testegl-testegl.o' failed make[3]: *** [testegl-testegl.o] Error 1 make[3]: Leaving directory '/home/pi/packages/gstreamer-1.5/gst-omx/examples/egl' Makefile:463: recipe for target 'all-recursive' failed make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/home/pi/packages/gstreamer-1.5/gst-omx/examples' Makefile:513: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/pi/packages/gstreamer-1.5/gst-omx' Makefile:444: recipe for target 'all' failed make: *** [all] Error 2 Looks like another report of breakage here: http://lists.freedesktop.org/archives/gstreamer-devel/2015-September/054479.html
The following patch works around this breakage: diff --git a/examples/egl/Makefile.am b/examples/egl/Makefile.am index 2646cba..e81945e 100644 --- a/examples/egl/Makefile.am +++ b/examples/egl/Makefile.am @@ -1,9 +1,5 @@ noinst_PROGRAMS = -if USE_OMX_TARGET_RPI -noinst_PROGRAMS += testegl -endif - testegl_SOURCES = testegl.c noinst_HEADERS = cube_texture_and_coords.h