xorg-x11-server-Xwayland/0018-xwayland-eglstream-Check-eglSwapBuffers.patch
Olivier Fourdan a618d2e780 Backport fixes for GLX and EGLstream
Resolves: rhbz#1969486
2021-06-17 10:52:52 +02:00

57 lines
2.2 KiB
Diff

From a964ccdadf351d90482df00c272dee3634f7a8ee Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 30 Apr 2021 09:02:29 +0200
Subject: [PATCH xserver 18/27] xwayland/eglstream: Check eglSwapBuffers()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
EGLstream's post_damage() would unconditionally return success
regardless of the actual status of the eglSwapBuffers().
Yet, if eglSwapBuffers() fails, we should not post the corresponding
damage as they wouldn't match the actual content of the buffer.
Use the eglSwapBuffers() return value as the return value for
post_damage() and do not take a refrence on the pixmap if it fails.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
(cherry picked from commit b583395cd38ad101c7541bd8b0e91143ced44703)
---
hw/xwayland/xwayland-glamor-eglstream.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index 3a3caa976..6721acfe8 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -750,14 +750,20 @@ xwl_glamor_eglstream_post_damage(struct xwl_window *xwl_window,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
if (xwl_eglstream->have_egl_damage)
- eglSwapBuffersWithDamageKHR(xwl_screen->egl_display,
- xwl_pixmap->surface, egl_damage, 1);
+ status = eglSwapBuffersWithDamageKHR(xwl_screen->egl_display,
+ xwl_pixmap->surface,
+ egl_damage, 1);
else
- eglSwapBuffers(xwl_screen->egl_display, xwl_pixmap->surface);
+ status = eglSwapBuffers(xwl_screen->egl_display,
+ xwl_pixmap->surface);
+
+ if (!status) {
+ ErrorF("eglstream: buffer swap failed, not posting damage\n");
+ goto out;
+ }
/* hang onto the pixmap until the compositor has released it */
pixmap->refcnt++;
- status = TRUE;
out:
/* Restore previous state */
--
2.31.1