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
master
Alexander Orzechowski 3 months ago committed by itycodes
parent 8ee7b1c42d
commit 1253b54f21

@ -27,8 +27,6 @@ struct wlr_damage_ring_buffer {
}; };
struct wlr_damage_ring { struct wlr_damage_ring {
int32_t width, height;
// Difference between the current buffer and the previous one // Difference between the current buffer and the previous one
pixman_region32_t current; 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); 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. * Add a region to the current damage.
*/ */

@ -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, static void scene_output_update_geometry(struct wlr_scene_output *scene_output,
bool force_update) { 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_output_damage_whole(scene_output);
scene_node_output_update(&scene_output->scene->tree.node, 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; struct render_list_entry *list_data = list_con.render_list->data;
int list_len = list_con.render_list->size / sizeof(*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) { if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_RERENDER) {
scene_output_damage_whole(scene_output); scene_output_damage_whole(scene_output);
} }

@ -9,11 +9,7 @@
#define WLR_DAMAGE_RING_MAX_RECTS 20 #define WLR_DAMAGE_RING_MAX_RECTS 20
void wlr_damage_ring_init(struct wlr_damage_ring *ring) { void wlr_damage_ring_init(struct wlr_damage_ring *ring) {
*ring = (struct wlr_damage_ring){ *ring = (struct wlr_damage_ring){ 0 };
.width = INT_MAX,
.height = INT_MAX,
};
pixman_region32_init(&ring->current); pixman_region32_init(&ring->current);
wl_list_init(&ring->buffers); 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, void wlr_damage_ring_add(struct wlr_damage_ring *ring,
const pixman_region32_t *damage) { const pixman_region32_t *damage) {
pixman_region32_union(&ring->current, &ring->current, damage); pixman_region32_union(&ring->current, &ring->current, damage);

Loading…
Cancel
Save