mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
plugins: fix support for Wayland/EGL running alongside X11.
When multiple display servers are available, the glimagesink element (from GStreamer 1.4) may not be able to derive a global display in Wayland. Rather, a "window"-specific display is created. In this case, the GstGLDisplay handle available through GstGLContext is invalid. So, try to improve heuristics for display server characterisation in those particular situations.
This commit is contained in:
parent
60e96e80cc
commit
7343ce41cd
1 changed files with 34 additions and 2 deletions
|
@ -148,6 +148,8 @@ gst_vaapi_create_display_from_gl_context (GstObject * gl_context_object)
|
||||||
#if USE_GST_GL_HELPERS
|
#if USE_GST_GL_HELPERS
|
||||||
GstGLContext *const gl_context = GST_GL_CONTEXT (gl_context_object);
|
GstGLContext *const gl_context = GST_GL_CONTEXT (gl_context_object);
|
||||||
GstGLDisplay *const gl_display = gst_gl_context_get_display (gl_context);
|
GstGLDisplay *const gl_display = gst_gl_context_get_display (gl_context);
|
||||||
|
gpointer native_display =
|
||||||
|
GSIZE_TO_POINTER (gst_gl_display_get_handle (gl_display));
|
||||||
GstVaapiDisplay *display, *out_display;
|
GstVaapiDisplay *display, *out_display;
|
||||||
GstVaapiDisplayType display_type;
|
GstVaapiDisplayType display_type;
|
||||||
|
|
||||||
|
@ -162,6 +164,37 @@ gst_vaapi_create_display_from_gl_context (GstObject * gl_context_object)
|
||||||
display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case GST_GL_DISPLAY_TYPE_ANY:{
|
||||||
|
/* Derive from the active window */
|
||||||
|
GstGLWindow *const gl_window = gst_gl_context_get_window (gl_context);
|
||||||
|
const gchar *const gl_window_type = g_getenv ("GST_GL_WINDOW");
|
||||||
|
|
||||||
|
display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
|
||||||
|
if (!gl_window)
|
||||||
|
break;
|
||||||
|
native_display = GSIZE_TO_POINTER (gst_gl_window_get_display (gl_window));
|
||||||
|
|
||||||
|
if (gl_window_type) {
|
||||||
|
#if USE_X11
|
||||||
|
if (!display_type && g_strcmp0 (gl_window_type, "x11") == 0)
|
||||||
|
display_type = GST_VAAPI_DISPLAY_TYPE_X11;
|
||||||
|
#endif
|
||||||
|
#if USE_WAYLAND
|
||||||
|
if (!display_type && g_strcmp0 (gl_window_type, "wayland") == 0)
|
||||||
|
display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#if USE_X11
|
||||||
|
if (!display_type && GST_GL_HAVE_WINDOW_X11)
|
||||||
|
display_type = GST_VAAPI_DISPLAY_TYPE_X11;
|
||||||
|
#endif
|
||||||
|
#if USE_WAYLAND
|
||||||
|
if (!display_type && GST_GL_HAVE_WINDOW_WAYLAND)
|
||||||
|
display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
|
display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
|
||||||
break;
|
break;
|
||||||
|
@ -169,8 +202,7 @@ gst_vaapi_create_display_from_gl_context (GstObject * gl_context_object)
|
||||||
if (!display_type)
|
if (!display_type)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
display = gst_vaapi_create_display_from_handle (display_type,
|
display = gst_vaapi_create_display_from_handle (display_type, native_display);
|
||||||
GSIZE_TO_POINTER (gst_gl_display_get_handle (gl_display)));
|
|
||||||
if (!display)
|
if (!display)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue