summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h11
-rw-r--r--src/gallium/drivers/nv50/nv50_debug.h25
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.c20
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.h8
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_optimize.c13
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_regalloc.c14
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_tgsi_to_nc.c6
-rw-r--r--src/gallium/drivers/nvc0/nvc0_context.h11
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc.c23
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc.h15
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc_emit.c2
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc_optimize.c6
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc_regalloc.c14
-rw-r--r--src/gallium/drivers/nvc0/nvc0_program.c16
-rw-r--r--src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c6
16 files changed, 85 insertions, 109 deletions
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index f480f043096..3f031994f0a 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -1,7 +1,6 @@
#ifndef __NV50_CONTEXT_H__
#define __NV50_CONTEXT_H__
-#include <stdio.h>
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
@@ -13,6 +12,7 @@
#include "draw/draw_vertex.h"
+#include "nv50_debug.h"
#include "nv50_winsys.h"
#include "nv50_stateobj.h"
#include "nv50_screen.h"
@@ -26,15 +26,6 @@
#include "nv50_3d.xml.h"
#include "nv50_2d.xml.h"
-#define NOUVEAU_ERR(fmt, args...) \
- fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args);
-
-#ifdef NOUVEAU_DEBUG
-# define NOUVEAU_DBG(args...) printf(args);
-#else
-# define NOUVEAU_DBG(args...)
-#endif
-
#define NV50_NEW_BLEND (1 << 0)
#define NV50_NEW_RASTERIZER (1 << 1)
#define NV50_NEW_ZSA (1 << 2)
diff --git a/src/gallium/drivers/nv50/nv50_debug.h b/src/gallium/drivers/nv50/nv50_debug.h
new file mode 100644
index 00000000000..f3dee621519
--- /dev/null
+++ b/src/gallium/drivers/nv50/nv50_debug.h
@@ -0,0 +1,25 @@
+
+#ifndef __NV50_DEBUG_H__
+#define __NV50_DEBUG_H__
+
+#include <stdio.h>
+
+#include "util/u_debug.h"
+
+#define NV50_DEBUG_MISC 0x0001
+#define NV50_DEBUG_SHADER 0x0100
+#define NV50_DEBUG_PROG_IR 0x0200
+#define NV50_DEBUG_PROG_RA 0x0400
+#define NV50_DEBUG_PROG_CFLOW 0x0800
+#define NV50_DEBUG_PROG_ALL 0x1f00
+
+#define NV50_DEBUG 0
+
+#define NOUVEAU_ERR(fmt, args...) \
+ fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args)
+
+#define NV50_DBGMSG(ch, args...) \
+ if ((NV50_DEBUG) & (NV50_DEBUG_##ch)) \
+ debug_printf(args)
+
+#endif /* __NV50_DEBUG_H__ */
diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c
index 4fe13a75b29..7900bf811df 100644
--- a/src/gallium/drivers/nv50/nv50_pc.c
+++ b/src/gallium/drivers/nv50/nv50_pc.c
@@ -20,8 +20,6 @@
* SOFTWARE.
*/
-/* #define NV50PC_DEBUG */
-
#include "nv50_pc.h"
#include "nv50_program.h"
@@ -368,7 +366,7 @@ nv_print_program(struct nv_pc *pc)
nv_print_function(pc->root[i]);
}
-#ifdef NV50PC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
static void
nv_do_print_cfgraph(struct nv_pc *pc, FILE *f, struct nv_basic_block *b)
{
@@ -426,7 +424,7 @@ nv_print_cfgraph(struct nv_pc *pc, const char *filepath, int subr)
fclose(f);
}
-#endif
+#endif /* NV50_DEBUG_PROG_CFLOW */
static INLINE void
nvcg_show_bincode(struct nv_pc *pc)
@@ -447,7 +445,7 @@ nv50_emit_program(struct nv_pc *pc)
uint32_t *code = pc->emit;
int n;
- NV50_DBGMSG("emitting program: size = %u\n", pc->bin_size);
+ NV50_DBGMSG(SHADER, "emitting program: size = %u\n", pc->bin_size);
for (n = 0; n < pc->num_blocks; ++n) {
struct nv_instruction *i;
@@ -473,7 +471,7 @@ nv50_emit_program(struct nv_pc *pc)
pc->emit = code;
code[pc->bin_size / 4 - 1] |= 1;
-#ifdef NV50PC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_SHADER
nvcg_show_bincode(pc);
#endif
@@ -501,7 +499,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv50_tgsi_to_nc(pc, ti);
if (ret)
goto out;
-#ifdef NV50PC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nv_print_program(pc);
#endif
@@ -511,7 +509,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv_pc_exec_pass0(pc);
if (ret)
goto out;
-#ifdef NV50PC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nv_print_program(pc);
#endif
@@ -519,7 +517,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv_pc_exec_pass1(pc);
if (ret)
goto out;
-#ifdef NV50PC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
nv_print_program(pc);
nv_print_cfgraph(pc, "nv50_shader_cfgraph.dot", 0);
#endif
@@ -553,7 +551,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ti->p->uses_lmem = ti->store_to_memory;
- NV50_DBGMSG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success");
+ NV50_DBGMSG(SHADER, "SHADER TRANSLATION - %s\n", ret ? "failed" : "success");
out:
nv_pc_free_refs(pc);
@@ -673,7 +671,7 @@ nv_nvi_delete(struct nv_instruction *nvi)
if (nvi == b->phi) {
if (nvi->opcode != NV_OP_PHI)
- NV50_DBGMSG("NOTE: b->phi points to non-PHI instruction\n");
+ NV50_DBGMSG(PROG_IR, "NOTE: b->phi points to non-PHI instruction\n");
assert(!nvi->prev);
if (!nvi->next || nvi->next->opcode != NV_OP_PHI)
diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h
index a9a3248038b..5bb0e1296bb 100644
--- a/src/gallium/drivers/nv50/nv50_pc.h
+++ b/src/gallium/drivers/nv50/nv50_pc.h
@@ -23,13 +23,7 @@
#ifndef __NV50_COMPILER_H__
#define __NV50_COMPILER_H__
-#define NV50PC_DEBUG
-
-#ifdef NV50PC_DEBUG
-# define NV50_DBGMSG(args...) debug_printf(args)
-#else
-# define NV50_DBGMSG(args...)
-#endif
+#include "nv50_debug.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index 281ccf7ac61..d72b23c137a 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -20,8 +20,6 @@
* SOFTWARE.
*/
-/* #define NV50PC_DEBUG */
-
#include "nv50_pc.h"
#define DESCEND_ARBITRARY(j, f) \
@@ -116,7 +114,7 @@ nvi_isnop(struct nv_instruction *nvi)
return FALSE;
if (nvi->src[0]->value->join->reg.id < 0) {
- NV50_DBGMSG("nvi_isnop: orphaned value detected\n");
+ NV50_DBGMSG(PROG_IR, "nvi_isnop: orphaned value detected\n");
return TRUE;
}
@@ -201,7 +199,7 @@ nv_pc_pass_pre_emission(void *priv, struct nv_basic_block *b)
}
if (!b->entry) {
- NV50_DBGMSG("block %p is now empty\n", b);
+ NV50_DBGMSG(PROG_IR, "block %p is now empty\n", b);
} else
if (!b->exit->is_long) {
assert(n32);
@@ -240,7 +238,7 @@ nv_pc_exec_pass2(struct nv_pc *pc)
{
int i, ret;
- NV50_DBGMSG("preparing %u blocks for emission\n", pc->num_blocks);
+ NV50_DBGMSG(PROG_IR, "preparing %u blocks for emission\n", pc->num_blocks);
pc->num_blocks = 0; /* will reorder bb_list */
@@ -966,7 +964,8 @@ nv_pass_flatten(struct nv_pass *ctx, struct nv_basic_block *b)
if (bb_is_if_else_endif(b)) {
- NV50_DBGMSG("pass_flatten: IF/ELSE/ENDIF construct at BB:%i\n", b->id);
+ NV50_DBGMSG(PROG_IR,
+ "pass_flatten: IF/ELSE/ENDIF construct at BB:%i\n", b->id);
for (n0 = 0, nvi = b->out[0]->entry; nvi; nvi = nvi->next, ++n0)
if (!nv50_nvi_can_predicate(nvi))
@@ -975,7 +974,7 @@ nv_pass_flatten(struct nv_pass *ctx, struct nv_basic_block *b)
for (n1 = 0, nvi = b->out[1]->entry; nvi; nvi = nvi->next, ++n1)
if (!nv50_nvi_can_predicate(nvi))
break;
-#ifdef NV50PC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
if (nvi) {
debug_printf("cannot predicate: "); nv_print_instruction(nvi);
}
diff --git a/src/gallium/drivers/nv50/nv50_pc_regalloc.c b/src/gallium/drivers/nv50/nv50_pc_regalloc.c
index e4f418aa7ca..e79fd594cea 100644
--- a/src/gallium/drivers/nv50/nv50_pc_regalloc.c
+++ b/src/gallium/drivers/nv50/nv50_pc_regalloc.c
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-/* #define NV50PC_DEBUG */
-
-/* #define NV50_RA_DEBUG_LIVEI */
-/* #define NV50_RA_DEBUG_LIVE_SETS */
-/* #define NV50_RA_DEBUG_JOIN */
+#if NV50_DEBUG & NV50_DEBUG_PROG_RA
+# define NV50_RA_DEBUG_LIVEI
+# define NV50_RA_DEBUG_LIVE_SETS
+# define NV50_RA_DEBUG_JOIN
+#endif
#include "nv50_context.h"
#include "nv50_pc.h"
@@ -1013,7 +1013,7 @@ nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
struct nv_pc_pass *ctx;
int i, ret;
- NV50_DBGMSG("REGISTER ALLOCATION - entering\n");
+ NV50_DBGMSG(PROG_RA, "REGISTER ALLOCATION - entering\n");
ctx = CALLOC_STRUCT(nv_pc_pass);
if (!ctx)
@@ -1075,7 +1075,7 @@ nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
for (i = 0; i < pc->num_values; ++i)
livei_release(&pc->values[i]);
- NV50_DBGMSG("REGISTER ALLOCATION - leaving\n");
+ NV50_DBGMSG(PROG_RA, "REGISTER ALLOCATION - leaving\n");
out:
FREE(ctx->insns);
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 37025a6f12e..41d3e14dc0f 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -20,8 +20,6 @@
* SOFTWARE.
*/
-/* #define NV50_PROGRAM_DEBUG */
-
#include "nv50_program.h"
#include "nv50_pc.h"
#include "nv50_context.h"
@@ -564,7 +562,7 @@ nv50_prog_scan(struct nv50_translation_info *ti)
tgsi_scan_shader(p->pipe.tokens, &ti->scan);
-#ifdef NV50_PROGRAM_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_SHADER
tgsi_dump(p->pipe.tokens, 0);
#endif
diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index f548836a9c4..25dcaaea14f 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -20,8 +20,6 @@
* SOFTWARE.
*/
-/* #define NV50_TGSI2NC_DEBUG */
-
#include <unistd.h>
#include "nv50_context.h"
@@ -213,7 +211,7 @@ static INLINE void
bld_warn_uninitialized(struct bld_context *bld, int kind,
struct bld_value_stack *stk, struct nv_basic_block *b)
{
-#ifdef NV50_TGSI2NC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
long i = (stk - &bld->tvs[0][0]) / 4;
long c = (stk - &bld->tvs[0][0]) & 3;
@@ -1562,7 +1560,7 @@ bld_instruction(struct bld_context *bld,
int c;
uint opcode = translate_opcode(insn->Instruction.Opcode);
-#ifdef NV50_TGSI2NC_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
debug_printf("bld_instruction:"); tgsi_dump_instruction(insn, 1);
#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h
index 102997e4fcb..f97141dd46e 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nvc0/nvc0_context.h
@@ -1,7 +1,6 @@
#ifndef __NVC0_CONTEXT_H__
#define __NVC0_CONTEXT_H__
-#include <stdio.h>
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
@@ -13,6 +12,7 @@
#include "draw/draw_vertex.h"
+#include "nv50/nv50_debug.h"
#include "nvc0_winsys.h"
#include "nvc0_stateobj.h"
#include "nvc0_screen.h"
@@ -26,15 +26,6 @@
#include "nvc0_2d.xml.h"
#include "nvc0_m2mf.xml.h"
-#define NOUVEAU_ERR(fmt, args...) \
- fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args);
-
-#ifdef NOUVEAU_DEBUG
-# define NOUVEAU_DBG(args...) printf(args);
-#else
-# define NOUVEAU_DBG(args...)
-#endif
-
#define NVC0_NEW_BLEND (1 << 0)
#define NVC0_NEW_RASTERIZER (1 << 1)
#define NVC0_NEW_ZSA (1 << 2)
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.c b/src/gallium/drivers/nvc0/nvc0_pc.c
index bd85a7f1ffd..2c3b8555f32 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc.c
@@ -20,8 +20,6 @@
* SOFTWARE.
*/
-#define NOUVEAU_DEBUG 1
-
#include "nvc0_pc.h"
#include "nvc0_program.h"
@@ -262,7 +260,7 @@ nvc0_print_program(struct nv_pc *pc)
nvc0_print_function(pc->root[i]);
}
-#if NOUVEAU_DEBUG > 1
+#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
static void
nv_do_print_cfgraph(struct nv_pc *pc, FILE *f, struct nv_basic_block *b)
{
@@ -327,7 +325,7 @@ nvc0_pc_print_binary(struct nv_pc *pc)
{
unsigned i;
- NOUVEAU_DBG("nvc0_pc_print_binary(%u ops)\n", pc->emit_size / 8);
+ NV50_DBGMSG(SHADER, "nvc0_pc_print_binary(%u ops)\n", pc->emit_size / 8);
for (i = 0; i < pc->emit_size / 4; i += 2) {
debug_printf("0x%08x ", pc->emit[i + 0]);
@@ -344,7 +342,7 @@ nvc0_emit_program(struct nv_pc *pc)
uint32_t *code = pc->emit;
int n;
- NOUVEAU_DBG("emitting program: size = %u\n", pc->emit_size);
+ NV50_DBGMSG(SHADER, "emitting program: size = %u\n", pc->emit_size);
pc->emit_pos = 0;
for (n = 0; n < pc->num_blocks; ++n) {
@@ -365,11 +363,10 @@ nvc0_emit_program(struct nv_pc *pc)
pc->emit = code;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_SHADER
nvc0_pc_print_binary(pc);
-#else
- debug_printf("not printing binary\n");
#endif
+
return 0;
}
@@ -396,7 +393,7 @@ nvc0_generate_code(struct nvc0_translation_info *ti)
ret = nvc0_tgsi_to_nc(pc, ti);
if (ret)
goto out;
-#if NOUVEAU_DEBUG > 1
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nvc0_print_program(pc);
#endif
@@ -406,7 +403,7 @@ nvc0_generate_code(struct nvc0_translation_info *ti)
ret = nvc0_pc_exec_pass0(pc);
if (ret)
goto out;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nvc0_print_program(pc);
#endif
@@ -414,7 +411,7 @@ nvc0_generate_code(struct nvc0_translation_info *ti)
ret = nvc0_pc_exec_pass1(pc);
if (ret)
goto out;
-#if NOUVEAU_DEBUG > 1
+#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
nvc0_print_program(pc);
nv_print_cfgraph(pc, "nvc0_shader_cfgraph.dot", 0);
#endif
@@ -444,7 +441,7 @@ nvc0_generate_code(struct nvc0_translation_info *ti)
ti->prog->relocs = pc->reloc_entries;
ti->prog->num_relocs = pc->num_relocs;
- NOUVEAU_DBG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success");
+ NV50_DBGMSG(SHADER, "SHADER TRANSLATION - %s\n", ret ? "failed" : "success");
out:
nv_pc_free_refs(pc);
@@ -573,7 +570,7 @@ nvc0_insn_delete(struct nv_instruction *nvi)
if (nvi == b->phi) {
if (nvi->opcode != NV_OP_PHI)
- NOUVEAU_DBG("NOTE: b->phi points to non-PHI instruction\n");
+ NV50_DBGMSG(PROG_IR, "NOTE: b->phi points to non-PHI instruction\n");
assert(!nvi->prev);
if (!nvi->next || nvi->next->opcode != NV_OP_PHI)
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.h b/src/gallium/drivers/nvc0/nvc0_pc.h
index 3a5612a5fac..441692d766c 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc.h
+++ b/src/gallium/drivers/nvc0/nvc0_pc.h
@@ -23,20 +23,7 @@
#ifndef __NVC0_COMPILER_H__
#define __NVC0_COMPILER_H__
-#include <stdio.h>
-
-#ifndef NOUVEAU_DBG
-#ifdef NOUVEAU_DEBUG
-# define NOUVEAU_DBG(args...) debug_printf(args);
-#else
-# define NOUVEAU_DBG(args...)
-#endif
-#endif
-
-#ifndef NOUVEAU_ERR
-#define NOUVEAU_ERR(fmt, args...) \
- fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args);
-#endif
+#include "nv50/nv50_debug.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_emit.c b/src/gallium/drivers/nvc0/nvc0_pc_emit.c
index 6f409a9e925..e35653280a1 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc_emit.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc_emit.c
@@ -879,7 +879,9 @@ emit_st(struct nv_pc *pc, struct nv_instruction *i)
void
nvc0_emit_instruction(struct nv_pc *pc, struct nv_instruction *i)
{
+#if NV50_DEBUG & NV50_DEBUG_SHADER
debug_printf("EMIT: "); nvc0_print_instruction(i);
+#endif
switch (i->opcode) {
case NV_OP_VFETCH:
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_optimize.c b/src/gallium/drivers/nvc0/nvc0_pc_optimize.c
index f7bf1680d09..7f5fbaff690 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc_optimize.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc_optimize.c
@@ -115,7 +115,7 @@ inst_is_noop(struct nv_instruction *nvi)
return FALSE;
if (nvi->src[0]->value->join->reg.id < 0) {
- NOUVEAU_DBG("inst_is_noop: orphaned value detected\n");
+ NV50_DBGMSG(PROG_IR, "inst_is_noop: orphaned value detected\n");
return TRUE;
}
@@ -178,7 +178,7 @@ nv_pc_pass_pre_emission(void *priv, struct nv_basic_block *b)
}
pc->emit_size += b->emit_size;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
if (!b->entry)
debug_printf("BB:%i is now empty\n", b->id);
else
@@ -206,7 +206,7 @@ nvc0_pc_exec_pass2(struct nv_pc *pc)
{
int i, ret;
- NOUVEAU_DBG("preparing %u blocks for emission\n", pc->num_blocks);
+ NV50_DBGMSG(PROG_IR, "preparing %u blocks for emission\n", pc->num_blocks);
pc->num_blocks = 0; /* will reorder bb_list */
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c b/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
index 0515a0d77eb..15bebb2134a 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-#define NOUVEAU_DEBUG 1
-
-/* #define NVC0_RA_DEBUG_LIVEI */
-/* #define NVC0_RA_DEBUG_LIVE_SETS */
-/* #define NVC0_RA_DEBUG_JOIN */
+#if NV50_DEBUG & NV50_DEBUG_PROG_RA
+# define NVC0_RA_DEBUG_LIVEI
+# define NVC0_RA_DEBUG_LIVE_SETS
+# define NVC0_RA_DEBUG_JOIN
+#endif
#include "nvc0_pc.h"
#include "util/u_simple_list.h"
@@ -967,7 +967,7 @@ nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
struct nv_pc_pass *ctx;
int i, ret;
- NOUVEAU_DBG("REGISTER ALLOCATION - entering\n");
+ NV50_DBGMSG(PROG_RA, "REGISTER ALLOCATION - entering\n");
ctx = CALLOC_STRUCT(nv_pc_pass);
if (!ctx)
@@ -1033,7 +1033,7 @@ nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
for (i = 0; i < pc->num_values; ++i)
livei_release(&pc->values[i]);
- NOUVEAU_DBG("REGISTER ALLOCATION - leaving\n");
+ NV50_DBGMSG(PROG_RA, "REGISTER ALLOCATION - leaving\n");
out:
FREE(ctx->insns);
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
index 383bc30f20b..bcee027917e 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -23,8 +23,6 @@
#include "pipe/p_shader_tokens.h"
#include "pipe/p_defines.h"
-#define NOUVEAU_DEBUG
-
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
#include "tgsi/tgsi_dump.h"
@@ -577,7 +575,7 @@ nvc0_prog_scan(struct nvc0_translation_info *ti)
int ret;
unsigned i;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_SHADER
tgsi_dump(prog->pipe.tokens, 0);
#endif
@@ -694,12 +692,12 @@ nvc0_program_translate(struct nvc0_program *prog)
if (ret)
NOUVEAU_ERR("shader translation failed\n");
- {
- unsigned i;
- for (i = 0; i < sizeof(prog->hdr) / sizeof(prog->hdr[0]); ++i)
- debug_printf("HDR[%02lx] = 0x%08x\n",
- i * sizeof(prog->hdr[0]), prog->hdr[i]);
- }
+#if NV50_DEBUG & NV50_DEBUG_SHADER
+ unsigned i;
+ for (i = 0; i < sizeof(prog->hdr) / sizeof(prog->hdr[0]); ++i)
+ debug_printf("HDR[%02lx] = 0x%08x\n",
+ i * sizeof(prog->hdr[0]), prog->hdr[i]);
+#endif
out:
if (ti->immd32)
diff --git a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
index 53fd7e70fc9..d57be916696 100644
--- a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
+++ b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
@@ -22,8 +22,6 @@
#include <unistd.h>
-#define NOUVEAU_DEBUG 1
-
#include "pipe/p_shader_tokens.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
@@ -200,7 +198,7 @@ static INLINE void
bld_warn_uninitialized(struct bld_context *bld, int kind,
struct bld_register *reg, struct nv_basic_block *b)
{
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_SHADER
long i = (reg - &bld->tvs[0][0]) / 4;
long c = (reg - &bld->tvs[0][0]) & 3;
@@ -1471,7 +1469,7 @@ bld_instruction(struct bld_context *bld,
uint opcode = translate_opcode(insn->Instruction.Opcode);
uint8_t mask = insn->Dst[0].Register.WriteMask;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
debug_printf("bld_instruction:"); tgsi_dump_instruction(insn, 1);
#endif