summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-15 13:55:18 -0600
committerBrian Paul <[email protected]>2008-10-15 13:55:18 -0600
commitddeec1ed10d6c12403fe8d30c072ea68f044db99 (patch)
treeae7b571024a8417986fcad8ee30c659af1628cee /src
parent53951531ae7bfd64afae1ae55aac7f6ebd3fe4f5 (diff)
cell: simplify spu debug code
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/cell/common.h1
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c1
-rw-r--r--src/gallium/drivers/cell/spu/spu_command.c47
-rw-r--r--src/gallium/drivers/cell/spu/spu_debug.h9
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.c9
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.h15
-rw-r--r--src/gallium/drivers/cell/spu/spu_render.c7
7 files changed, 41 insertions, 48 deletions
diff --git a/src/gallium/drivers/cell/common.h b/src/gallium/drivers/cell/common.h
index 3b5a25e1656..8ae78265f2e 100644
--- a/src/gallium/drivers/cell/common.h
+++ b/src/gallium/drivers/cell/common.h
@@ -111,6 +111,7 @@
#define CELL_DEBUG_SYNC (1 << 2)
#define CELL_DEBUG_FRAGMENT_OPS (1 << 3)
#define CELL_DEBUG_FRAGMENT_OP_FALLBACK (1 << 4)
+#define CELL_DEBUG_CMD (1 << 5)
/** Max instructions for doing per-fragment operations */
#define SPU_MAX_FRAGMENT_OPS_INSTS 64
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index b66aa9c9d99..f8d5eef3ace 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -93,6 +93,7 @@ static const struct debug_named_value cell_debug_flags[] = {
{"sync", CELL_DEBUG_SYNC}, /**< SPUs do synchronous DMA */
{"fragops", CELL_DEBUG_FRAGMENT_OPS}, /**< SPUs emit fragment ops debug messages*/
{"fragopfallback", CELL_DEBUG_FRAGMENT_OP_FALLBACK}, /**< SPUs use reference implementation for fragment ops*/
+ {"cmd", CELL_DEBUG_CMD}, /**< SPUs dump command buffer info */
{NULL, 0}
};
diff --git a/src/gallium/drivers/cell/spu/spu_command.c b/src/gallium/drivers/cell/spu/spu_command.c
index b521c3aecfd..ebbed3d1dc0 100644
--- a/src/gallium/drivers/cell/spu/spu_command.c
+++ b/src/gallium/drivers/cell/spu/spu_command.c
@@ -44,7 +44,6 @@
#include "spu_tile.h"
#include "spu_vertex_shader.h"
#include "spu_dcache.h"
-#include "spu_debug.h"
#include "cell/common.h"
@@ -97,7 +96,7 @@ release_buffer(uint buffer)
static void
cmd_clear_surface(const struct cell_command_clear_surface *clear)
{
- DEBUG_PRINTF("CLEAR SURF %u to 0x%08x\n", clear->surface, clear->value);
+ D_PRINTF(CELL_DEBUG_CMD, "CLEAR SURF %u to 0x%08x\n", clear->surface, clear->value);
if (clear->surface == 0) {
spu.fb.color_clear_value = clear->value;
@@ -165,14 +164,14 @@ cmd_clear_surface(const struct cell_command_clear_surface *clear)
#endif /* CLEAR_OPT */
- DEBUG_PRINTF("CLEAR SURF done\n");
+ D_PRINTF(CELL_DEBUG_CMD, "CLEAR SURF done\n");
}
static void
cmd_release_verts(const struct cell_command_release_verts *release)
{
- DEBUG_PRINTF("RELEASE VERTS %u\n", release->vertex_buf);
+ D_PRINTF(CELL_DEBUG_CMD, "RELEASE VERTS %u\n", release->vertex_buf);
ASSERT(release->vertex_buf != ~0U);
release_buffer(release->vertex_buf);
}
@@ -189,7 +188,7 @@ cmd_state_fragment_ops(const struct cell_command_fragment_ops *fops)
{
static int warned = 0;
- DEBUG_PRINTF("CMD_STATE_FRAGMENT_OPS\n");
+ D_PRINTF(CELL_DEBUG_CMD, "CMD_STATE_FRAGMENT_OPS\n");
/* Copy SPU code from batch buffer to spu buffer */
memcpy(spu.fragment_ops_code, fops->code, SPU_MAX_FRAGMENT_OPS_INSTS * 4);
/* Copy state info (for fallback case only) */
@@ -229,7 +228,7 @@ cmd_state_fragment_ops(const struct cell_command_fragment_ops *fops)
static void
cmd_state_fragment_program(const struct cell_command_fragment_program *fp)
{
- DEBUG_PRINTF("CMD_STATE_FRAGMENT_PROGRAM\n");
+ D_PRINTF(CELL_DEBUG_CMD, "CMD_STATE_FRAGMENT_PROGRAM\n");
/* Copy SPU code from batch buffer to spu buffer */
memcpy(spu.fragment_program_code, fp->code,
SPU_MAX_FRAGMENT_PROGRAM_INSTS * 4);
@@ -247,11 +246,11 @@ cmd_state_fs_constants(const uint64_t *buffer, uint pos)
const float *constants = (const float *) &buffer[pos + 2];
uint i;
- DEBUG_PRINTF("CMD_STATE_FS_CONSTANTS (%u)\n", num_const);
+ D_PRINTF(CELL_DEBUG_CMD, "CMD_STATE_FS_CONSTANTS (%u)\n", num_const);
/* Expand each float to float[4] for SOA execution */
for (i = 0; i < num_const; i++) {
- DEBUG_PRINTF(" const[%u] = %f\n", i, constants[i]);
+ D_PRINTF(CELL_DEBUG_CMD, " const[%u] = %f\n", i, constants[i]);
spu.constants[i] = spu_splats(constants[i]);
}
@@ -263,7 +262,7 @@ cmd_state_fs_constants(const uint64_t *buffer, uint pos)
static void
cmd_state_framebuffer(const struct cell_command_framebuffer *cmd)
{
- DEBUG_PRINTF("FRAMEBUFFER: %d x %d at %p, cformat 0x%x zformat 0x%x\n",
+ D_PRINTF(CELL_DEBUG_CMD, "FRAMEBUFFER: %d x %d at %p, cformat 0x%x zformat 0x%x\n",
cmd->width,
cmd->height,
cmd->color_start,
@@ -352,7 +351,7 @@ cmd_state_sampler(const struct cell_command_sampler *sampler)
{
uint unit = sampler->unit;
- DEBUG_PRINTF("SAMPLER [%u]\n", unit);
+ D_PRINTF(CELL_DEBUG_CMD, "SAMPLER [%u]\n", unit);
spu.sampler[unit] = sampler->state;
@@ -404,9 +403,7 @@ cmd_state_texture(const struct cell_command_texture *texture)
const uint unit = texture->unit;
uint i;
- //if (spu.init.id==0) Debug=1;
-
- DEBUG_PRINTF("TEXTURE [%u]\n", texture->unit);
+ D_PRINTF(CELL_DEBUG_CMD, "TEXTURE [%u]\n", texture->unit);
spu.texture[unit].max_level = 0;
spu.texture[unit].target = texture->target;
@@ -416,7 +413,7 @@ cmd_state_texture(const struct cell_command_texture *texture)
uint height = texture->height[i];
uint depth = texture->depth[i];
- DEBUG_PRINTF(" LEVEL %u: at %p size[0] %u x %u\n", i,
+ D_PRINTF(CELL_DEBUG_CMD, " LEVEL %u: at %p size[0] %u x %u\n", i,
texture->start[i], texture->width[i], texture->height[i]);
spu.texture[unit].level[i].start = texture->start[i];
@@ -438,15 +435,13 @@ cmd_state_texture(const struct cell_command_texture *texture)
}
update_tex_masks(&spu.texture[unit], &spu.sampler[unit], unit);
-
- //Debug=0;
}
static void
cmd_state_vertex_info(const struct vertex_info *vinfo)
{
- DEBUG_PRINTF("VERTEX_INFO num_attribs=%u\n", vinfo->num_attribs);
+ D_PRINTF(CELL_DEBUG_CMD, "VERTEX_INFO num_attribs=%u\n", vinfo->num_attribs);
ASSERT(vinfo->num_attribs >= 1);
ASSERT(vinfo->num_attribs <= 8);
memcpy(&spu.vertex_info, vinfo, sizeof(*vinfo));
@@ -485,7 +480,7 @@ cmd_state_attrib_fetch(const struct cell_attribute_fetch_code *code)
static void
cmd_finish(void)
{
- DEBUG_PRINTF("FINISH\n");
+ D_PRINTF(CELL_DEBUG_CMD, "FINISH\n");
really_clear_tiles(0);
/* wait for all outstanding DMAs to finish */
mfc_write_tag_mask(~0);
@@ -510,7 +505,7 @@ cmd_batch(uint opcode)
const unsigned usize = size / sizeof(buffer[0]);
uint pos;
- DEBUG_PRINTF("BATCH buffer %u, len %u, from %p\n",
+ D_PRINTF(CELL_DEBUG_CMD, "BATCH buffer %u, len %u, from %p\n",
buf, size, spu.init.buffers[buf]);
ASSERT((opcode & CELL_CMD_OPCODE_MASK) == CELL_CMD_BATCH);
@@ -530,7 +525,7 @@ cmd_batch(uint opcode)
wait_on_mask(1 << TAG_BATCH_BUFFER);
/* Tell PPU we're done copying the buffer to local store */
- DEBUG_PRINTF("release batch buf %u\n", buf);
+ D_PRINTF(CELL_DEBUG_CMD, "release batch buf %u\n", buf);
release_buffer(buf);
/*
@@ -663,7 +658,7 @@ cmd_batch(uint opcode)
}
}
- DEBUG_PRINTF("BATCH complete\n");
+ D_PRINTF(CELL_DEBUG_CMD, "BATCH complete\n");
}
@@ -677,7 +672,7 @@ command_loop(void)
struct cell_command cmd;
int exitFlag = 0;
- DEBUG_PRINTF("Enter command loop\n");
+ D_PRINTF(CELL_DEBUG_CMD, "Enter command loop\n");
ASSERT((sizeof(struct cell_command) & 0xf) == 0);
ASSERT_ALIGN16(&cmd);
@@ -686,12 +681,12 @@ command_loop(void)
unsigned opcode;
int tag = 0;
- DEBUG_PRINTF("Wait for cmd...\n");
+ D_PRINTF(CELL_DEBUG_CMD, "Wait for cmd...\n");
/* read/wait from mailbox */
opcode = (unsigned int) spu_read_in_mbox();
- DEBUG_PRINTF("got cmd 0x%x\n", opcode);
+ D_PRINTF(CELL_DEBUG_CMD, "got cmd 0x%x\n", opcode);
/* command payload */
mfc_get(&cmd, /* dest */
@@ -708,7 +703,7 @@ command_loop(void)
switch (opcode & CELL_CMD_OPCODE_MASK) {
case CELL_CMD_EXIT:
- DEBUG_PRINTF("EXIT\n");
+ D_PRINTF(CELL_DEBUG_CMD, "EXIT\n");
exitFlag = 1;
break;
case CELL_CMD_VS_EXECUTE:
@@ -725,7 +720,7 @@ command_loop(void)
}
- DEBUG_PRINTF("Exit command loop\n");
+ D_PRINTF(CELL_DEBUG_CMD, "Exit command loop\n");
spu_dcache_report();
}
diff --git a/src/gallium/drivers/cell/spu/spu_debug.h b/src/gallium/drivers/cell/spu/spu_debug.h
index eeec0526558..25653dcdcd2 100644
--- a/src/gallium/drivers/cell/spu/spu_debug.h
+++ b/src/gallium/drivers/cell/spu/spu_debug.h
@@ -30,28 +30,19 @@
#define SPU_DEBUG_H
-/* Set to 0 to disable all extraneous debugging code */
-#define DEBUG 1
-
#if DEBUG
-extern boolean Debug;
-extern boolean force_fragment_ops_fallback;
/* These debug macros use the unusual construction ", ##__VA_ARGS__"
* which expands to the expected comma + args if variadic arguments
* are supplied, but swallows the comma if there are no variadic
* arguments (which avoids syntax errors that would otherwise occur).
*/
-#define DEBUG_PRINTF(format,...) \
- if (Debug) \
- printf("SPU %u: " format, spu.init.id, ##__VA_ARGS__)
#define D_PRINTF(flag, format,...) \
if (spu.init.debug_flags & (flag)) \
printf("SPU %u: " format, spu.init.id, ##__VA_ARGS__)
#else
-#define DEBUG_PRINTF(...)
#define D_PRINTF(...)
#endif
diff --git a/src/gallium/drivers/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c
index 4becd0f92a4..c8bb2519050 100644
--- a/src/gallium/drivers/cell/spu/spu_main.c
+++ b/src/gallium/drivers/cell/spu/spu_main.c
@@ -40,7 +40,6 @@
#include "spu_per_fragment_op.h"
#include "spu_texture.h"
//#include "spu_test.h"
-#include "spu_debug.h"
#include "cell/common.h"
@@ -53,12 +52,6 @@ helpful headers:
struct spu_global spu;
-#if DEBUG
-boolean Debug = FALSE;
-boolean force_fragment_ops_fallback = TRUE;
-#endif
-
-
static void
one_time_init(void)
{
@@ -102,7 +95,7 @@ main(main_param_t speid, main_param_t argp)
one_time_init();
- DEBUG_PRINTF("main() speid=%lu\n", (unsigned long) speid);
+ D_PRINTF(CELL_DEBUG_CMD, "main() speid=%lu\n", (unsigned long) speid);
D_PRINTF(CELL_DEBUG_FRAGMENT_OP_FALLBACK, "using fragment op fallback\n");
/* get initialization data */
diff --git a/src/gallium/drivers/cell/spu/spu_main.h b/src/gallium/drivers/cell/spu/spu_main.h
index ca72baea8b3..569b9e45d42 100644
--- a/src/gallium/drivers/cell/spu/spu_main.h
+++ b/src/gallium/drivers/cell/spu/spu_main.h
@@ -36,6 +36,19 @@
#include "pipe/p_state.h"
+#if DEBUG
+/* These debug macros use the unusual construction ", ##__VA_ARGS__"
+ * which expands to the expected comma + args if variadic arguments
+ * are supplied, but swallows the comma if there are no variadic
+ * arguments (which avoids syntax errors that would otherwise occur).
+ */
+#define D_PRINTF(flag, format,...) \
+ if (spu.init.debug_flags & (flag)) \
+ printf("SPU %u: " format, spu.init.id, ##__VA_ARGS__)
+#else
+#define D_PRINTF(...)
+#endif
+
#define MAX_WIDTH 1024
#define MAX_HEIGHT 1024
@@ -187,8 +200,6 @@ struct spu_global
extern struct spu_global spu;
-extern boolean Debug;
-
diff --git a/src/gallium/drivers/cell/spu/spu_render.c b/src/gallium/drivers/cell/spu/spu_render.c
index 82dbeb26b76..cfff19b6c0e 100644
--- a/src/gallium/drivers/cell/spu/spu_render.c
+++ b/src/gallium/drivers/cell/spu/spu_render.c
@@ -177,7 +177,7 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
uint i, j;
- if (Debug) {
+#if 0
printf("SPU %u: RENDER prim %u, num_vert=%u num_ind=%u "
"inline_vert=%u\n",
spu.init.id,
@@ -190,7 +190,7 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
printf(" bound: %g, %g .. %g, %g\n",
render->xmin, render->ymin, render->xmax, render->ymax);
*/
- }
+#endif
ASSERT(sizeof(*render) % 4 == 0);
ASSERT(total_vertex_bytes % 16 == 0);
@@ -293,7 +293,8 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
spu.ztile_status[ty][tx] = spu.cur_ztile_status;
}
- if (Debug)
+#if 0
printf("SPU %u: RENDER done\n",
spu.init.id);
+#endif
}