From 439aea0188583434b363f4913255fc467c1bc8c5 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 5 Sep 2025 15:18:08 -0500 Subject: [PATCH] compositor: Track DIRTY_POS properly For clients using old protocol versions, the WESTON_SURFACE_DIRTY_POS bit currently gets set on any attachment. It should really only be set if the attachment is non-zero. Since it's possible to attach mulitple times, or to invoke wl_surface.offset multiple times, let's allow clearing the bit so it stays up to date with the state that will actually be used on commmit(). Currently, this is pointlessly pedantic, as we don't really do much with the bit, but in a future commit I intend to use it to notice states that may change visibility/occlusion status of a surface. Signed-off-by: Derek Foreman --- libweston/compositor.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index e7e77d6aa..979add977 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -4426,7 +4426,10 @@ surface_attach(struct wl_client *client, return; } } else { - surface->pending.status |= WESTON_SURFACE_DIRTY_POS; + if (sx != 0 || sy != 0) + surface->pending.status |= WESTON_SURFACE_DIRTY_POS; + else + surface->pending.status &= ~WESTON_SURFACE_DIRTY_POS; surface->pending.buf_offset = weston_coord_surface(sx, sy, surface); } @@ -4790,7 +4793,10 @@ surface_offset(struct wl_client *client, return; } - surface->pending.status |= WESTON_SURFACE_DIRTY_POS; + if (sx != 0 || sy != 0) + surface->pending.status |= WESTON_SURFACE_DIRTY_POS; + else + surface->pending.status &= ~WESTON_SURFACE_DIRTY_POS; surface->pending.buf_offset = weston_coord_surface(sx, sy, surface); }