trace: drop the explicit flow from COMMIT_ANNOTATION

Replace this with flow annotations, allowing us to burn down even more
copy pasta.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-05-20 17:30:27 -05:00
parent df36535499
commit abccfe3b5c
5 changed files with 31 additions and 66 deletions

View file

@ -263,20 +263,9 @@ util_perfetto_flush_debug_annotation(perfetto::EventContext *ctx,
}
void
util_perfetto_trace_commit_debug_annots(uint64_t id, const char *name,
util_perfetto_trace_commit_debug_annots(const char *name,
struct weston_debug_annotations *annots)
{
if (id) {
TRACE_EVENT_INSTANT(UTIL_PERFETTO_CATEGORY_DEFAULT_STR,
nullptr,
perfetto::Flow::ProcessScoped(id),
[&](perfetto::EventContext ctx) {
ctx.event()->set_name(name);
util_perfetto_flush_debug_annotation(&ctx, annots);
});
return;
}
TRACE_EVENT_INSTANT(UTIL_PERFETTO_CATEGORY_DEFAULT_STR,
nullptr,
[&](perfetto::EventContext ctx) {
@ -297,19 +286,6 @@ util_perfetto_trace_commit_annotate_func(const char *name,
});
}
void
util_perfetto_trace_commit_annotate_func_flow(uint64_t id, const char *name,
struct weston_debug_annotations *annots)
{
TRACE_EVENT_BEGIN(UTIL_PERFETTO_CATEGORY_DEFAULT_STR,
nullptr,
perfetto::Flow::ProcessScoped(id),
[&](perfetto::EventContext ctx) {
ctx.event()->set_name(name);
util_perfetto_flush_debug_annotation(&ctx, annots);
});
}
class UtilPerfettoObserver : public perfetto::TrackEventSessionObserver {
public:
UtilPerfettoObserver() { perfetto::TrackEvent::AddSessionObserver(this); }

View file

@ -91,15 +91,12 @@ void util_perfetto_trace_full_begin(const char *name, uint64_t track_id, uint64_
void util_perfetto_trace_full_end(const char *name, uint64_t track_id, clockid_t clock, uint64_t timestamp);
void util_perfetto_trace_commit_debug_annots(uint64_t id, const char *name,
void util_perfetto_trace_commit_debug_annots(const char *name,
struct weston_debug_annotations *annots);
void util_perfetto_trace_commit_annotate_func(const char *name,
struct weston_debug_annotations *annots);
void util_perfetto_trace_commit_annotate_func_flow(uint64_t id, const char *name,
struct weston_debug_annotations *annots);
void util_perfetto_trace_instant_timestamp(const char *name, uint64_t track_id,
uint64_t id, clockid_t clock, uint64_t ts);

View file

@ -436,14 +436,15 @@ gl_log_paint_node_bbox_and_region(struct gl_renderer *gr, struct weston_paint_no
WESTON_TRACE_BEGIN_ANNOTATION();
WESTON_TRACE_ANNOTATE(("paint node", pnode->internal_name),
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("paint node", pnode->internal_name),
("type", str),
("x", box_x),
("y", box_y),
("box_width", box_width),
("box_height", box_height));
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
WESTON_TRACE_COMMIT_ANNOTATION();
if (!weston_log_scope_is_enabled(gr->paint_node_scope))
return;
@ -2372,12 +2373,12 @@ set_blend_state(struct gl_renderer *gr, struct weston_paint_node *pnode, bool st
}
if (pnode) {
WESTON_TRACE_ANNOTATE(("paint node", pnode->internal_name));
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
} else {
WESTON_TRACE_COMMIT_ANNOTATION(NULL);
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("paint node", pnode->internal_name));
}
WESTON_TRACE_COMMIT_ANNOTATION();
gr->blend_state = state;
}
@ -2555,16 +2556,18 @@ apply_color_effect(struct gl_renderer *gr, struct weston_paint_node *pnode, stru
*g = 1.0f - *g;
*b = 1.0f - *b;
gl_log_paint_node(gr, "\t\tcolor effect: inversion\n");
WESTON_TRACE_ANNOTATE(("color effect", "inversion"));
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("color effect", "inversion"));
WESTON_TRACE_COMMIT_ANNOTATION();
return;
case WESTON_OUTPUT_COLOR_EFFECT_TYPE_GRAYSCALE:
*r = 0.2126f * (*r) + 0.7152f * (*g) + 0.0722f * (*b);
*g = *r;
*b = *r;
gl_log_paint_node(gr, "\t\tcolor effect: grayscale\n");
WESTON_TRACE_ANNOTATE(("color effect", "greyscale"));
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("color effect", "greyscale"));
WESTON_TRACE_COMMIT_ANNOTATION();
return;
case WESTON_OUTPUT_COLOR_EFFECT_TYPE_CVD_CORRECTION:
/**
@ -2578,9 +2581,10 @@ apply_color_effect(struct gl_renderer *gr, struct weston_paint_node *pnode, stru
weston_log_scope_printf(gr->paint_node_scope,
"\t\tcolor effect: cvd - %s\n",
weston_output_cvd_type_to_str(effect->u.cvd));
WESTON_TRACE_ANNOTATE(("color effect",
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("color effect",
weston_output_cvd_type_to_str(effect->u.cvd)));
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
WESTON_TRACE_COMMIT_ANNOTATION();
return;
};
@ -2644,7 +2648,8 @@ draw_paint_node(struct weston_paint_node *pnode,
pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint, &pnode->visible, damage);
WESTON_TRACE_ANNOTATE(("paint node", pnode->internal_name),
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("paint node", pnode->internal_name),
("label", pnode->surface->label),
("surface id", pnode->surface->s_id));
@ -2730,7 +2735,7 @@ draw_paint_node(struct weston_paint_node *pnode,
pixman_region32_fini(&surface_blend);
pixman_region32_fini(&surface_opaque);
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
WESTON_TRACE_COMMIT_ANNOTATION();
out:
pixman_region32_fini(&repaint);

View file

@ -856,7 +856,8 @@ gl_shader_load_config(struct gl_renderer *gr, struct weston_paint_node *pnode,
WESTON_TRACE_BEGIN_ANNOTATION();
if (pnode) {
WESTON_TRACE_ANNOTATE(("paint node", pnode->internal_name));
WESTON_TRACE_ANNOTATE(("paint node flow", &pnode->flow),
("paint node", pnode->internal_name));
}
glUniformMatrix4fv(shader->proj_uniform,
@ -977,11 +978,7 @@ gl_shader_load_config(struct gl_renderer *gr, struct weston_paint_node *pnode,
TEX_UNIT_FB_STORE_CURVE);
}
if (pnode) {
WESTON_TRACE_COMMIT_ANNOTATION(&pnode->flow.id);
} else {
WESTON_TRACE_COMMIT_ANNOTATION(NULL);
}
WESTON_TRACE_COMMIT_ANNOTATION();
glActiveTexture(GL_TEXTURE0);
}

View file

@ -100,9 +100,9 @@
_WESTON_TRACE_ANNOTATE_ADD_GENERIC(k, v); \
} while (0)
#define _WESTON_TRACE_COMMIT_ANNOTATION(id, name) \
#define _WESTON_TRACE_COMMIT_ANNOTATION(name) \
do { \
_weston_trace_scope_annotate_commit(id, name, &__pd_annots); \
_weston_trace_scope_annotate_commit(name, &__pd_annots); \
} while (0)
/* annotated funcs */
@ -179,20 +179,10 @@ _weston_trace_scope_begin(const char *name)
}
static inline void
_weston_trace_scope_annotate_commit(uint64_t *id, const char *name,
_weston_trace_scope_annotate_commit(const char *name,
struct weston_debug_annotations *annots)
{
uint64_t flow_id = 0;
if (id) {
if (*id == 0)
*id = util_perfetto_next_id();
flow_id = *id;
}
if (unlikely(util_perfetto_is_tracing_enabled()))
util_perfetto_trace_commit_debug_annots(flow_id, name, annots);
util_perfetto_trace_commit_debug_annots(name, annots);
annots->count = 0;
}
@ -238,7 +228,7 @@ _weston_trace_scope_end(int *scope)
#define _WESTON_TRACE_INSTANT_TIMESTAMP(name, track_id, id, clock, timestamp)
#define _WESTON_TRACE_BEGIN_ANNOTATION()
#define _WESTON_TRACE_COMMIT_ANNOTATION(id, name)
#define _WESTON_TRACE_COMMIT_ANNOTATION(name)
#define _WESTON_TRACE_ANNOTATE_FUNC(...)
#define _WESTON_TRACE_ANNOTATE(...)
@ -258,8 +248,8 @@ _weston_trace_scope_end(int *scope)
#define WESTON_TRACE_BEGIN_ANNOTATION() \
_WESTON_TRACE_BEGIN_ANNOTATION()
#define WESTON_TRACE_COMMIT_ANNOTATION(id) \
_WESTON_TRACE_COMMIT_ANNOTATION(id, __func__)
#define WESTON_TRACE_COMMIT_ANNOTATION() \
_WESTON_TRACE_COMMIT_ANNOTATION(__func__)
#define WESTON_TRACE_ANNOTATE_FUNC(...) \
WESTON_TRACE_BEGIN_ANNOTATION(); \