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.
master
Alexander Orzechowski 3 years ago committed by Simon Ser
parent fbd4d40318
commit f330759ba4

@ -187,13 +187,19 @@ void wlr_output_damage_add(struct wlr_output_damage *output_damage,
int width, height; int width, height;
wlr_output_transformed_resolution(output_damage->output, &width, &height); wlr_output_transformed_resolution(output_damage->output, &width, &height);
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, pixman_region32_union(&output_damage->current, &output_damage->current,
damage); &clipped_damage);
pixman_region32_intersect_rect(&output_damage->current,
&output_damage->current, 0, 0, width, height);
wlr_output_schedule_frame(output_damage->output); wlr_output_schedule_frame(output_damage->output);
} }
pixman_region32_fini(&clipped_damage);
}
void wlr_output_damage_add_whole(struct wlr_output_damage *output_damage) { void wlr_output_damage_add_whole(struct wlr_output_damage *output_damage) {
int width, height; int width, height;
wlr_output_transformed_resolution(output_damage->output, &width, &height); wlr_output_transformed_resolution(output_damage->output, &width, &height);

Loading…
Cancel
Save