GNOME Bugzilla – Bug 748425
GL context on android has 16bits colors
Last modified: 2015-04-27 14:48:20 UTC
gst_gl_context_egl_choose_config() does not specify which color format to use. By default android often gives 16bits colors, even if the screen does support 24bits colors. I've tested 3 devices: 1) nexus4: with android 5.0 gstreamer displays 16bits colors with no dithering, but with android 5.1 it gets 24bits colors and look perfect. 2) Galaxy S5: 16bits colors, no dithering. 3) Tab4: 16bits colors, with good dithering.
Created attachment 302312 [details] [review] incomplete patch This trivial patch fix the problem, but we probably want to verify that 24bits is supported otherwise we could be compatibility issues I guess.
Yeah, see https://www.khronos.org/registry/egl/sdk/docs/man/html/eglGetConfigs.xhtml :)
Created attachment 302316 [details] [review] patch Choosing one config returned by eglGetConfigs seems complicated, so I opted to try with 24bits then fallback it failed. I'm not sure the fallback is actually required here, I doubt there are platforms where 24bits colors are not supported. Even on devices that have 16bits screens the EGL platforms should support 24bits AFAIK.
I think what you usually do there is to just iterate over all configs and select the one that is "best". I'll take a look at implementing this in a few minutes :)
Actually that's what eglChooseConfig() is doing. It gives all configs that are compatible with the attributes we provided. Nevermind :)
Comment on attachment 302316 [details] [review] patch Changing a static variable here is not a good idea. The supported configs are different depending on the display.
Review of attachment 302316 [details] [review]: ::: gst-libs/gst/gl/egl/gstglcontext_egl.c @@ +177,3 @@ + EGL_RENDERABLE_TYPE, + EGL_OPENGL_BIT, + EGL_DEPTH_SIZE, 16, Might make sense to also try with that being set to 0 if all fails @@ +179,3 @@ + EGL_DEPTH_SIZE, 16, + EGL_BUFFER_SIZE, 24, + EGL_ALPHA_SIZE, 1, We only care about alpha size on RPI/Wayland. In general it does not matter much for us if the config supports alpha or not.
Created attachment 302446 [details] [review] egl: Use maximum bits per color instead of minimum
Reading the eglChooseConfig doc again, turns out it's much easier than my previous patch. When specifying EGL_RED/GREEN/BLUE/_SIZE instead of EGL_BUFFER_SIZE, it will take the MAX possible value instead of the MIN. So setting them to 1 should work in all cases. That's also what the GLX context does.
Attachment 302446 [details] pushed as 5bfaaf4 - egl: Use maximum bits per color instead of minimum
Review of attachment 302446 [details] [review]: .
Thanks.