From fd540f6d07169b78ab554ccbd83e77f88f8f26a6 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Sat, 22 Jul 2023 19:18:06 -0400 Subject: [PATCH] wlr_scene: Don't damage when setting opaque region Opaque region is a optimization hint, (bugs outstanding) it will not change the output contents, therefore damage does not need to be submitted. However, we still need to update the visibility state of the other nodes in the tree. To do this call scene_update_region() by ourselves but not `scene_node_update()` which will damage the outputs. --- types/scene/wlr_scene.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index a25cdd64..782950f3 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -764,7 +764,17 @@ void wlr_scene_buffer_set_opaque_region(struct wlr_scene_buffer *scene_buffer, } pixman_region32_copy(&scene_buffer->opaque_region, region); - scene_node_update(&scene_buffer->node, NULL); + + int x, y; + if (!wlr_scene_node_coords(&scene_buffer->node, &x, &y)) { + return; + } + + pixman_region32_t update_region; + pixman_region32_init(&update_region); + scene_node_bounds(&scene_buffer->node, x, y, &update_region); + scene_update_region(scene_node_get_root(&scene_buffer->node), &update_region); + pixman_region32_fini(&update_region); } void wlr_scene_buffer_set_source_box(struct wlr_scene_buffer *scene_buffer,