Blame SOURCES/0005-xwayland-eglstream-fix-X11-rendering-to-flipping-GL-.patch

b6a310
From 43d1648dc71d01628a6a65a62364c1a3994a88a8 Mon Sep 17 00:00:00 2001
b6a310
From: Erik Kurzinger <ekurzinger@nvidia.com>
b6a310
Date: Tue, 27 Apr 2021 07:23:44 -0400
b6a310
Subject: [PATCH xserver 05/27] xwayland-eglstream: fix X11 rendering to
b6a310
 flipping GL / VK window
b6a310
MIME-Version: 1.0
b6a310
Content-Type: text/plain; charset=UTF-8
b6a310
Content-Transfer-Encoding: 8bit
b6a310
b6a310
If a window is being used for direct rendering with OpenGL or Vulkan, and is
b6a310
using the flipping path for presentation, it's pixmap will be set to a dma-buf
b6a310
backed pixmap created by the client-side GL driver. However, this means that
b6a310
xwl_glamor_eglstream_post_damage won't work since it requires that the pixmap
b6a310
has an EGLSurface that it can render to, which dma-buf backed pixmaps do not.
b6a310
b6a310
In this case, though, xwl_glamor_eglstream_post_damage is not necessary since
b6a310
glamor will have rendered directly to the pixmap, so we can simply pass it
b6a310
directly to the compositor. There's no need for the intermediate copy we
b6a310
normally do in that function.
b6a310
b6a310
Therefore, this change adds an early-return case to post_damage for dma-buf
b6a310
backed pixmaps, and removes the corresponding asserts from that function and
b6a310
allow_commits.
b6a310
b6a310
Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
b6a310
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
b6a310
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
b6a310
(cherry picked from commit 4f6fbd5009ae533cf0b3bbe382502254f9276a01)
b6a310
---
b6a310
 hw/xwayland/xwayland-glamor-eglstream.c | 8 ++++++--
b6a310
 1 file changed, 6 insertions(+), 2 deletions(-)
b6a310
b6a310
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
b6a310
index 2d8380e1f..17295f3bd 100644
b6a310
--- a/hw/xwayland/xwayland-glamor-eglstream.c
b6a310
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
b6a310
@@ -576,7 +576,6 @@ xwl_glamor_eglstream_allow_commits(struct xwl_window *xwl_window)
b6a310
     struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
b6a310
 
b6a310
     if (xwl_pixmap) {
b6a310
-        assert(xwl_pixmap->type == XWL_PIXMAP_EGLSTREAM);
b6a310
         if (pending) {
b6a310
             /* Wait for the compositor to finish connecting the consumer for
b6a310
              * this eglstream */
b6a310
@@ -615,7 +614,12 @@ xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window,
b6a310
     };
b6a310
     GLint saved_vao;
b6a310
 
b6a310
-    assert(xwl_pixmap->type == XWL_PIXMAP_EGLSTREAM);
b6a310
+    if (xwl_pixmap->type != XWL_PIXMAP_EGLSTREAM)
b6a310
+        /* This can happen if a client does X11 rendering on a
b6a310
+         * flipping OpenGL or Vulkan window. In that case, we don't
b6a310
+         * need to do the copy below.
b6a310
+         */
b6a310
+        return;
b6a310
 
b6a310
     /* Unbind the framebuffer BEFORE binding the EGLSurface, otherwise we
b6a310
      * won't actually draw to it
b6a310
-- 
b6a310
2.31.1
b6a310