|
|
b6a310 |
From f76dd86f5bbdccb3655ac58365e4604d03de65f5 Mon Sep 17 00:00:00 2001
|
|
|
b6a310 |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
b6a310 |
Date: Wed, 14 Apr 2021 17:31:08 +0200
|
|
|
b6a310 |
Subject: [PATCH xserver 14/27] xwayland/eglstream: Keep a reference to the
|
|
|
b6a310 |
pixmap
|
|
|
b6a310 |
MIME-Version: 1.0
|
|
|
b6a310 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b6a310 |
Content-Transfer-Encoding: 8bit
|
|
|
b6a310 |
|
|
|
b6a310 |
Commit affc47452 - "xwayland: Drop the separate refcount for the
|
|
|
b6a310 |
xwl_pixmap" removed the separate reference counter for the xwl_pixmap
|
|
|
b6a310 |
which holds the EGLStream.
|
|
|
b6a310 |
|
|
|
b6a310 |
While that works fine for the common case, if the window's pixmap is
|
|
|
b6a310 |
changed before the stream is ready, the older pixmap will be destroyed
|
|
|
b6a310 |
and the xwl_pixmap along with it, even if the compositor is still using
|
|
|
b6a310 |
the stream.
|
|
|
b6a310 |
|
|
|
b6a310 |
The code that was removed with commit affc47452 was taking care of that
|
|
|
b6a310 |
by increasing the separate reference counter for the xwl_pixmap, but it
|
|
|
b6a310 |
no longer the case.
|
|
|
b6a310 |
|
|
|
b6a310 |
As a result, we may end up with the EGL stream in the wrong state when
|
|
|
b6a310 |
trying to use it, which will cascade down into all sort of issues.
|
|
|
b6a310 |
|
|
|
b6a310 |
To avoid the problem, increase the reference count on the pixmap when it
|
|
|
b6a310 |
is marked as invalid in EGLStream's SetWindowPixmap().
|
|
|
b6a310 |
|
|
|
b6a310 |
This way, the xwl_pixmap and the EGLStream are kept until released by
|
|
|
b6a310 |
the compositor, even when the pixmap changes before stream is ready.
|
|
|
b6a310 |
|
|
|
b6a310 |
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
b6a310 |
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
|
|
|
b6a310 |
Fixes: affc47452 xwayland: Drop the separate refcount for the xwl_pixmap
|
|
|
b6a310 |
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1156
|
|
|
b6a310 |
(cherry picked from commit e19bf86c17ef9c802fea24410cc6b1f51a19ce7f)
|
|
|
b6a310 |
---
|
|
|
b6a310 |
hw/xwayland/xwayland-glamor-eglstream.c | 12 ++++++++++--
|
|
|
b6a310 |
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
b6a310 |
|
|
|
b6a310 |
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
|
|
|
b6a310 |
index 32f9a326f..807bfcb1d 100644
|
|
|
b6a310 |
--- a/hw/xwayland/xwayland-glamor-eglstream.c
|
|
|
b6a310 |
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
|
|
|
b6a310 |
@@ -355,6 +355,13 @@ xwl_eglstream_maybe_set_pending_stream_invalid(PixmapPtr pixmap)
|
|
|
b6a310 |
return;
|
|
|
b6a310 |
|
|
|
b6a310 |
pending->is_valid = FALSE;
|
|
|
b6a310 |
+
|
|
|
b6a310 |
+ /* The compositor may still be using the stream, so we can't destroy
|
|
|
b6a310 |
+ * it yet. We'll only have a guarantee that the stream is safe to
|
|
|
b6a310 |
+ * destroy once we receive the pending wl_display_sync() for this
|
|
|
b6a310 |
+ * stream
|
|
|
b6a310 |
+ */
|
|
|
b6a310 |
+ pending->pixmap->refcnt++;
|
|
|
b6a310 |
}
|
|
|
b6a310 |
|
|
|
b6a310 |
static void
|
|
|
b6a310 |
@@ -530,8 +537,9 @@ xwl_eglstream_consumer_ready_callback(void *data,
|
|
|
b6a310 |
pixmap = pending->pixmap;
|
|
|
b6a310 |
|
|
|
b6a310 |
if (!pending->is_valid) {
|
|
|
b6a310 |
- xwl_eglstream_destroy_pixmap_stream(pending->xwl_pixmap);
|
|
|
b6a310 |
- goto out;
|
|
|
b6a310 |
+ xwl_glamor_eglstream_remove_pending_stream(xwl_pixmap);
|
|
|
b6a310 |
+ dixDestroyPixmap(pixmap, 0);
|
|
|
b6a310 |
+ return;
|
|
|
b6a310 |
}
|
|
|
b6a310 |
|
|
|
b6a310 |
xwl_glamor_egl_make_current(xwl_screen);
|
|
|
b6a310 |
--
|
|
|
b6a310 |
2.31.1
|
|
|
b6a310 |
|