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