diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2024-07-02 18:51:44 +0200 |
---|---|---|
committer | Olivier Fourdan <fourdan@gmail.com> | 2024-07-04 08:36:40 +0000 |
commit | 4942b7c137580523da6dca75247db56534c761e5 (patch) | |
tree | 20e414219935c33c267fe44ac1929592ab8803b5 | |
parent | f834e104aad2abce56867a638c345964946d837f (diff) |
xwayland/window-buffers: optionally force disposal
For cases (to come) where we would want to force the disposal of the
window buffers, add a parameter to force the disposal by calling
dispose() directly instead of maybe_dispose().
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
(cherry picked from commit fa04e15afccc8ef49a00e39c84e26b2f7fca5966)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1569>
-rw-r--r-- | hw/xwayland/xwayland-dmabuf.c | 2 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window-buffers.c | 15 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window-buffers.h | 2 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window.c | 6 |
4 files changed, 17 insertions, 8 deletions
diff --git a/hw/xwayland/xwayland-dmabuf.c b/hw/xwayland/xwayland-dmabuf.c index db7dc44ee..e485e5b1c 100644 --- a/hw/xwayland/xwayland-dmabuf.c +++ b/hw/xwayland/xwayland-dmabuf.c @@ -752,7 +752,7 @@ xwl_window_dmabuf_feedback_done(void *data, /* If the linux-dmabuf v4 per-surface feedback changed, make sure the * window buffers get re-created with appropriate parameters. */ - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); xwl_window_realloc_pixmap(xwl_window); } diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c index 1a7e78537..2bf6c978c 100644 --- a/hw/xwayland/xwayland-window-buffers.c +++ b/hw/xwayland/xwayland-window-buffers.c @@ -244,8 +244,17 @@ xwl_window_buffers_init(struct xwl_window *xwl_window) xorg_list_init(&xwl_window->window_buffers_unavailable); } +static void +xwl_window_buffer_disposal(struct xwl_window_buffer *xwl_window_buffer, Bool force) +{ + if (force) + xwl_window_buffer_dispose(xwl_window_buffer); + else + xwl_window_buffer_maybe_dispose(xwl_window_buffer); +} + void -xwl_window_buffers_dispose(struct xwl_window *xwl_window) +xwl_window_buffers_dispose(struct xwl_window *xwl_window, Bool force) { struct xwl_window_buffer *xwl_window_buffer, *tmp; @@ -257,14 +266,14 @@ xwl_window_buffers_dispose(struct xwl_window *xwl_window) &xwl_window->window_buffers_available, link_buffer) { xorg_list_del(&xwl_window_buffer->link_buffer); - xwl_window_buffer_maybe_dispose(xwl_window_buffer); + xwl_window_buffer_disposal(xwl_window_buffer, force); } xorg_list_for_each_entry_safe(xwl_window_buffer, tmp, &xwl_window->window_buffers_unavailable, link_buffer) { xorg_list_del(&xwl_window_buffer->link_buffer); - xwl_window_buffer_maybe_dispose(xwl_window_buffer); + xwl_window_buffer_disposal(xwl_window_buffer, force); } if (xwl_window->window_buffers_timer) diff --git a/hw/xwayland/xwayland-window-buffers.h b/hw/xwayland/xwayland-window-buffers.h index af46eb91b..dabb343c1 100644 --- a/hw/xwayland/xwayland-window-buffers.h +++ b/hw/xwayland/xwayland-window-buffers.h @@ -34,7 +34,7 @@ void xwl_window_buffer_add_damage_region(struct xwl_window *xwl_window); void xwl_window_buffer_release(struct xwl_window_buffer *xwl_window_buffer); void xwl_window_buffers_init(struct xwl_window *xwl_window); -void xwl_window_buffers_dispose(struct xwl_window *xwl_window); +void xwl_window_buffers_dispose(struct xwl_window *xwl_window, Bool force); void xwl_window_realloc_pixmap(struct xwl_window *xwl_window); PixmapPtr xwl_window_swap_pixmap(struct xwl_window *xwl_window, Bool handle_sync); diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index b9074f313..20f4c1d04 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -1404,7 +1404,7 @@ xwl_window_update_surface_window(struct xwl_window *xwl_window) } if (surface_window->drawable.depth != xwl_window->surface_window->drawable.depth) - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); xwl_window->surface_window = surface_window; register_damage(xwl_window); @@ -1688,7 +1688,7 @@ xwl_window_dispose(struct xwl_window *xwl_window) xorg_list_del(&xwl_window->link_damage); xorg_list_del(&xwl_window->link_window); - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); if (xwl_window->window_buffers_timer) TimerFree(xwl_window->window_buffers_timer); @@ -1750,7 +1750,7 @@ xwl_window_set_window_pixmap(WindowPtr window, old_pixmap->drawable.height == pixmap->drawable.height)) return; - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); } Bool |