summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@collabora.com>2021-12-31 15:49:34 +0100
committerMarius Vlad <marius.vlad@collabora.com>2022-05-24 19:43:58 +0300
commit673943d730a5800c033af119a98dff0112e9ed0e (patch)
treefd78992ed5269085c81c6085878e97e02bfc8400
parenta08be33890a47da2da9487f3008a6e6b99371c24 (diff)
downloadweston-673943d730a5800c033af119a98dff0112e9ed0e.tar.gz
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 933290e6eadb37a984dba78562f1e499a5f41679)
-rw-r--r--libweston/compositor.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 1670c500..452d32f7 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4211,6 +4211,11 @@ weston_subsurface_commit_to_cache(struct weston_subsurface *sub)
&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) {
sub->cached.newly_attached = 1;
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.sy += surface->pending.sy;
- apply_damage_buffer(&sub->cached.damage_surface, surface, &surface->pending);
-
sub->cached.buffer_viewport.changed |=
surface->pending.buffer_viewport.changed;
sub->cached.buffer_viewport.buffer =