Mesa (main): panfrost: Add perf_debug macros
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 14 18:05:14 UTC 2021
Module: Mesa
Branch: main
Commit: 256f4a5b02a06ffc701baa3e4fd150796b33b28a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=256f4a5b02a06ffc701baa3e4fd150796b33b28a
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Mon Jul 12 13:55:30 2021 -0400
panfrost: Add perf_debug macros
Lifted from freedreno.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11830>
---
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 4b1fabc1809..a1201baa477 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 e5261016092..33acb983d9a 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 290d2951c24..64129846074 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
More information about the mesa-commit
mailing list