From 239354d644192605955088a6acc5503538425071 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 12 Mar 2024 11:25:37 -0400 Subject: [PATCH] wlr_scene: Decide when to commit output damage with buffers in damage ring We will soon support custom swapchains. In order to track output damage we should instead use the damage_ring which will hold all the buffers we are currently tracking anyway across an arbitrary amount of swapchains. --- types/scene/wlr_scene.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 79fd717f..18ac3d48 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1294,7 +1294,16 @@ static void scene_output_handle_commit(struct wl_listener *listener, void *data) // will be acknowledged by the backend so we don't need to keep track of it // anymore if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { - if (wlr_swapchain_has_buffer(scene_output->output->swapchain, state->buffer)) { + bool tracking_buffer = false; + struct wlr_damage_ring_buffer *buffer; + wl_list_for_each(buffer, &scene_output->damage_ring.buffers, link) { + if (buffer->buffer == state->buffer) { + tracking_buffer = true; + break; + } + } + + if (tracking_buffer) { pixman_region32_subtract(&scene_output->pending_commit_damage, &scene_output->pending_commit_damage, &state->damage); } else {