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

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