From fb739b829305a60f99abb6b847b45aeb9c6cbf77 Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Mon, 24 Jun 2019 16:57:45 +0200 Subject: [PATCH] output-damage: set needs swap only when we have new damage An output needs swap when there is new damage. If the damage is only accumulated from the last frame, we could simply skip drawing. --- types/wlr_output_damage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index fe35b563..a1fb6134 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -144,6 +144,8 @@ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage, return false; } + *needs_frame = + output->needs_frame || pixman_region32_not_empty(&output_damage->current); // Check if we can use damage tracking if (buffer_age <= 0 || buffer_age - 1 > WLR_OUTPUT_DAMAGE_PREVIOUS_LEN) { int width, height; @@ -151,6 +153,7 @@ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage, // Buffer new or too old, damage the whole output pixman_region32_union_rect(damage, damage, 0, 0, width, height); + *needs_frame = true; } else { pixman_region32_copy(damage, &output_damage->current); @@ -170,7 +173,6 @@ bool wlr_output_damage_attach_render(struct wlr_output_damage *output_damage, } } - *needs_frame = output->needs_frame || pixman_region32_not_empty(damage); return true; }