From c61a588c6ad2db33e26d498d4c25717d7efaf6e1 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 15 Aug 2022 06:22:42 -0400 Subject: [PATCH] wlr_scene: Add WLR_SCENE_DEBUG_DAMAGE_RENDERER_NODE --- docs/env_vars.md | 2 +- include/wlr/types/wlr_scene.h | 1 + types/scene/wlr_scene.c | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/env_vars.md b/docs/env_vars.md index 06e47ac59..e0c15068b 100644 --- a/docs/env_vars.md +++ b/docs/env_vars.md @@ -55,7 +55,7 @@ wlroots reads these environment variables * *WLR_SCENE_DEBUG_DAMAGE*: specifies debug options for screen damage related tasks for compositors that use scenes (available options: none, rerender, - highlight) + rerender_node, highlight) * *WLR_SCENE_DISABLE_DIRECT_SCANOUT*: disables direct scan-out for debugging. * *WLR_SCENE_DISABLE_VISIBILITY*: If set to 1, the visibility of all scene nodes will be considered to be the full node. Intelligent visibility canculations will diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index bcfbc72f9..d450b2f86 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -83,6 +83,7 @@ struct wlr_scene_node { enum wlr_scene_debug_damage_option { WLR_SCENE_DEBUG_DAMAGE_NONE, WLR_SCENE_DEBUG_DAMAGE_RERENDER, + WLR_SCENE_DEBUG_DAMAGE_RERENDER_NODE, WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT }; diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 713bfdfd0..c6dd03581 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -178,6 +178,7 @@ struct wlr_scene *wlr_scene_create(void) { const char *debug_damage_options[] = { "none", "rerender", + "rerender_node", "highlight", NULL }; @@ -897,14 +898,22 @@ void wlr_scene_buffer_set_buffer_with_options(struct wlr_scene_buffer *scene_buf } pixman_region32_t trans_damage; - pixman_region32_init(&trans_damage); - wlr_region_transform(&trans_damage, damage, - scene_buffer->transform, buffer->width, buffer->height); + + struct wlr_scene *scene = scene_node_get_root(&scene_buffer->node); + if (scene->debug_damage_option == WLR_SCENE_DEBUG_DAMAGE_RERENDER_NODE) { + pixman_region32_init_rect(&trans_damage, 0, 0, buffer->width, buffer->height); + wlr_region_transform(&trans_damage, &trans_damage, + scene_buffer->transform, buffer->width, buffer->height); + } else { + pixman_region32_init(&trans_damage); + wlr_region_transform(&trans_damage, damage, + scene_buffer->transform, buffer->width, buffer->height); + } + pixman_region32_intersect_rect(&trans_damage, &trans_damage, box.x, box.y, box.width, box.height); pixman_region32_translate(&trans_damage, -box.x, -box.y); - struct wlr_scene *scene = scene_node_get_root(&scene_buffer->node); struct wlr_scene_output *scene_output; wl_list_for_each(scene_output, &scene->outputs, link) { float output_scale = scene_output->output->scale;