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

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