diff --git a/libweston/perfetto/u_perfetto.cc b/libweston/perfetto/u_perfetto.cc index de6b7f554..6a32041b9 100644 --- a/libweston/perfetto/u_perfetto.cc +++ b/libweston/perfetto/u_perfetto.cc @@ -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); } diff --git a/libweston/perfetto/u_perfetto.h b/libweston/perfetto/u_perfetto.h index 8d9ca2b51..1bf7431e0 100644 --- a/libweston/perfetto/u_perfetto.h +++ b/libweston/perfetto/u_perfetto.h @@ -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); diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 7c65d5073..2c385c827 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -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); diff --git a/libweston/renderer-gl/gl-shaders.c b/libweston/renderer-gl/gl-shaders.c index 9af350c18..698d2334e 100644 --- a/libweston/renderer-gl/gl-shaders.c +++ b/libweston/renderer-gl/gl-shaders.c @@ -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); } diff --git a/libweston/weston-trace.h b/libweston/weston-trace.h index 63f8c2c44..0f80f9e21 100644 --- a/libweston/weston-trace.h +++ b/libweston/weston-trace.h @@ -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(); \