Mesa (master): nouveau: hide some debugging messages behind environment variable
Marcin Ålusarz
mslusarz at kemper.freedesktop.org
Sun Oct 9 14:57:58 UTC 2011
Module: Mesa
Branch: master
Commit: 90dcd6c89ab4afa55ca19d572a1a695cf55cb1b2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90dcd6c89ab4afa55ca19d572a1a695cf55cb1b2
Author: Marcin Slusarz <marcin.slusarz at gmail.com>
Date: Sat Oct 8 23:58:32 2011 +0200
nouveau: hide some debugging messages behind environment variable
They spam console, but are not very useful - hide them behind
NOUVEAU_MESA_DEBUG environment variable.
---
src/gallium/drivers/nouveau/nouveau_buffer.c | 3 ++-
src/gallium/drivers/nouveau/nouveau_mm.c | 5 +++--
src/gallium/drivers/nouveau/nouveau_screen.c | 7 +++++++
src/gallium/drivers/nouveau/nouveau_screen.h | 2 ++
src/gallium/drivers/nv50/nv50_screen.c | 5 +++--
5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 01d3aa4..60d8e37 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -431,7 +431,8 @@ nouveau_buffer_migrate(struct nouveau_context *nv,
/* keep a system memory copy of our data in case we hit a fallback */
if (!nouveau_buffer_data_fetch(buf, buf->bo, buf->offset, size))
return FALSE;
- debug_printf("migrating %u KiB to VRAM\n", size / 1024);
+ if (nouveau_mesa_debug)
+ debug_printf("migrating %u KiB to VRAM\n", size / 1024);
}
offset = buf->offset;
diff --git a/src/gallium/drivers/nouveau/nouveau_mm.c b/src/gallium/drivers/nouveau/nouveau_mm.c
index 2a4e322..8d0b7bf 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/src/gallium/drivers/nouveau/nouveau_mm.c
@@ -145,8 +145,9 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order)
cache->allocated += size;
- debug_printf("MM: new slab, total memory = %"PRIu64" KiB\n",
- cache->allocated / 1024);
+ if (nouveau_mesa_debug)
+ debug_printf("MM: new slab, total memory = %"PRIu64" KiB\n",
+ cache->allocated / 1024);
return PIPE_OK;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 223e768..cdc2bff 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <errno.h>
+#include <stdlib.h>
#include "nouveau/nouveau_bo.h"
#include "nouveau/nouveau_mm.h"
@@ -21,6 +22,8 @@
#include "state_tracker/drm_driver.h"
#include "util/u_simple_screen.h"
+int nouveau_mesa_debug = 0;
+
static const char *
nouveau_screen_get_name(struct pipe_screen *pscreen)
{
@@ -202,6 +205,10 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
struct pipe_screen *pscreen = &screen->base;
int ret;
+ char *nv_dbg = getenv("NOUVEAU_MESA_DEBUG");
+ if (nv_dbg)
+ nouveau_mesa_debug = atoi(nv_dbg);
+
ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
512*1024, &screen->channel);
if (ret)
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 808500f..d2003e6 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -5,6 +5,8 @@
#include "util/u_memory.h"
typedef uint32_t u32;
+extern int nouveau_mesa_debug;
+
struct nouveau_bo;
struct nouveau_screen {
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index fe8712d..0bd6057 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -502,8 +502,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
screen->tls_size = tls_space * max_warps * 32;
- debug_printf("max_warps = %i, tls_size = %"PRIu64" KiB\n",
- max_warps, screen->tls_size >> 10);
+ if (nouveau_mesa_debug)
+ debug_printf("max_warps = %i, tls_size = %"PRIu64" KiB\n",
+ max_warps, screen->tls_size >> 10);
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 16, screen->tls_size,
&screen->tls_bo);
More information about the mesa-commit
mailing list