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

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