From 1253b54f21bd646551c346253d395793412e3aa2 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 26 Aug 2024 18:50:14 -0400 Subject: [PATCH] damage_ring: Remove wlr_damage_ring_set_bounds This wasn't that great: 1. Now that damage ring tracks damage across actual wlr_buffer objects, it can use the buffer size to do any sort of cropping that needs to happen. 2. The damage ring size really should be the size of the transformed size of the output. Compositors currently have to call `wlr_damage_ring_set_bounds()` where it might not be clear when to call the function. Compositors can just check against the actual output bounds that they care about when processing the damage. Fixes: #3891 --- include/wlr/types/wlr_damage_ring.h | 13 ------------- types/scene/wlr_scene.c | 7 ------- types/wlr_damage_ring.c | 22 +--------------------- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/include/wlr/types/wlr_damage_ring.h b/include/wlr/types/wlr_damage_ring.h index 68a935c0..3baeb9d5 100644 --- a/include/wlr/types/wlr_damage_ring.h +++ b/include/wlr/types/wlr_damage_ring.h @@ -27,8 +27,6 @@ struct wlr_damage_ring_buffer { }; struct wlr_damage_ring { - int32_t width, height; - // Difference between the current buffer and the previous one pixman_region32_t current; @@ -41,17 +39,6 @@ void wlr_damage_ring_init(struct wlr_damage_ring *ring); void wlr_damage_ring_finish(struct wlr_damage_ring *ring); -/** - * Set ring bounds and damage the ring fully. - * - * Next time damage will be added, it will be cropped to the ring bounds. - * If at least one of the dimensions is 0, bounds are removed. - * - * By default, a damage ring doesn't have bounds. - */ -void wlr_damage_ring_set_bounds(struct wlr_damage_ring *ring, - int32_t width, int32_t height); - /** * Add a region to the current damage. */ diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 80122ba3..6df64734 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1518,10 +1518,6 @@ static void scene_node_output_update(struct wlr_scene_node *node, static void scene_output_update_geometry(struct wlr_scene_output *scene_output, bool force_update) { - int ring_width, ring_height; - wlr_output_transformed_resolution(scene_output->output, &ring_width, &ring_height); - wlr_damage_ring_set_bounds(&scene_output->damage_ring, ring_width, ring_height); - scene_output_damage_whole(scene_output); scene_node_output_update(&scene_output->scene->tree.node, @@ -2021,9 +2017,6 @@ 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); - wlr_damage_ring_set_bounds(&scene_output->damage_ring, - render_data.trans_width, render_data.trans_height); - if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_RERENDER) { scene_output_damage_whole(scene_output); } diff --git a/types/wlr_damage_ring.c b/types/wlr_damage_ring.c index fc80631e..b5be7391 100644 --- a/types/wlr_damage_ring.c +++ b/types/wlr_damage_ring.c @@ -9,11 +9,7 @@ #define WLR_DAMAGE_RING_MAX_RECTS 20 void wlr_damage_ring_init(struct wlr_damage_ring *ring) { - *ring = (struct wlr_damage_ring){ - .width = INT_MAX, - .height = INT_MAX, - }; - + *ring = (struct wlr_damage_ring){ 0 }; pixman_region32_init(&ring->current); wl_list_init(&ring->buffers); } @@ -33,22 +29,6 @@ void wlr_damage_ring_finish(struct wlr_damage_ring *ring) { } } -void wlr_damage_ring_set_bounds(struct wlr_damage_ring *ring, - int32_t width, int32_t height) { - if (width == 0 || height == 0) { - width = INT_MAX; - height = INT_MAX; - } - - if (ring->width == width && ring->height == height) { - return; - } - - ring->width = width; - ring->height = height; - wlr_damage_ring_add_whole(ring); -} - void wlr_damage_ring_add(struct wlr_damage_ring *ring, const pixman_region32_t *damage) { pixman_region32_union(&ring->current, &ring->current, damage);