From f7ddaa142abacfaf5e60a12723ae2925084dc7e9 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 21 Jun 2023 13:15:10 -0500 Subject: [PATCH] libweston: Replace weston_output_damage() with a flag In the future we'd like to have multiple overlapping outputs. weston_output_damage() currently adds damage to the output's coordinates on the primary plane. This plane is shared between all outputs, so it would result in damaging more than the intended output. Eventually, plane damage will go away and be replaced by paint node damage, and damaging the entire output would involve adding damage to a list of paint nodes. Instead, use a flag to indicate the output must be fully redrawn, and add the damage during the repaint loop. Signed-off-by: Derek Foreman --- include/libweston/libweston.h | 3 +++ libweston/compositor.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 2985a99f..150c9001 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -484,6 +484,9 @@ struct weston_output { * if set, a repaint will eventually occur. */ bool repaint_needed; + /** True if the entire contents of the output should be redrawn */ + bool full_repaint_needed; + /** Used only between repaint_begin and repaint_cancel. */ bool repainted; diff --git a/libweston/compositor.c b/libweston/compositor.c index 7a63bdbf..e01d9eed 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2872,11 +2872,7 @@ weston_compositor_damage_all(struct weston_compositor *compositor) WL_EXPORT void weston_output_damage(struct weston_output *output) { - struct weston_compositor *compositor = output->compositor; - - pixman_region32_union(&compositor->primary_plane.damage, - &compositor->primary_plane.damage, - &output->region); + output->full_repaint_needed = true; weston_output_schedule_repaint(output); } @@ -3261,6 +3257,11 @@ weston_output_repaint(struct weston_output *output) pixman_region32_subtract(&output_damage, &output_damage, &ec->primary_plane.clip); + if (output->full_repaint_needed) { + pixman_region32_copy(&output_damage, &output->region); + output->full_repaint_needed = false; + } + r = output->repaint(output, &output_damage); pixman_region32_subtract(&ec->primary_plane.damage,