gallium/u_threaded: Add some atrace/perfetto

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 <robdclark@chromium.org>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18927>
This commit is contained in:
Rob Clark 2022-10-01 08:37:45 -07:00 committed by Marge Bot
parent 6d5921c623
commit 81925e2cc7

View file

@ -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__)