diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-07-04 03:27:50 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-07-12 17:20:12 +0000 |
commit | d8585d661c17cd00d2540be5cbe663bf01c46019 (patch) | |
tree | f19784040ab2865e191494fb92e4cb30f3c2a079 | |
parent | cb5d9abf100aad1ca4e3a358a1f02fcefc3b4029 (diff) |
wlr_scene: Fix buffer damage for output state
We would transform the damage based on output state which might be
out of date.
-rw-r--r-- | types/scene/wlr_scene.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 47075f0a..32a4460d 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1445,19 +1445,14 @@ static bool construct_render_list_iterator(struct wlr_scene_node *node, return false; } -static void get_frame_damage(const struct wlr_scene_output *scene_output, pixman_region32_t *frame_damage) { - struct wlr_output *output = scene_output->output; - - int tr_width, tr_height; - wlr_output_transformed_resolution(output, &tr_width, &tr_height); - - enum wl_output_transform transform = - wlr_output_transform_invert(output->transform); - - pixman_region32_init(frame_damage); - wlr_region_transform(frame_damage, - &scene_output->damage_ring.current, - transform, tr_width, tr_height); +static void output_state_apply_damage(const struct render_data *data, + struct wlr_output_state *state) { + pixman_region32_t frame_damage; + pixman_region32_init(&frame_damage); + pixman_region32_copy(&frame_damage, &data->output->damage_ring.current); + transform_output_damage(&frame_damage, data); + wlr_output_state_set_damage(state, &frame_damage); + pixman_region32_fini(&frame_damage); } static void scene_buffer_send_dmabuf_feedback(const struct wlr_scene *scene, @@ -1567,11 +1562,7 @@ static bool scene_entry_try_direct_scanout(struct render_list_entry *entry, } wlr_output_state_set_buffer(&pending, buffer->buffer); - - pixman_region32_t frame_damage; - get_frame_damage(scene_output, &frame_damage); - wlr_output_state_set_damage(&pending, &frame_damage); - pixman_region32_fini(&frame_damage); + output_state_apply_damage(data, &pending); if (!wlr_output_test_state(scene_output->output, &pending)) { wlr_output_state_finish(&pending); @@ -1877,11 +1868,7 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output, wlr_output_state_set_buffer(state, buffer); wlr_buffer_unlock(buffer); - - pixman_region32_t frame_damage; - get_frame_damage(scene_output, &frame_damage); - wlr_output_state_set_damage(state, &frame_damage); - pixman_region32_fini(&frame_damage); + output_state_apply_damage(&render_data, state); if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT && !wl_list_empty(&scene_output->damage_highlight_regions)) { |