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 <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-06-21 13:15:10 -05:00
parent f07af89f9c
commit f7ddaa142a
2 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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,