Module: Mesa Branch: main Commit: 87879b0633a7c9b924c294b3827bdadb311261c3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=87879b0633a7c9b924c294b3827bdadb311261c3
Author: Guido Günther <[email protected]> Date: Tue Apr 27 11:21:32 2021 +0200 etnaviv/drm: Use etna_mesa_debug for debugging messages We use the variable from gallium but fall back to a weak symbol in case there's usage out of galllium in the future. Signed-off-by: Guido Günther <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> Acked-by: Lucas Stach <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10546> --- src/etnaviv/drm/etnaviv_device.c | 3 +++ src/etnaviv/drm/etnaviv_priv.h | 6 ++++-- src/gallium/drivers/etnaviv/etnaviv_debug.h | 1 + src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/etnaviv/drm/etnaviv_device.c b/src/etnaviv/drm/etnaviv_device.c index 3e4370b96cb..7c1aa90ff3a 100644 --- a/src/etnaviv/drm/etnaviv_device.c +++ b/src/etnaviv/drm/etnaviv_device.c @@ -30,6 +30,9 @@ #include "etnaviv_priv.h" #include "etnaviv_drmif.h" +/* Declare symbol in case we don't link with etnaviv's gallium driver */ +int etna_mesa_debug __attribute__((weak)) = 0; + struct etna_device *etna_device_new(int fd) { struct etna_device *dev; diff --git a/src/etnaviv/drm/etnaviv_priv.h b/src/etnaviv/drm/etnaviv_priv.h index 0b2c2c820d8..880d6194e21 100644 --- a/src/etnaviv/drm/etnaviv_priv.h +++ b/src/etnaviv/drm/etnaviv_priv.h @@ -188,13 +188,15 @@ struct etna_perfmon_signal #define ALIGN(v,a) (((v) + (a) - 1) & ~((a) - 1)) -#define enable_debug 0 /* TODO make dynamic */ +#define ETNA_DRM_MSGS 0x40 +extern int etna_mesa_debug; #define INFO_MSG(fmt, ...) \ do { debug_printf("[I] "fmt " (%s:%d)\n", \ ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0) #define DEBUG_MSG(fmt, ...) \ - do if (enable_debug) { debug_printf("[D] "fmt " (%s:%d)\n", \ + do if (etna_mesa_debug & ETNA_DRM_MSGS) { \ + debug_printf("[D] "fmt " (%s:%d)\n", \ ##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0) #define WARN_MSG(fmt, ...) \ do { debug_printf("[W] "fmt " (%s:%d)\n", \ diff --git a/src/gallium/drivers/etnaviv/etnaviv_debug.h b/src/gallium/drivers/etnaviv/etnaviv_debug.h index 9b79fad9b11..f8f1e21c367 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_debug.h +++ b/src/gallium/drivers/etnaviv/etnaviv_debug.h @@ -38,6 +38,7 @@ #define ETNA_DBG_COMPILER_MSGS 0x8 #define ETNA_DBG_LINKER_MSGS 0x10 #define ETNA_DBG_DUMP_SHADERS 0x20 +#define ETNA_DRM_MSGS 0x40 /* Debug messages from DRM */ /* Bypasses */ #define ETNA_DBG_NO_TS 0x1000 /* Disable TS */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 6def7cacd69..21a86c7b19e 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -54,6 +54,7 @@ static const struct debug_named_value etna_debug_options[] = { {"dbg_msgs", ETNA_DBG_MSGS, "Print debug messages"}, + {"drm_msgs", ETNA_DRM_MSGS, "Print drm messages"}, {"frame_msgs", ETNA_DBG_FRAME_MSGS, "Print frame messages"}, {"resource_msgs", ETNA_DBG_RESOURCE_MSGS, "Print resource messages"}, {"compiler_msgs", ETNA_DBG_COMPILER_MSGS, "Print compiler messages"},
