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>
This commit is contained in:
Nicolas Dufresne 2021-07-20 09:37:58 -04:00 committed by GStreamer Marge Bot
parent e97fda46dc
commit aba6bd7822

View file

@ -614,8 +614,11 @@ gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window); GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
struct wl_surface *surface = (struct wl_surface *) handle; struct wl_surface *surface = (struct wl_surface *) handle;
/* already set the NULL handle */ /* Don't unparent if the window handle haven't changed or both were %NULL.
if (surface == NULL && window_egl->window.foreign_surface == 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; return;
/* unparent */ /* unparent */