From ae2fbb9f9a61938df5433ef6b816cc5684e7acac Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 29 Apr 2026 09:06:59 -0500 Subject: [PATCH 1/3] fifo: Remove unused flow_id This was never used, and never will be. Signed-off-by: Derek Foreman --- libweston/fifo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libweston/fifo.c b/libweston/fifo.c index 6117c0d29..d9e8b2f2c 100644 --- a/libweston/fifo.c +++ b/libweston/fifo.c @@ -36,7 +36,6 @@ struct weston_fifo { struct weston_surface *surface; struct wl_listener surface_destroy_listener; - uint64_t flow_id; }; static void From 8a8cc8486a18e49494fed56754b0c0b939ca050f Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 29 Apr 2026 10:06:06 -0500 Subject: [PATCH 2/3] perfetto: Put the damage event in the flow instead of the clean event. The Damaged event is the result of a content update application on a surface. So it makes sense to put this in the flow for the surface. The Clean event comes from a render completion that could be driven by any surface, so it doesn't really make sense to consider it part of surface flow. Signed-off-by: Derek Foreman --- libweston/timeline-perfetto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libweston/timeline-perfetto.c b/libweston/timeline-perfetto.c index c8c2e9e71..54dfbb341 100644 --- a/libweston/timeline-perfetto.c +++ b/libweston/timeline-perfetto.c @@ -143,7 +143,7 @@ weston_timeline_perfetto(struct weston_log_scope *timeline_scope, break; case TLP_CORE_FLUSH_DAMAGE: WESTON_TRACE_TIMESTAMP_END("Damaged", surface->damage_track_id, CLOCK_MONOTONIC, now_ns); - WESTON_TRACE_TIMESTAMP_BEGIN("Clean", surface->damage_track_id, surface->flow_id, CLOCK_MONOTONIC, now_ns); + WESTON_TRACE_TIMESTAMP_BEGIN("Clean", surface->damage_track_id, 0, CLOCK_MONOTONIC, now_ns); break; case TLP_CORE_REPAINT_BEGIN: WESTON_TRACE_TIMESTAMP_END("Scheduled", output->paint_track_id, CLOCK_MONOTONIC, now_ns); @@ -162,7 +162,7 @@ weston_timeline_perfetto(struct weston_log_scope *timeline_scope, case TLP_CORE_COMMIT_DAMAGE: WESTON_TRACE_TIMESTAMP_END("Clean", surface->damage_track_id, CLOCK_MONOTONIC, now_ns); WESTON_TRACE_TIMESTAMP_END("Damaged", surface->damage_track_id, CLOCK_MONOTONIC, now_ns); - WESTON_TRACE_TIMESTAMP_BEGIN("Damaged", surface->damage_track_id, 0, CLOCK_MONOTONIC, now_ns); + WESTON_TRACE_TIMESTAMP_BEGIN("Damaged", surface->damage_track_id, surface->flow_id, CLOCK_MONOTONIC, now_ns); break; case TLP_RENDERER_GPU_BEGIN: WESTON_TRACE_TIMESTAMP_BEGIN("Active", output->gpu_track_id, 0, CLOCK_MONOTONIC, gpu_ns); From 54a25720c6299743805fded996b9b7b0fd9aa9df Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 29 Apr 2026 10:10:08 -0500 Subject: [PATCH 3/3] compositor: Give paint nodes their own flow id Since a paint node is a combination of surface, view, and output, using the surface flow in paint node functions can make a confusing twisty mess. Perfetto flows have in/out degree of one, so we can't properly express the 1 surface to multiple paint nodes relationship with flows. So for now let's break up the surface and paint node flows, but in the future we'll have better ways to map multiple flow starts to the same function via INSTANT events, and we'll be able to better link surface content update to paint node render. Signed-off-by: Derek Foreman --- libweston/compositor.c | 14 ++++++++++---- libweston/libweston-internal.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index c2822ad44..8259f9795 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -204,7 +204,7 @@ get_placeholder_color(struct weston_paint_node *pnode, static void paint_node_update_early(struct weston_paint_node *pnode) { - WESTON_TRACE_FUNC_FLOW(&pnode->surface->flow_id); + WESTON_TRACE_FUNC_FLOW(&pnode->flow_id); struct weston_matrix *mat = &pnode->buffer_to_output_matrix; struct weston_output *output = pnode->output; struct weston_surface *surface = pnode->surface; @@ -326,7 +326,7 @@ paint_node_validate_ready(struct weston_paint_node *pnode) static void paint_node_update_late(struct weston_paint_node *pnode) { - WESTON_TRACE_FUNC_FLOW(&pnode->surface->flow_id); + WESTON_TRACE_FUNC_FLOW(&pnode->flow_id); struct weston_surface *surf = pnode->surface; struct weston_buffer *buffer = surf->buffer_ref.buffer; struct weston_view *view = pnode->view; @@ -3295,7 +3295,7 @@ weston_output_damage(struct weston_output *output) static void paint_node_add_damage(struct weston_paint_node *node) { - WESTON_TRACE_FUNC_FLOW(&node->surface->flow_id); + WESTON_TRACE_FUNC_FLOW(&node->flow_id); struct weston_view *view = node->view; pixman_region32_t damage; @@ -3324,7 +3324,7 @@ paint_node_add_damage(struct weston_paint_node *node) static void paint_node_flush_surface_damage(struct weston_paint_node *pnode) { - WESTON_TRACE_FUNC_FLOW(&pnode->surface->flow_id); + WESTON_TRACE_FUNC_FLOW(&pnode->flow_id); struct weston_output *output = pnode->output; struct weston_surface *surface = pnode->surface; struct weston_buffer *buffer = surface->buffer_ref.buffer; @@ -3351,6 +3351,9 @@ paint_node_flush_surface_damage(struct weston_paint_node *pnode) TLP_SURFACE(surface), TLP_OUTPUT(output), TLP_END); out: + /* We've flushed the surface's damage for *all* of its paint + * nodes, so we can reset the surface flow_id here. + */ surface->flow_id = 0; } @@ -3817,6 +3820,9 @@ weston_output_repaint(struct weston_output *output) z_order_link) { assert(pnode->view->output_mask & (1u << pnode->output->id)); assert(pnode->output == output); + + /* Reset paint node perfetto flows at start of repaint */ + pnode->flow_id = 0; } /* Find the highest protection desired for an output */ diff --git a/libweston/libweston-internal.h b/libweston/libweston-internal.h index 65f754c25..79212d0ce 100644 --- a/libweston/libweston-internal.h +++ b/libweston/libweston-internal.h @@ -678,6 +678,8 @@ enum try_view_on_plane_failure_reasons { * A generic data structure unique for surface-view-output combination. */ struct weston_paint_node { + uint64_t flow_id; /* Perfetto flow id */ + /* Immutable members: */ /* struct weston_surface::paint_node_list */