summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2021-07-20 09:37:58 -0400
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-07-21 20:56:23 +0000
commitaba6bd7822f4c0f572765bfaada76f454a594317 (patch)
treee723ee50167e17b748e54beee4e7ea83ef5e1a17
parente97fda46dc523d7d1c13aa9d6e85986226a46f54 (diff)
downloadgstreamer-plugins-base-aba6bd7822f4c0f572765bfaada76f454a594317.tar.gz
glwindow: wayland: Skip redoing surfaces if window haven't changed
The problem is that EGLNativeWindowSurface and wl_egl_surface are the same object underneath, so we must recreate both together. As an optimization, the EGLNativeWindowSurface wrapper is only re-created if the window_handle changed. On Mesa, this would cause crash, which will be fixed by: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11979 And will lead to proper errors in the future or on other GL stack. This issue was encounter using a permanent GstGLDisplay after cycling one of multiple independent pipelines through NULL state. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
-rw-r--r--gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
index f2d7ceb4e..621e4dba3 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -614,8 +614,11 @@ gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
struct wl_surface *surface = (struct wl_surface *) handle;
- /* already set the NULL handle */
- if (surface == NULL && window_egl->window.foreign_surface == NULL)
+ /* Don't unparent if the window handle haven't changed or both were %NULL.
+ * We have to do that, since GstGLContextEGL will not recreate its
+ * EGLNativeWindowSurface, which will lead to crash with some Mesa driver
+ * version, or errors otherwise. */
+ if (window_egl->window.foreign_surface == surface)
return;
/* unparent */