From 008884f289f3811fffb936284944f5b27db3132e Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 20 Oct 2025 14:57:08 -0500 Subject: [PATCH] compositor: Move dirty buffer handling to paint node early update This was in the late update because attaching buffers is something only the renderer cares about. However, the upcoming drm plane state re-use patches need to know if the buffer changed before assign_planes, so we need this in the early update. Signed-off-by: Derek Foreman --- libweston/compositor.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index adbd7111b..7f6aa2216 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -205,6 +205,7 @@ paint_node_update_early(struct weston_paint_node *pnode) struct weston_surface *surface = pnode->surface; bool view_dirty = pnode->status & WESTON_PAINT_NODE_VIEW_DIRTY; bool output_dirty = pnode->status & WESTON_PAINT_NODE_OUTPUT_DIRTY; + bool buffer_dirty = pnode->status & WESTON_PAINT_NODE_BUFFER_DIRTY; bool recording_censor, unprotected_censor; struct weston_buffer *buffer; @@ -258,9 +259,13 @@ paint_node_update_early(struct weston_paint_node *pnode) get_placeholder_color(pnode, &pnode->solid); } + if (buffer_dirty) + surface->compositor->renderer->attach(pnode); + pnode->output->paint_node_changes |= pnode->status; pnode->status &= ~(WESTON_PAINT_NODE_VIEW_DIRTY | \ - WESTON_PAINT_NODE_OUTPUT_DIRTY); + WESTON_PAINT_NODE_OUTPUT_DIRTY | + WESTON_PAINT_NODE_BUFFER_DIRTY); } /* This is for validating a paint node after early update, assign planes, @@ -305,7 +310,6 @@ paint_node_update_late(struct weston_paint_node *pnode) struct weston_buffer *buffer = surf->buffer_ref.buffer; bool vis_dirty = pnode->status & WESTON_PAINT_NODE_VISIBILITY_DIRTY; bool plane_dirty = pnode->status & WESTON_PAINT_NODE_PLANE_DIRTY; - bool buffer_dirty = pnode->status & WESTON_PAINT_NODE_BUFFER_DIRTY; /* The geoemtry may be shrinking, so we shouldn't just * add the old visible region to our damage region, because @@ -353,12 +357,8 @@ paint_node_update_late(struct weston_paint_node *pnode) get_placeholder_color(pnode, &pnode->solid); } - if (buffer_dirty) - surf->compositor->renderer->attach(pnode); - pnode->status &= ~(WESTON_PAINT_NODE_VISIBILITY_DIRTY | - WESTON_PAINT_NODE_PLANE_DIRTY | - WESTON_PAINT_NODE_BUFFER_DIRTY); + WESTON_PAINT_NODE_PLANE_DIRTY); paint_node_validate_ready(pnode); }