diff options
author | Alexander Orzechowski <orzechowski.alexander@gmail.com> | 2022-02-26 21:51:53 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-03-08 14:05:36 +0000 |
commit | f330759ba43ba55696c8e378fedfa2d1448ae12f (patch) | |
tree | 1ff3a2c3a9202afb03b69acf8a3ceee5b035095e | |
parent | fbd4d40318c437508342bbbc41a0f90173462160 (diff) |
wlr_output_damage: Don't schedule a new frame if damage region does not intersect with output
This fixed adaptive sync issues with wlr_scene. Scenes don't check
if the damage region intersects with an output when calling
wlr_output_damage_add.
This is especially important for multi output.
-rw-r--r-- | types/wlr_output_damage.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index 08f11207..f9aabc31 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -187,11 +187,17 @@ void wlr_output_damage_add(struct wlr_output_damage *output_damage, int width, height; wlr_output_transformed_resolution(output_damage->output, &width, &height); - pixman_region32_union(&output_damage->current, &output_damage->current, - damage); - pixman_region32_intersect_rect(&output_damage->current, - &output_damage->current, 0, 0, width, height); - wlr_output_schedule_frame(output_damage->output); + pixman_region32_t clipped_damage; + pixman_region32_init(&clipped_damage); + pixman_region32_intersect_rect(&clipped_damage, damage, 0, 0, width, height); + + if (pixman_region32_not_empty(&clipped_damage)) { + pixman_region32_union(&output_damage->current, &output_damage->current, + &clipped_damage); + wlr_output_schedule_frame(output_damage->output); + } + + pixman_region32_fini(&clipped_damage); } void wlr_output_damage_add_whole(struct wlr_output_damage *output_damage) { |