GNOME Bugzilla – Bug 727843
glimagesink: shows only a black screen
Last modified: 2014-04-12 20:30:25 UTC
glimagkesink shows only a black screen in Android. This can be reproduced with videotestsrc ! glimagesink
Sounds like what I had on iOS with EAGL too: bug #703341
(In reply to comment #0) > glimagkesink shows only a black screen in Android. This can be reproduced with > videotestsrc ! glimagesink Matthew pointed that gstgl uses vertex attributes whereas eglglessink uses VBO. Have you tried thoses gstgl checks http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/check/libs ? Also try other formats, videotestsrc ! "video/x-raw, format=f" ! glimagesink for RGB, RGBA, YV12, NV12, I420, YUY2, UYVY . You could also try videotestsrc num-buffers=1 ! glcolorscale ! pngenc ! filesink location=res.png I wonder if on Android there are global env vars to turn on gl debug like with mesa: http://www.mesa3d.org/envvars.html
I tried all the formats and none of them worked. It's a bit complicated to run the tests in Android, my device is not rooted and I can't run the tests. This pipeline generated a file with 0 size. videotestsrc num-buffers=1 ! glcolorscale ! pngenc ! filesink location=res.png
git bisect says: commit 82b7c915bb02a9790d256d599452e5a54afda633 Author: Sebastian Dröge <sebastian@centricular.com> Date: Sun Apr 6 11:57:12 2014 +0200 glimagesink: Create GL context and set up window from the streaming thread gst_gl_context_create() might need to dispatch some operations to the application's main thread, and calling this in the change_state function can cause deadlocks. So it would seem that there's some funky thread affinity going on here. What was the reason you needed this for the EAGL stuff Sebastian?
Hmm, that change works for me on my laptop. The reason for that change is that glimagesink's state change function is called from the application thread, creates the GL context and waits for it to be created in another thread. For EAGL I will need to call something in the application thread during the GL context creation, so would deadlock because of that. The GL context thread is waiting for stuff to be done on the application thread, the application thread is waiting for the GL context thread is waiting for the application thread to do something.
It works on my laptop also. Not on my android device though.
Right, I was wondering how you reproduced it :) Ok, so that is likely the problem on EAGL too... now just need to find the reason and a way to fix that without breaking EAGL even more ;)
Created attachment 274069 [details] [review] just prepare next patch
Created attachment 274070 [details] [review] init GstContext GObject in the main thread
please try those 2 patches, it at least fixes a regression introduced by "glimagesink: Create GL context and set up window from the streaming thread" on OSX when running videotestsrc ! glimagesink. I could not click on the window close cross anymore or do any resizing. When debugging and trying to find a solution I found that just initializing the GObject/GstGLContext in the main thread makes it work again. But at this time I cannot explain correctly why. I have just some guess.
Looks ok from an EAGL point of view. As long as _create() is called not from the app thread (state change thread) and the app thread is not blocked during _create() it should work. Will test on iOS this evening.
Also before merging that we should understand why :)
In android I have the following errors now with these patches and current master 04-11 12:37:13.562: I/GStreamer+glupload(7603): 0:00:00.272685469 0x75758180 gstglupload.c:1025:_init_upload_fbo Context, EXT_framebuffer_object supported: yes 04-11 12:37:13.562: W/Adreno-ES20(7603): <core_glRenderbufferStorage:637>: GL_INVALID_VALUE 04-11 12:37:13.562: E/GStreamer+default(7603): 0:00:00.274935729 0x75758180 gstglutils.c:72:gst_gl_context_check_framebuffer_status GL_FRAMEBUFFER_UNSUPPORTED 04-11 12:37:13.562: W/GStreamer+default(7603): 0:00:00.275088281 0x75758180 gstglutils.c:520:gst_gl_context_set_error GL framebuffer status incomplete 04-11 12:37:13.562: W/GStreamer+glimagesink(7603): 0:00:00.275298541 0x7574dd20 gstglimagesink.c:456:_ensure_gl_setup:<glimagesink0> error: Failed to init upload
My libgstgl.a was not up-to-date, testing again
I get the same results of a black window with the new patches in android
(In reply to comment #15) > I get the same results of a black window with the new patches in android Ok thx for trying, also that make senses it did not resolve the problem :) The magic thing around initializing GstGLContext in the main thread or not was actually because it was calling [NSApplication sharedApplication] in GstGLContextCocoaClass :)
This here maybe fixes it: commit 0bd53c9ccbb71f33e48bb90a7ae3587a1fae49c4 Author: Sebastian Dröge <sebastian@centricular.com> Date: Sat Apr 12 17:01:09 2014 +0200 glimagesink: First handle GL window setup, then create the context and its thread Currently rebuilding the EAGL backend for testing...
Yes, works now.