Blame SOURCES/0015-xwayland-eglstream-Drop-the-list-of-pending-streams.patch

4c4b8b
From a68e939342aed0ea11c737d166e506442e048e90 Mon Sep 17 00:00:00 2001
4c4b8b
From: Olivier Fourdan <ofourdan@redhat.com>
4c4b8b
Date: Tue, 27 Apr 2021 14:17:19 +0200
4c4b8b
Subject: [PATCH xserver 15/27] xwayland/eglstream: Drop the list of pending
4c4b8b
 streams
4c4b8b
MIME-Version: 1.0
4c4b8b
Content-Type: text/plain; charset=UTF-8
4c4b8b
Content-Transfer-Encoding: 8bit
4c4b8b
4c4b8b
Now that the pending stream is associated with the xwl_pixmap for
4c4b8b
EGLStream and the xwl_pixmap itself is associated to the pixmap, we have
4c4b8b
a reliable way to get to those data from any pending stream.
4c4b8b
4c4b8b
As a result, the list of pending streams that we keep in the EGLStream
4c4b8b
global structure becomes useless.
4c4b8b
4c4b8b
So we can drop the pending stream's xwl_pixmap and also the list of
4c4b8b
pending streams altogether, and save us a walk though that list for each
4c4b8b
callback.
4c4b8b
4c4b8b
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
4c4b8b
Suggested-by: Michel Dänzer <mdaenzer@redhat.com>
4c4b8b
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
4c4b8b
(cherry picked from commit bee2ebb29f0999862ab39af26c673c00af40b082)
4c4b8b
---
4c4b8b
 hw/xwayland/xwayland-glamor-eglstream.c | 41 ++++++-------------------
4c4b8b
 1 file changed, 9 insertions(+), 32 deletions(-)
4c4b8b
4c4b8b
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
4c4b8b
index 807bfcb1d..399a691d3 100644
4c4b8b
--- a/hw/xwayland/xwayland-glamor-eglstream.c
4c4b8b
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
4c4b8b
@@ -55,12 +55,9 @@ struct xwl_eglstream_pending_stream {
4c4b8b
     PixmapPtr pixmap;
4c4b8b
     WindowPtr window;
4c4b8b
 
4c4b8b
-    struct xwl_pixmap *xwl_pixmap;
4c4b8b
     struct wl_callback *cb;
4c4b8b
 
4c4b8b
     Bool is_valid;
4c4b8b
-
4c4b8b
-    struct xorg_list link;
4c4b8b
 };
4c4b8b
 
