Blame SOURCES/0009-xwayland-glamor-Add-return-status-to-post_damage.patch

5f5628
From c28bb0e879775aec83f5554522724eee592685dc Mon Sep 17 00:00:00 2001
5f5628
From: Olivier Fourdan <ofourdan@redhat.com>
5f5628
Date: Wed, 31 Mar 2021 13:57:45 +0200
5f5628
Subject: [PATCH xserver 09/27] xwayland/glamor: Add return status to
5f5628
 post_damage
5f5628
MIME-Version: 1.0
5f5628
Content-Type: text/plain; charset=UTF-8
5f5628
Content-Transfer-Encoding: 8bit
5f5628
5f5628
If the glamor backend failed to post damage, the caller should do the
5f5628
same to avoid a failure to attach the buffer to the Wayland surface.
5f5628
5f5628
Change the API of Xwayland's glamor backend post_damage() to return a
5f5628
status so that xwl_window_post_damage() can tell whether the callee
5f5628
failed.
5f5628
5f5628
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
5f5628
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
5f5628
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1156
5f5628
(cherry picked from commit 252cbad316f43edc08aa5c844789398a58ba270c)
5f5628
---
5f5628
 hw/xwayland/xwayland-glamor-eglstream.c | 6 ++++--
5f5628
 hw/xwayland/xwayland-glamor.c           | 6 ++++--
5f5628
 hw/xwayland/xwayland-glamor.h           | 4 ++--
5f5628
 hw/xwayland/xwayland-window.c           | 8 ++++++--
5f5628
 4 files changed, 16 insertions(+), 8 deletions(-)
5f5628
5f5628
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
5f5628
index c6e17bf8b..f64d05064 100644
5f5628
--- a/hw/xwayland/xwayland-glamor-eglstream.c
5f5628
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
5f5628
@@ -605,7 +605,7 @@ xwl_glamor_eglstream_allow_commits(struct xwl_window *xwl_window)
5f5628
     return FALSE;
5f5628
 }
5f5628
 
5f5628
-static void
5f5628
+static Bool
5f5628
 xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window,
5f5628
                                  PixmapPtr pixmap, RegionPtr region)
5f5628
 {
5f5628
@@ -625,7 +625,7 @@ xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window,
5f5628
          * flipping OpenGL or Vulkan window. In that case, we don't
5f5628
          * need to do the copy below.
5f5628
          */
5f5628
-        return;
5f5628
+        return TRUE;
5f5628
 
5f5628
     /* Unbind the framebuffer BEFORE binding the EGLSurface, otherwise we
5f5628
      * won't actually draw to it
5f5628
@@ -668,6 +668,8 @@ xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window,
5f5628
 
5f5628
     /* hang onto the pixmap until the compositor has released it */
5f5628
     pixmap->refcnt++;
5f5628
+
5f5628
+    return TRUE;
5f5628
 }
5f5628
 
5f5628
 static Bool
5f5628
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
5f5628
index 9e44d5106..e940f9fd7 100644
5f5628
--- a/hw/xwayland/xwayland-glamor.c
5f5628
+++ b/hw/xwayland/xwayland-glamor.c
5f5628
@@ -304,14 +304,16 @@ xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap)
5f5628
     return NULL;
5f5628
 }
5f5628
 
5f5628
-void
5f5628
+Bool
5f5628
 xwl_glamor_post_damage(struct xwl_window *xwl_window,
5f5628
                        PixmapPtr pixmap, RegionPtr region)
5f5628
 {
5f5628
     struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
5f5628
 
5f5628
     if (xwl_screen->egl_backend->post_damage)
5f5628
-        xwl_screen->egl_backend->post_damage(xwl_window, pixmap, region);
5f5628
+        return xwl_screen->egl_backend->post_damage(xwl_window, pixmap, region);
5f5628
+
5f5628
+    return TRUE;
5f5628
 }
5f5628
 
5f5628
 Bool
5f5628
diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h
5f5628
index 26ab78f04..cf3c4fba3 100644
5f5628
--- a/hw/xwayland/xwayland-glamor.h
5f5628
+++ b/hw/xwayland/xwayland-glamor.h
5f5628
@@ -83,7 +83,7 @@ struct xwl_egl_backend {
5f5628
      * you should implement blitting from the glamor pixmap to the wayland
5f5628
      * pixmap here. Otherwise, this callback is optional.
5f5628
      */
5f5628
-    void (*post_damage)(struct xwl_window *xwl_window,
5f5628
+    Bool (*post_damage)(struct xwl_window *xwl_window,
5f5628
                         PixmapPtr pixmap, RegionPtr region);
5f5628
 
5f5628
     /* Called by Xwayland to confirm with the egl backend that the given
5f5628
@@ -117,7 +117,7 @@ void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
5f5628
                                  uint32_t version);
5f5628
 Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
5f5628
                                  struct xwl_egl_backend *xwl_egl_backend);
5f5628
-void xwl_glamor_post_damage(struct xwl_window *xwl_window,
5f5628
+Bool xwl_glamor_post_damage(struct xwl_window *xwl_window,
5f5628
                             PixmapPtr pixmap, RegionPtr region);
5f5628
 Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
5f5628
 void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
5f5628
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
5f5628
index af4290ec7..00f161eda 100644
5f5628
--- a/hw/xwayland/xwayland-window.c
5f5628
+++ b/hw/xwayland/xwayland-window.c
5f5628
@@ -811,8 +811,12 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
5f5628
     }
5f5628
 
5f5628
 #ifdef XWL_HAS_GLAMOR
5f5628
-    if (xwl_screen->glamor)
5f5628
-        xwl_glamor_post_damage(xwl_window, pixmap, region);
5f5628
+    if (xwl_screen->glamor) {
5f5628
+        if (!xwl_glamor_post_damage(xwl_window, pixmap, region)) {
5f5628
+            ErrorF("glamor: Failed to post damage\n");
5f5628
+            return;
5f5628
+        }
5f5628
+    }
5f5628
 #endif
5f5628
 
5f5628
     wl_surface_attach(xwl_window->surface, buffer, 0, 0);
5f5628
-- 
5f5628
2.31.1
5f5628