diff options
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_context.h | 11 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_pc.c | 23 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_pc.h | 15 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_pc_emit.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_pc_optimize.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_pc_regalloc.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_program.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c | 6 |
8 files changed, 33 insertions, 60 deletions
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 |