[Intel-gfx] [PATCH v4 7/7] amdgpu: define a dydbg-bitmap to control categorized pr_debugs

Jim Cromie jim.cromie at gmail.com
Sat Jul 31 21:42:04 UTC 2021


logger_types.h defines many DC_LOG_*() categorized debug wrappers.
Many of these use DRM_DEBUG_*, so are controllable using drm.debug,
but others use bare pr_debug()s, each with a different class-prefix
matching "^[\w+]:"

Use DYNDBG_BITMAP_DESC() to create a parameter/debug_dc, and to define
bits to control those pr_debugs by their category.

Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
 .../gpu/drm/amd/display/dc/core/dc_debug.c    | 42 ++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c
index 21be2a684393..3041e0c3d726 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c
@@ -36,8 +36,48 @@
 
 #include "resource.h"
 
-#define DC_LOGGER_INIT(logger)
+/* define a drm.debug style dyndbg pr-debug control point */
+unsigned long __debug_dc;
+EXPORT_SYMBOL(__debug_dc);
+
+#define _help(key)	"\t\t" key " : help for " key "\n"
+#define cmd_help(key)	{ .prefix = key, .help = "help for " key }
+
+/* Id like to do these inside DEFINE_DYNDBG_BITMAP, later */
+#define MY_DYNDBG_PARM_DESC(name)					\
+	"Enable debug output via /sys/module/amdgpu/parameters/" #name	\
+	", where each bit enables a debug category.\n"			\
+		_help("[SURFACE]:")					\
+		_help("[CURSOR]:")					\
+		_help("[PFLIP]:")					\
+		_help("[VBLANK]:")					\
+		_help("[HW_LINK_TRAINING]:")				\
+		_help("[HW_AUDIO]:")					\
+		_help("[SCALER]:")					\
+		_help("[BIOS]:")					\
+		_help("[BANDWIDTH_CALCS]:")				\
+		_help("[DML]:")						\
+		_help("[IF_TRACE]:")					\
+		_help("[GAMMA]:")					\
+		_help("[SMU_MSG]:")
+MODULE_PARM_DESC(debug_dc, MY_DYNDBG_PARM_DESC(name));
+
+DEFINE_DYNDBG_BITMAP(debug_dc, &__debug_dc,
+		     MY_DYNDBG_PARM_DESC(debug_dc),
+		     cmd_help("[CURSOR]:"),
+		     cmd_help("[PFLIP]:"),
+		     cmd_help("[VBLANK]:"),
+		     cmd_help("[HW_LINK_TRAINING]:"),
+		     cmd_help("[HW_AUDIO]:"),
+		     cmd_help("[SCALER]:"),
+		     cmd_help("[BIOS]:"),
+		     cmd_help("[BANDWIDTH_CALCS]:"),
+		     cmd_help("[DML]:"),
+		     cmd_help("[IF_TRACE]:"),
+		     cmd_help("[GAMMA]:"),
+		     cmd_help("[SMU_MSG]:"));
 
+#define DC_LOGGER_INIT(logger)
 
 #define SURFACE_TRACE(...) do {\
 		if (dc->debug.surface_trace) \
-- 
2.31.1



More information about the Intel-gfx mailing list