From 128cd07e9156a80dcd79178c3e669ddae2c71430 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 13 Mar 2025 15:49:24 +0100 Subject: [PATCH] scene/surface: use source buffer to signal release timeline point We were signaling the release timeline point when the wlr_client_buffer was released. However, the wlr_client_buffer isn't necessarily released at the same time as the underlying source wlr_buffer. For instance, with wl_shm the source buffer is released before the wlr_client_buffer, and with linux-dmabuf-v1 the source buffer is released after the wlr_client_buffer. However, we want to signal the release timeline point exactly at the same time we send the wl_buffer.release event to the client. Use surface->buffer->source instead of &surface->buffer->base to fix this. linux-drm-syncobj-v1 can only be used with DMA-BUFs, and wlr_client_buffer.texture will keep the source locked, so surface->buffer->source is guaranteed to be non-NULL and unreleased. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3940 Fixes: 9e71c88467fc ("scene: unwrap wlr_client_buffer for direct scan-out") --- types/scene/surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/scene/surface.c b/types/scene/surface.c index e6d0fb8e2..1f954373d 100644 --- a/types/scene/surface.c +++ b/types/scene/surface.c @@ -187,7 +187,7 @@ static void surface_reconfigure(struct wlr_scene_surface *scene_surface) { if (syncobj_surface_state != NULL && (surface->current.committed & WLR_SURFACE_STATE_BUFFER)) { wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state, - &surface->buffer->base); + surface->buffer->source); } } else { wlr_scene_buffer_set_buffer(scene_buffer, NULL);