Skip to content

Commit

Permalink
glcontext: Ask for an alpha channel and fallback
Browse files Browse the repository at this point in the history
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1176>
  • Loading branch information
ndufresne authored and GStreamer Marge Bot committed May 31, 2021
1 parent 7641d64 commit cd31689
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions gst-libs/gst/gl/egl/gstglcontext_egl.c
Expand Up @@ -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));
Expand Down Expand Up @@ -704,12 +705,6 @@ gst_gl_context_egl_choose_config (GstGLContextEGL * egl, GstGLAPI gl_api,
/* 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;
Expand All @@ -718,6 +713,8 @@ gst_gl_context_egl_choose_config (GstGLContextEGL * egl, GstGLAPI gl_api,
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;
Expand All @@ -732,6 +729,12 @@ gst_gl_context_egl_choose_config (GstGLContextEGL * egl, GstGLAPI gl_api,
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) {
Expand Down

0 comments on commit cd31689

Please sign in to comment.