From 67172d6f8fde4b3478a65dcf0a0822e4d2436585 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 26 Mar 2026 14:52:17 -0500 Subject: [PATCH] surface-state: Flag buffer params as dirty if replacing deleted buffer This makes replacing an invalid/deleted buffer distinguishable from a regular buffer update. This will be important when we try to reuse plane states in a later commit. Signed-off-by: Derek Foreman --- libweston/surface-state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libweston/surface-state.c b/libweston/surface-state.c index 6794ae507..59643dc76 100644 --- a/libweston/surface-state.c +++ b/libweston/surface-state.c @@ -249,6 +249,16 @@ weston_surface_attach(struct weston_surface *surface, } } + /* The buffer was destroyed (!old_buffer->resource), so set the + * BUFFER_PARAMS_DIRTY bit. + * + * This is because backends can opportunistically reuse plane state + * if only the buffer has changed, but a buffer changing from invalid + * to valid needs action. + */ + if (old_buffer && !old_buffer->resource) + pnode_changes |= WESTON_PAINT_NODE_BUFFER_PARAMS_DIRTY; + if (!old_buffer || buffer->pixel_format != old_buffer->pixel_format || buffer->format_modifier != old_buffer->format_modifier) {