From cd31689cedac8b0cf5566084ef84dfdf3788b00d Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 26 May 2021 16:57:28 -0400 Subject: [PATCH] glcontext: Ask for an alpha channel and fallback While this was already possible through the GLContext machinary, this simply request an alpha channel by default and fallback if this is not possible. This obsolete some RPi Dispmanx hack, since this is near equivalent will allow see through when playgin WebM Alpha or other transparent files. Application are still free to pass their own EGLContext attribute, this is specially for the case the application let GStreamer chose (e.g. gst-launch). Part-of: --- gst-libs/gst/gl/egl/gstglcontext_egl.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c index 1254fdd09b..459ee63b07 100644 --- a/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -635,6 +635,7 @@ gst_gl_context_egl_choose_config (GstGLContextEGL * egl, GstGLAPI gl_api, EGLint egl_api = 0; EGLBoolean ret = EGL_FALSE; EGLint surface_type = EGL_WINDOW_BIT; + EGLint alpha_size = 1; GstGLWindow *window; window = gst_gl_context_get_window (GST_GL_CONTEXT (egl)); @@ -704,12 +705,6 @@ try_again: /* TODO: more values */ #undef TRANSFORM_VALUE } else { -#if defined(USE_EGL_RPI) && GST_GL_HAVE_WINDOW_WAYLAND - /* The configurations with a=0 seems to be buggy whereas - * it works when using dispmanx directly */ - config_attrib[i++] = EGL_ALPHA_SIZE; - config_attrib[i++] = 1; -#endif config_attrib[i++] = EGL_DEPTH_SIZE; config_attrib[i++] = 16; config_attrib[i++] = EGL_RED_SIZE; @@ -718,6 +713,8 @@ try_again: config_attrib[i++] = 1; config_attrib[i++] = EGL_BLUE_SIZE; config_attrib[i++] = 1; + config_attrib[i++] = EGL_ALPHA_SIZE; + config_attrib[i++] = alpha_size; } config_attrib[i++] = EGL_NONE; @@ -732,6 +729,12 @@ try_again: GST_TRACE_OBJECT (egl, "Retrying config with window bit"); goto try_again; } + + if (alpha_size == 1) { + alpha_size = 0; + GST_TRACE_OBJECT (egl, "Retrying config not forcing an alpha channel"); + goto try_again; + } } if (ret && numConfigs == 1) {