From 8358d44223023f7cb6640244304519202fba3645 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Thu, 8 May 2025 11:55:10 +0200 Subject: [PATCH] util/perf: Change _mesa_trace begin functions to return void * This enables implementations to pass context data between begin and end tracing points, which is useful for more complex performance monitoring. The change is minimal and only affects the function signatures and return values, with no functional changes to existing behavior. Signed-off-by: Christian Gmeiner Acked-by: Emma Anholt Part-of: --- src/util/perf/cpu_trace.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util/perf/cpu_trace.h b/src/util/perf/cpu_trace.h index a031cfbdd2e..d975f059517 100644 --- a/src/util/perf/cpu_trace.h +++ b/src/util/perf/cpu_trace.h @@ -112,17 +112,17 @@ * to work. */ #define _MESA_TRACE_SCOPE(format, ...) \ - int _MESA_TRACE_SCOPE_VAR(__LINE__) \ + void *_MESA_TRACE_SCOPE_VAR(__LINE__) \ __attribute__((cleanup(_mesa_trace_scope_end), unused)) = \ _mesa_trace_scope_begin(format, ##__VA_ARGS__) #define _MESA_TRACE_SCOPE_FLOW(name, id) \ - int _MESA_TRACE_SCOPE_VAR(__LINE__) \ + void *_MESA_TRACE_SCOPE_VAR(__LINE__) \ __attribute__((cleanup(_mesa_trace_scope_end), unused)) = \ _mesa_trace_scope_flow_begin(name, id) __attribute__((format(printf, 1, 2))) -static inline int +static inline void * _mesa_trace_scope_begin(const char *format, ...) { char name[_MESA_TRACE_SCOPE_MAX_NAME_LENGTH]; @@ -136,21 +136,21 @@ _mesa_trace_scope_begin(const char *format, ...) _MESA_TRACE_BEGIN(name); _MESA_GPUVIS_TRACE_BEGIN(name); - return 0; + return NULL; } -static inline int +static inline void * _mesa_trace_scope_flow_begin(const char *name, uint64_t *id) { if (*id == 0) *id = util_perfetto_next_id(); _MESA_TRACE_FLOW_BEGIN(name, *id); _MESA_GPUVIS_TRACE_BEGIN(name); - return 0; + return NULL; } static inline void -_mesa_trace_scope_end(UNUSED int *scope) +_mesa_trace_scope_end(UNUSED void **scope) { _MESA_GPUVIS_TRACE_END(); _MESA_TRACE_END();