Blame SOURCES/0016-xwayland-eglstream-Do-not-commit-without-surface.patch

b6a310
From 9601f2cc5c94b9db4c7f8da404dae53b9609c995 Mon Sep 17 00:00:00 2001
b6a310
From: Olivier Fourdan <ofourdan@redhat.com>
b6a310
Date: Mon, 19 Apr 2021 18:11:19 +0200
b6a310
Subject: [PATCH xserver 16/27] xwayland/eglstream: Do not commit without
b6a310
 surface
b6a310
MIME-Version: 1.0
b6a310
Content-Type: text/plain; charset=UTF-8
b6a310
Content-Transfer-Encoding: 8bit
b6a310
b6a310
The EGL surface for the xwl_pixmap is created once the stream is ready
b6a310
and valid.
b6a310
b6a310
If the pixmap's EGL surface fails, for whatever reason, the xwl_pixmap
b6a310
will be unusable and will end up as an invalid wl_buffer.
b6a310
b6a310
Make sure we do not allow commits in that case and recreate the
b6a310
xwl_pixmap/stream.
b6a310
b6a310
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
b6a310
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
b6a310
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1156
b6a310
(cherry picked from commit 098e0f52c088c6eb52c7e54c5a11cefabd480908)
b6a310
---
b6a310
 hw/xwayland/xwayland-glamor-eglstream.c | 9 ++++++++-
b6a310
 1 file changed, 8 insertions(+), 1 deletion(-)
b6a310
b6a310
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
b6a310
index 399a691d3..ce066cd9e 100644
b6a310
--- a/hw/xwayland/xwayland-glamor-eglstream.c
b6a310
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
b6a310
@@ -670,7 +670,14 @@ xwl_glamor_eglstream_allow_commits(struct xwl_window *xwl_window)
b6a310
 
b6a310
             return FALSE;
b6a310
         } else {
b6a310
-            return TRUE;
b6a310
+            if (xwl_pixmap->surface != EGL_NO_SURFACE)
b6a310
+                return TRUE;
b6a310
+
b6a310
+            /* The pending stream got removed, we have a xwl_pixmap and
b6a310
+             * yet we do not have a surface.
b6a310
+             * So something went wrong with the surface creation, retry.
b6a310
+             */
b6a310
+            xwl_eglstream_destroy_pixmap_stream(xwl_pixmap);
b6a310
         }
b6a310
     }
b6a310
 
b6a310
-- 
b6a310
2.31.1
b6a310