diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-19 12:04:06 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-19 12:04:06 -0700 |
commit | a1f4a5e802ad62c88fca6834b9de1c83672230a6 (patch) | |
tree | 79f89f370a4d2b8197f313fe4ea7d081e386a916 /src/mesa/pipe/cell/spu | |
parent | 06b019d16bc20d772a8aed2a68d1c5d37a402a81 (diff) |
Cell: improve "finished copying batch buffer" signalling.
When the SPU is done copying a batch buffer to local store, use an mfc_put()
to write a "done" message back to the buffer status array in main memory.
We were previously using a mailbox message for synchronization.
Diffstat (limited to 'src/mesa/pipe/cell/spu')
-rw-r--r-- | src/mesa/pipe/cell/spu/spu_main.c | 38 | ||||
-rw-r--r-- | src/mesa/pipe/cell/spu/spu_main.h | 2 |
2 files changed, 37 insertions, 3 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/mesa/pipe/cell/spu/spu_main.c index 2727b03756..bff098f06e 100644 --- a/src/mesa/pipe/cell/spu/spu_main.c +++ b/src/mesa/pipe/cell/spu/spu_main.c @@ -396,6 +396,38 @@ cmd_finish(void) /** + * Tell the PPU that this SPU has finished copying a batch buffer to + * local store and that it may be reused by the PPU. + * This is done by writting a 16-byte batch-buffer-status block back into + * main memory (in cell_contex->buffer_status[]). + */ +static void +release_batch_buffer(uint buffer) +{ + /* Evidently, using less than a 16-byte status doesn't work reliably */ + static const uint status[4] ALIGN16_ATTRIB + = {CELL_BUFFER_STATUS_FREE, 0, 0, 0}; + + const uint index = 4 * (spu.init.id * CELL_NUM_BATCH_BUFFERS + buffer); + uint *dst = spu.init.buffer_status + index; + + ASSERT(buffer < CELL_NUM_BATCH_BUFFERS); + + /* + printf("SPU %u: Set batch status buf=%u, index %u, at %p to FREE\n", + spu.init.id, buffer, index, dst); + */ + + mfc_put((void *) &status, /* src in local memory */ + (unsigned int) dst, /* dst in main memory */ + sizeof(status), /* size */ + TAG_MISC, /* tag is unimportant */ + 0, /* tid */ + 0 /* rid */); +} + + +/** * Execute a batch of commands * The opcode param encodes the location of the buffer and its size. */ @@ -429,9 +461,9 @@ cmd_batch(uint opcode) 0 /* rid */); wait_on_mask(1 << TAG_BATCH_BUFFER); - /* send mbox message to indicate DMA completed */ - /* XXX temporary */ - spu_write_out_mbox(CELL_BATCH_FINISHED); + /* Tell PPU we're done copying the buffer to local store */ + release_batch_buffer(buf); + for (pos = 0; pos < usize; /* no incr */) { switch (buffer[pos]) { diff --git a/src/mesa/pipe/cell/spu/spu_main.h b/src/mesa/pipe/cell/spu/spu_main.h index 75fb5b388b..f39f375d24 100644 --- a/src/mesa/pipe/cell/spu/spu_main.h +++ b/src/mesa/pipe/cell/spu/spu_main.h @@ -76,6 +76,8 @@ extern struct spu_global spu; #define TAG_WRITE_TILE_Z 15 #define TAG_INDEX_BUFFER 16 #define TAG_BATCH_BUFFER 17 +#define TAG_MISC 18 + /** The standard assert macro doesn't seem to work on SPUs */ #define ASSERT(x) \ |