aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--types/wlr_compositor.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index 3362777f..1f85e4ae 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -373,9 +373,6 @@ static void surface_apply_damage(struct wlr_surface *surface) {
struct wlr_client_buffer *buffer = wlr_client_buffer_create(
surface->current.buffer, surface->renderer);
- wlr_buffer_unlock(surface->current.buffer);
- surface->current.buffer = NULL;
-
if (buffer == NULL) {
wlr_log(WLR_ERROR, "Failed to upload buffer");
return;
@@ -495,6 +492,12 @@ static void surface_commit_state(struct wlr_surface *surface,
}
wl_signal_emit_mutable(&surface->events.commit, surface);
+
+ // Release the buffer after emitting the commit event, so that listeners can
+ // access it. Don't leave the buffer locked so that wl_shm buffers can be
+ // released immediately on commit when they are uploaded to the GPU.
+ wlr_buffer_unlock(surface->current.buffer);
+ surface->current.buffer = NULL;
}
static void surface_handle_commit(struct wl_client *client,