summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/cell/spu
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-10-15 20:46:43 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-10-15 20:56:55 -0600
commit0116ee1d1c341726b6ed23c2dddc4515e8a34385 (patch)
tree33307d93cbb261ebd4b707b53380b371b66937c3 /src/gallium/drivers/cell/spu
parent1c915b14a545ffb10cc1c98cc69f997b6471617f (diff)
cell: start some performance measurements
Use the spu_write_decrementer() and spu_read_decrementer() functions to measure time. Convert to milliseconds according to the system timebase value.
Diffstat (limited to 'src/gallium/drivers/cell/spu')
-rw-r--r--src/gallium/drivers/cell/spu/spu_command.c15
-rw-r--r--src/gallium/drivers/cell/spu/spu_render.c9
2 files changed, 23 insertions, 1 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_command.c b/src/gallium/drivers/cell/spu/spu_command.c
index d2c282a022..57d265fef7 100644
--- a/src/gallium/drivers/cell/spu/spu_command.c
+++ b/src/gallium/drivers/cell/spu/spu_command.c
@@ -670,6 +670,8 @@ cmd_batch(uint opcode)
}
+#define PERF 0
+
/**
* Main loop for SPEs: Get a command, execute it, repeat.
@@ -678,6 +680,7 @@ void
command_loop(void)
{
int exitFlag = 0;
+ uint t0, t1;
D_PRINTF(CELL_DEBUG_CMD, "Enter command loop\n");
@@ -686,10 +689,16 @@ command_loop(void)
D_PRINTF(CELL_DEBUG_CMD, "Wait for cmd...\n");
+ if (PERF)
+ spu_write_decrementer(~0);
+
/* read/wait from mailbox */
opcode = (unsigned int) spu_read_in_mbox();
D_PRINTF(CELL_DEBUG_CMD, "got cmd 0x%x\n", opcode);
+ if (PERF)
+ t0 = spu_read_decrementer();
+
switch (opcode & CELL_CMD_OPCODE_MASK) {
case CELL_CMD_EXIT:
D_PRINTF(CELL_DEBUG_CMD, "EXIT\n");
@@ -707,6 +716,12 @@ command_loop(void)
printf("Bad opcode 0x%x!\n", opcode & CELL_CMD_OPCODE_MASK);
}
+ if (PERF) {
+ t1 = spu_read_decrementer();
+ printf("wait mbox time: %gms batch time: %gms\n",
+ (~0u - t0) * spu.init.inv_timebase,
+ (t0 - t1) * spu.init.inv_timebase);
+ }
}
D_PRINTF(CELL_DEBUG_CMD, "Exit command loop\n");
diff --git a/src/gallium/drivers/cell/spu/spu_render.c b/src/gallium/drivers/cell/spu/spu_render.c
index 802455bf79..5515bb55c9 100644
--- a/src/gallium/drivers/cell/spu/spu_render.c
+++ b/src/gallium/drivers/cell/spu/spu_render.c
@@ -175,6 +175,7 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
const ubyte *vertices;
const ushort *indexes;
uint i, j;
+ uint num_tiles;
D_PRINTF(CELL_DEBUG_CMD,
"RENDER prim=%u num_vert=%u num_ind=%u inline_vert=%u\n",
@@ -242,6 +243,8 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
wait_on_mask(1 << TAG_SURFACE_CLEAR); /* XXX temporary */
+ num_tiles = 0;
+
/**
** loop over tiles, rendering tris
**/
@@ -255,6 +258,8 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
if (!my_tile(tx, ty))
continue;
+ num_tiles++;
+
spu.cur_ctile_status = spu.ctile_status[ty][tx];
spu.cur_ztile_status = spu.ztile_status[ty][tx];
@@ -284,5 +289,7 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
spu.ztile_status[ty][tx] = spu.cur_ztile_status;
}
- D_PRINTF(CELL_DEBUG_CMD, "RENDER done\n");
+ D_PRINTF(CELL_DEBUG_CMD,
+ "RENDER done (%u tiles hit)\n",
+ num_tiles);
}