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

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