From 256f4a5b02a06ffc701baa3e4fd150796b33b28a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 12 Jul 2021 13:55:30 -0400 Subject: [PATCH] panfrost: Add perf_debug macros Lifted from freedreno. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_screen.c | 1 + src/gallium/drivers/panfrost/pan_screen.h | 10 ++++++++++ src/panfrost/lib/pan_util.h | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 4b1fabc..a1201ba 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -57,6 +57,7 @@ #include "panfrost-quirks.h" static const struct debug_named_value panfrost_debug_options[] = { + {"perf", PAN_DBG_PERF, "Enable performance warnings"}, {"trace", PAN_DBG_TRACE, "Trace the command stream"}, {"deqp", PAN_DBG_DEQP, "Hacks for dEQP"}, {"dirty", PAN_DBG_DIRTY, "Always re-emit all state"}, diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h index e526101..33acb98 100644 --- a/src/gallium/drivers/panfrost/pan_screen.h +++ b/src/gallium/drivers/panfrost/pan_screen.h @@ -36,6 +36,7 @@ #include "util/u_dynarray.h" #include "util/bitset.h" #include "util/set.h" +#include "util/log.h" #include "pan_device.h" #include "pan_mempool.h" @@ -103,4 +104,13 @@ panfrost_fence_create(struct panfrost_context *ctx); void panfrost_cmdstream_screen_init(struct panfrost_screen *screen); +#define perf_debug(dev, ...) \ + do { \ + if (unlikely((dev)->debug & PAN_DBG_PERF)) \ + mesa_logw(__VA_ARGS__); \ + } while(0) + +#define perf_debug_ctx(ctx, ...) \ + perf_debug(pan_device((ctx)->base.screen), __VA_ARGS__); + #endif /* PAN_SCREEN_H */ diff --git a/src/panfrost/lib/pan_util.h b/src/panfrost/lib/pan_util.h index 290d295..6412984 100644 --- a/src/panfrost/lib/pan_util.h +++ b/src/panfrost/lib/pan_util.h @@ -28,7 +28,7 @@ #ifndef PAN_UTIL_H #define PAN_UTIL_H -/* 0x0001 unused */ +#define PAN_DBG_PERF 0x0001 #define PAN_DBG_TRACE 0x0002 #define PAN_DBG_DEQP 0x0004 #define PAN_DBG_DIRTY 0x0008 -- 2.7.4