diff --git a/src/gallium/auxiliary/util/u_trace_gallium.c b/src/gallium/auxiliary/util/u_trace_gallium.c index 7029fabd1cf..419d7e93ac6 100644 --- a/src/gallium/auxiliary/util/u_trace_gallium.c +++ b/src/gallium/auxiliary/util/u_trace_gallium.c @@ -76,7 +76,7 @@ u_trace_pipe_context_init(struct u_trace_context *utctx, inline void trace_framebuffer_state(struct u_trace *ut, void *cs, const struct pipe_framebuffer_state *pfb) { - if (likely(!ut->enabled)) + if (likely(!(ut_trace_instrument || ut_perfetto_enabled))) return; trace_framebuffer(ut, cs, pfb); diff --git a/src/util/perf/u_trace.c b/src/util/perf/u_trace.c index bd390b668d0..116ed9edb7f 100644 --- a/src/util/perf/u_trace.c +++ b/src/util/perf/u_trace.c @@ -369,7 +369,7 @@ get_tracefile(void) tracefile = stdout; } - ut_trace_instrument = debug_get_option_trace_instrument(); + ut_trace_instrument = tracefile || debug_get_option_trace_instrument(); firsttime = false; } @@ -595,7 +595,6 @@ u_trace_init(struct u_trace *ut, struct u_trace_context *utctx) { ut->utctx = utctx; list_inithead(&ut->trace_chunks); - ut->enabled = u_trace_context_instrumenting(utctx); } void diff --git a/src/util/perf/u_trace.h b/src/util/perf/u_trace.h index 53f805e4007..b9bfb1ded21 100644 --- a/src/util/perf/u_trace.h +++ b/src/util/perf/u_trace.h @@ -187,8 +187,6 @@ struct u_trace { struct u_trace_context *utctx; struct list_head trace_chunks; /* list of unflushed trace chunks in fifo order */ - - bool enabled; }; void u_trace_context_init(struct u_trace_context *utctx, @@ -293,12 +291,6 @@ u_trace_context_actively_tracing(struct u_trace_context *utctx) return !!utctx->out || (ut_perfetto_enabled > 0); } -static inline bool -u_trace_context_instrumenting(struct u_trace_context *utctx) -{ - return !!utctx->out || ut_trace_instrument || (ut_perfetto_enabled > 0); -} - #ifdef __cplusplus } #endif diff --git a/src/util/perf/u_trace.py b/src/util/perf/u_trace.py index 3a96b4f0600..d9536fccea5 100644 --- a/src/util/perf/u_trace.py +++ b/src/util/perf/u_trace.py @@ -253,10 +253,10 @@ static inline void trace_${trace_name}( % endfor ) { % if trace.tp_perfetto is not None: - if (!unlikely((ut->enabled || ut_trace_instrument || ut_perfetto_enabled) && + if (!unlikely((ut_trace_instrument || ut_perfetto_enabled) && ${trace.enabled_expr(trace_toggle_name)})) % else: - if (!unlikely((ut->enabled || ut_trace_instrument) && + if (!unlikely(ut_trace_instrument && ${trace.enabled_expr(trace_toggle_name)})) % endif return;