cell_flush.c File Reference

Include dependency graph for cell_flush.c:

Go to the source code of this file.

Functions

void cell_flush (struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence)
 Called via pipe->flush().
void cell_flush_int (struct cell_context *cell, unsigned flags)
 Cell internal flush function.
void cell_flush_buffer_range (struct cell_context *cell, void *ptr, unsigned size)


Function Documentation

void cell_flush ( struct pipe_context pipe,
unsigned  flags,
struct pipe_fence_handle **  fence 
)

Called via pipe->flush().

Definition at line 41 of file cell_flush.c.

References cell_context(), cell_flush_int(), CELL_FLUSH_WAIT, cell_context::draw, draw_flush(), and PIPE_FLUSH_SWAPBUFFERS.

00043 {
00044    struct cell_context *cell = cell_context(pipe);
00045 
00046    if (fence) {
00047       *fence = NULL;
00048       /* XXX: Implement real fencing */
00049       flags |= CELL_FLUSH_WAIT;
00050    }
00051 
00052    if (flags & PIPE_FLUSH_SWAPBUFFERS)
00053       flags |= CELL_FLUSH_WAIT;
00054 
00055    draw_flush( cell->draw );
00056    cell_flush_int(cell, flags);
00057 }

void cell_flush_buffer_range ( struct cell_context cell,
void *  ptr,
unsigned  size 
)

Definition at line 101 of file cell_flush.c.

References cell_buffer_range::base, cell_batch_append(), CELL_CMD_FLUSH_BUFFER_RANGE, ROUNDUP8, and cell_buffer_range::size.

00103 {
00104    uint64_t batch[1 + (ROUNDUP8(sizeof(struct cell_buffer_range)) / 8)];
00105    struct cell_buffer_range *br = (struct cell_buffer_range *) & batch[1];
00106 
00107    batch[0] = CELL_CMD_FLUSH_BUFFER_RANGE;
00108    br->base = (uintptr_t) ptr;
00109    br->size = size;
00110    cell_batch_append(cell, batch, sizeof(batch));
00111 }

void cell_flush_int ( struct cell_context cell,
unsigned  flags 
)

Cell internal flush function.

Send the current batch buffer to all SPUs. If flags & CELL_FLUSH_WAIT, do not return until the SPUs are idle.

Parameters:
flags bitmask of flags CELL_FLUSH_WAIT, or zero

Definition at line 66 of file cell_flush.c.

References assert, ASSERT, cell_batch_alloc(), cell_batch_flush(), CELL_CMD_FINISH, CELL_FLUSH_WAIT, cell_global, FALSE, cell_context::num_spus, send_mbox_message(), cell_global_info::spe_contexts, TRUE, and wait_mbox_message().

00067 {
00068    static boolean flushing = FALSE;  /* recursion catcher */
00069    uint i;
00070 
00071    ASSERT(!flushing);
00072    flushing = TRUE;
00073 
00074    if (flags & CELL_FLUSH_WAIT) {
00075       uint64_t *cmd = (uint64_t *) cell_batch_alloc(cell, sizeof(uint64_t));
00076       *cmd = CELL_CMD_FINISH;
00077    }
00078 
00079    cell_batch_flush(cell);
00080 
00081 #if 0
00082    /* Send CMD_FINISH to all SPUs */
00083    for (i = 0; i < cell->num_spus; i++) {
00084       send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_FINISH);
00085    }
00086 #endif
00087 
00088    if (flags & CELL_FLUSH_WAIT) {
00089       /* Wait for ack */
00090       for (i = 0; i < cell->num_spus; i++) {
00091          uint k = wait_mbox_message(cell_global.spe_contexts[i]);
00092          assert(k == CELL_CMD_FINISH);
00093       }
00094    }
00095 
00096    flushing = FALSE;
00097 }


Generated on Tue Sep 29 06:25:30 2009 for Gallium3D by  doxygen 1.5.4