libweston/compositor: Cache buffer damage for synced subsurfaces

The spec states:
> Because buffer transformation changes and damage requests may be
> interleaved in the protocol stream, it is impossible to determine
> the actual mapping between surface and buffer damage until
> wl_surface.commit time. Therefore, compositors wishing to take both
> kinds of damage into account will have to accumulate damage from the
> two requests separately and only transform from one to the other after
> receiving the wl_surface.commit.

For subsurfaces in sync mode, arguably the same is the case until the
cached state gets applied eventually. Thus, in order to keep complexity
to a sane level, just accumulate buffer damage and convert it only
when the cached state gets applied.

This mirrors how other compositors like Mutter implement cached damage
and what the spec arguably should demand.

Closes https://gitlab.freedesktop.org/wayland/weston/-/issues/446

Signed-off-by: Robert Mader <robert.mader@collabora.com>
(cherry picked from commit 933290e6ea)
dev
Robert Mader 3 years ago committed by Marius Vlad
parent a08be33890
commit 673943d730
  1. 7
      libweston/compositor.c

@ -4211,6 +4211,11 @@ weston_subsurface_commit_to_cache(struct weston_subsurface *sub)
&surface->pending.damage_surface); &surface->pending.damage_surface);
pixman_region32_clear(&surface->pending.damage_surface); pixman_region32_clear(&surface->pending.damage_surface);
pixman_region32_union(&sub->cached.damage_buffer,
&sub->cached.damage_buffer,
&surface->pending.damage_buffer);
pixman_region32_clear(&surface->pending.damage_buffer);
if (surface->pending.newly_attached) { if (surface->pending.newly_attached) {
sub->cached.newly_attached = 1; sub->cached.newly_attached = 1;
weston_surface_state_set_buffer(&sub->cached, weston_surface_state_set_buffer(&sub->cached,
@ -4233,8 +4238,6 @@ weston_subsurface_commit_to_cache(struct weston_subsurface *sub)
sub->cached.sx += surface->pending.sx; sub->cached.sx += surface->pending.sx;
sub->cached.sy += surface->pending.sy; sub->cached.sy += surface->pending.sy;
apply_damage_buffer(&sub->cached.damage_surface, surface, &surface->pending);
sub->cached.buffer_viewport.changed |= sub->cached.buffer_viewport.changed |=
surface->pending.buffer_viewport.changed; surface->pending.buffer_viewport.changed;
sub->cached.buffer_viewport.buffer = sub->cached.buffer_viewport.buffer =

Loading…
Cancel
Save