4c4b8b
 struct xwl_eglstream_private {
4c4b8b
@@ -73,8 +70,6 @@ struct xwl_eglstream_private {
4c4b8b
 
4c4b8b
     SetWindowPixmapProcPtr SetWindowPixmap;
4c4b8b
 
4c4b8b
-    struct xorg_list pending_streams;
4c4b8b
-
4c4b8b
     Bool have_egl_damage;
4c4b8b
 
4c4b8b
     GLint blit_prog;
4c4b8b
@@ -308,7 +303,6 @@ xwl_glamor_eglstream_destroy_pending_stream(struct xwl_eglstream_pending_stream
4c4b8b
 {
4c4b8b
     if (pending->cb)
4c4b8b
         wl_callback_destroy(pending->cb);
4c4b8b
-    xorg_list_del(&pending->link);
4c4b8b
     free(pending);
4c4b8b
 }
4c4b8b
 
4c4b8b
@@ -514,28 +508,16 @@ xwl_eglstream_consumer_ready_callback(void *data,
4c4b8b
                                       struct wl_callback *callback,
4c4b8b
                                       uint32_t time)
4c4b8b
 {
4c4b8b
-    struct xwl_screen *xwl_screen = data;
4c4b8b
+    struct xwl_eglstream_pending_stream *pending = data;
4c4b8b
+    PixmapPtr pixmap = pending->pixmap;
4c4b8b
+    struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
4c4b8b
+    struct xwl_screen *xwl_screen = xwl_pixmap->xwl_screen;
4c4b8b
     struct xwl_eglstream_private *xwl_eglstream =
4c4b8b
         xwl_eglstream_get(xwl_screen);
4c4b8b
-    struct xwl_pixmap *xwl_pixmap;
4c4b8b
-    struct xwl_eglstream_pending_stream *pending;
4c4b8b
-    PixmapPtr pixmap;
4c4b8b
-    Bool found = FALSE;
4c4b8b
-
4c4b8b
-    xorg_list_for_each_entry(pending, &xwl_eglstream->pending_streams, link) {
4c4b8b
-        if (pending->cb == callback) {
4c4b8b
-            found = TRUE;
4c4b8b
-            break;
4c4b8b
-        }
4c4b8b
-    }
4c4b8b
-    assert(found);
4c4b8b
 
4c4b8b
     wl_callback_destroy(callback);
4c4b8b
     pending->cb = NULL;
4c4b8b
 
4c4b8b
-    xwl_pixmap = pending->xwl_pixmap;
4c4b8b
-    pixmap = pending->pixmap;
4c4b8b
-
4c4b8b
     if (!pending->is_valid) {
4c4b8b
         xwl_glamor_eglstream_remove_pending_stream(xwl_pixmap);
4c4b8b
         dixDestroyPixmap(pixmap, 0);
4c4b8b
@@ -571,11 +553,10 @@ static const struct wl_callback_listener consumer_ready_listener = {
4c4b8b
 };
4c4b8b
 
4c4b8b
 static struct xwl_eglstream_pending_stream *
4c4b8b
-xwl_eglstream_queue_pending_stream(struct xwl_screen *xwl_screen,
4c4b8b
-                                   WindowPtr window, PixmapPtr pixmap)
4c4b8b
+xwl_eglstream_queue_pending_stream(WindowPtr window, PixmapPtr pixmap)
4c4b8b
 {
4c4b8b
-    struct xwl_eglstream_private *xwl_eglstream =
4c4b8b
-        xwl_eglstream_get(xwl_screen);
4c4b8b
+    struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
4c4b8b
+    struct xwl_screen *xwl_screen = xwl_pixmap->xwl_screen;
4c4b8b
     struct xwl_eglstream_pending_stream *pending_stream;
4c4b8b
 
4c4b8b
     DebugF("eglstream: win %d queues new pending stream for pixmap %p\n",
4c4b8b
@@ -584,14 +565,11 @@ xwl_eglstream_queue_pending_stream(struct xwl_screen *xwl_screen,
4c4b8b
     pending_stream = malloc(sizeof(*pending_stream));
4c4b8b
     pending_stream->window = window;
4c4b8b
     pending_stream->pixmap = pixmap;
4c4b8b
-    pending_stream->xwl_pixmap = xwl_pixmap_get(pixmap);
4c4b8b
     pending_stream->is_valid = TRUE;
4c4b8b
-    xorg_list_init(&pending_stream->link);
4c4b8b
-    xorg_list_add(&pending_stream->link, &xwl_eglstream->pending_streams);
4c4b8b
 
4c4b8b
     pending_stream->cb = wl_display_sync(xwl_screen->display);
4c4b8b
     wl_callback_add_listener(pending_stream->cb, &consumer_ready_listener,
4c4b8b
-                             xwl_screen);
4c4b8b
+                             pending_stream);
4c4b8b
 
4c4b8b
     return pending_stream;
4c4b8b
 }
4c4b8b
@@ -667,7 +645,7 @@ xwl_eglstream_create_pixmap_and_stream(struct xwl_screen *xwl_screen,
4c4b8b
         xwl_eglstream->controller, xwl_window->surface, xwl_pixmap->buffer);
4c4b8b
 
4c4b8b
     xwl_pixmap->pending_stream =
4c4b8b
-        xwl_eglstream_queue_pending_stream(xwl_screen, window, pixmap);
4c4b8b
+        xwl_eglstream_queue_pending_stream(window, pixmap);
4c4b8b
 
4c4b8b
 fail:
4c4b8b
     if (stream_fd >= 0)
4c4b8b
@@ -1249,7 +1227,6 @@ xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
4c4b8b
                   &xwl_eglstream_private_key, xwl_eglstream);
4c4b8b
 
4c4b8b
     xwl_eglstream->egl_device = egl_device;
4c4b8b
-    xorg_list_init(&xwl_eglstream->pending_streams);
4c4b8b
 
4c4b8b
     xwl_screen->eglstream_backend.init_egl = xwl_glamor_eglstream_init_egl;
4c4b8b
     xwl_screen->eglstream_backend.init_wl_registry = xwl_glamor_eglstream_init_wl_registry;
4c4b8b
-- 
4c4b8b
2.31.1
4c4b8b