wlr_scene: Fix buffer damage for output state

We would transform the damage based on output state which might be
out of date.
master
Alexander Orzechowski 1 year ago committed by Simon Ser
parent cb5d9abf10
commit d8585d661c

@ -1445,19 +1445,14 @@ static bool construct_render_list_iterator(struct wlr_scene_node *node,
return false; return false;
} }
static void get_frame_damage(const struct wlr_scene_output *scene_output, pixman_region32_t *frame_damage) { static void output_state_apply_damage(const struct render_data *data,
struct wlr_output *output = scene_output->output; struct wlr_output_state *state) {
pixman_region32_t frame_damage;
int tr_width, tr_height; pixman_region32_init(&frame_damage);
wlr_output_transformed_resolution(output, &tr_width, &tr_height); pixman_region32_copy(&frame_damage, &data->output->damage_ring.current);
transform_output_damage(&frame_damage, data);
enum wl_output_transform transform = wlr_output_state_set_damage(state, &frame_damage);
wlr_output_transform_invert(output->transform); pixman_region32_fini(&frame_damage);
pixman_region32_init(frame_damage);
wlr_region_transform(frame_damage,
&scene_output->damage_ring.current,
transform, tr_width, tr_height);
} }
static void scene_buffer_send_dmabuf_feedback(const struct wlr_scene *scene, 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); wlr_output_state_set_buffer(&pending, buffer->buffer);
output_state_apply_damage(data, &pending);
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);
if (!wlr_output_test_state(scene_output->output, &pending)) { if (!wlr_output_test_state(scene_output->output, &pending)) {
wlr_output_state_finish(&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_output_state_set_buffer(state, buffer);
wlr_buffer_unlock(buffer); wlr_buffer_unlock(buffer);
output_state_apply_damage(&render_data, state);
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);
if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT && if (debug_damage == WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT &&
!wl_list_empty(&scene_output->damage_highlight_regions)) { !wl_list_empty(&scene_output->damage_highlight_regions)) {

Loading…
Cancel
Save