From 364d7cba42cc450cc31058cef8fb11147d8a59fb Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 4 Dec 2023 06:58:35 -0500 Subject: [PATCH] wlr_scene: Apply output damage once We would apply it twice if we failed direct scanout. Once when we attempt direct scanout and again when we composite. --- types/scene/wlr_scene.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index ed7a72fa9..949b8c89e 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1601,7 +1601,6 @@ static bool scene_entry_try_direct_scanout(struct render_list_entry *entry, } wlr_output_state_set_buffer(&pending, buffer->buffer); - output_state_apply_damage(data, &pending); if (!wlr_output_test_state(scene_output->output, &pending)) { wlr_output_state_finish(&pending); @@ -1712,6 +1711,12 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output, struct render_list_entry *list_data = list_con.render_list->data; int list_len = list_con.render_list->size / sizeof(*list_data); + if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_RERENDER) { + wlr_damage_ring_add_whole(&scene_output->damage_ring); + } + + output_state_apply_damage(&render_data, state); + bool scanout = list_len == 1 && scene_entry_try_direct_scanout(&list_data[0], state, &render_data); @@ -1731,10 +1736,6 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output, return true; } - if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_RERENDER) { - wlr_damage_ring_add_whole(&scene_output->damage_ring); - } - struct timespec now; if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT) { struct wl_list *regions = &scene_output->damage_highlight_regions; @@ -1805,7 +1806,6 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output, render_data.render_pass = render_pass; - output_state_apply_damage(&render_data, state); pixman_region32_init(&render_data.damage); wlr_damage_ring_rotate_buffer(&scene_output->damage_ring, buffer, &render_data.damage);