diff --git a/docs/env_vars.md b/docs/env_vars.md index 59c8f078f..b3df7e95f 100644 --- a/docs/env_vars.md +++ b/docs/env_vars.md @@ -57,7 +57,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 46635f4bf..951bc06ae 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -84,6 +84,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 aaf9a8d74..d8cda36b4 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -190,6 +190,7 @@ struct wlr_scene *wlr_scene_create(void) { const char *debug_damage_options[] = { "none", "rerender", + "rerender_node", "highlight", NULL }; @@ -981,14 +982,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;