From 81925e2cc7cda8b36370ef1095b41cc39759ec3c Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 1 Oct 2022 08:37:45 -0700 Subject: [PATCH] gallium/u_threaded: Add some atrace/perfetto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the MESA_TRACE_BEGIN/END() macros which will generate perfetto traces (if perfetto is enabled) otherwise atrace (if android build), in either case creating track events which will show up on the frontend thread in a perfetto trace, giving visibility into where syncs happen. Signed-off-by: Rob Clark Acked-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_threaded_context.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 433b31b07b3..d6c2ff8fa7e 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -32,6 +32,7 @@ #include "util/u_upload_mgr.h" #include "driver_trace/tr_context.h" #include "util/log.h" +#include "util/perf/cpu_trace.h" #include "compiler/shader_info.h" #if TC_DEBUG >= 1 @@ -392,6 +393,8 @@ _tc_sync(struct threaded_context *tc, UNUSED const char *info, UNUSED const char struct tc_batch *next = &tc->batch_slots[tc->next]; bool synced = false; + MESA_TRACE_BEGIN(func); + tc_debug_check(tc); /* Only wait for queued calls... */ @@ -421,10 +424,12 @@ _tc_sync(struct threaded_context *tc, UNUSED const char *info, UNUSED const char if (tc_strcmp(func, "tc_destroy") != 0) { tc_printf("sync %s %s", func, info); - } + } } tc_debug_check(tc); + + MESA_TRACE_END(); } #define tc_sync(tc) _tc_sync(tc, "", __func__)