From a065682f3062f39c3d4a8d4ea65c8ddf5b58527d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 22 Jan 2021 08:18:07 -0800 Subject: [PATCH] freedreno: Add perf_warn() trace helper Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/freedreno_screen.c | 2 +- src/gallium/drivers/freedreno/freedreno_util.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index a9cd0e21232..68fef4dee12 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -72,7 +72,7 @@ static const struct debug_named_value fd_debug_options[] = { {"noscis", FD_DBG_NOSCIS, "Disable scissor optimization"}, {"direct", FD_DBG_DIRECT, "Force inline (SS_DIRECT) state loads"}, {"nobypass", FD_DBG_NOBYPASS, "Disable GMEM bypass"}, - /* BIT(7) */ + {"perf", FD_DBG_PERF, "Enable performance warnings"}, {"nobin", FD_DBG_NOBIN, "Disable hw binning"}, {"nogmem", FD_DBG_NOGMEM, "Disable GMEM rendering (bypass only)"}, /* BIT(10) */ diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index f9196924265..e184766f5dc 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -68,7 +68,7 @@ enum fd_debug_flag { FD_DBG_NOSCIS = BITFIELD_BIT(4), FD_DBG_DIRECT = BITFIELD_BIT(5), FD_DBG_NOBYPASS = BITFIELD_BIT(6), - /* BIT(7) */ + FD_DBG_PERF = BITFIELD_BIT(7), FD_DBG_NOBIN = BITFIELD_BIT(8), FD_DBG_NOGMEM = BITFIELD_BIT(9), /* BIT(10) */ @@ -100,6 +100,16 @@ extern bool fd_binning_enabled; mesa_logd("%s:%d: "fmt, \ __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0) +#define perf_debug_ctx(ctx, ...) do { \ + perf_warn(__VA_ARGS__); \ + pipe_debug_message(&(ctx)->debug, PERF_INFO, __VA_ARGS__); \ + } while(0) + +#define perf_debug(...) do { \ + if (unlikely(fd_mesa_debug & FD_DBG_PERF)) \ + mesa_logw(__VA_ARGS__); \ + } while(0) + /* for conditionally setting boolean flag(s): */ #define COND(bool, val) ((bool) ? (val) : 0)