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 <agx@sigxcpu.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10546>
This commit is contained in:
Guido Günther 2021-04-27 11:21:32 +02:00 committed by Christian Gmeiner
parent ebd1f202ae
commit 87879b0633
4 changed files with 9 additions and 2 deletions

View File

@ -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;

View File

@ -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", \

View File

@ -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 */

View File

@ -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"},