cell: remove unneeded blend/depth_stencil subclasses
[mesa.git] / src / gallium / drivers / cell / ppu / cell_flush.c
index f62bc4650ce2b27ea263694365e7e769ef109914..6596b7201011a5bcb14183437bc296dd0f5f93e9 100644 (file)
 #include "cell_flush.h"
 #include "cell_spu.h"
 #include "cell_render.h"
-#include "pipe/draw/draw_context.h"
+#include "draw/draw_context.h"
 
 
+/**
+ * Called via pipe->flush()
+ */
 void
-cell_flush(struct pipe_context *pipe, unsigned flags)
+cell_flush(struct pipe_context *pipe, unsigned flags,
+           struct pipe_fence_handle **fence)
 {
    struct cell_context *cell = cell_context(pipe);
 
+   if (fence) {
+      *fence = NULL;
+      /* XXX: Implement real fencing */
+      flags |= CELL_FLUSH_WAIT;
+   }
+
    if (flags & PIPE_FLUSH_SWAPBUFFERS)
-      flags |= PIPE_FLUSH_WAIT;
+      flags |= CELL_FLUSH_WAIT;
 
    draw_flush( cell->draw );
-   cell_flush_int(pipe, flags);
+   cell_flush_int(cell, flags);
 }
 
 
-/** internal flush */
+/**
+ * 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.
+ * \param flags  bitmask of flags CELL_FLUSH_WAIT, or zero
+ */
 void
-cell_flush_int(struct pipe_context *pipe, unsigned flags)
+cell_flush_int(struct cell_context *cell, unsigned flags)
 {
    static boolean flushing = FALSE;  /* recursion catcher */
-   struct cell_context *cell = cell_context(pipe);
    uint i;
 
    ASSERT(!flushing);
    flushing = TRUE;
 
-   if (flags & PIPE_FLUSH_WAIT) {
+   if (flags & CELL_FLUSH_WAIT) {
       uint64_t *cmd = (uint64_t *) cell_batch_alloc(cell, sizeof(uint64_t));
       *cmd = CELL_CMD_FINISH;
    }
@@ -72,7 +85,7 @@ cell_flush_int(struct pipe_context *pipe, unsigned flags)
    }
 #endif
 
-   if (flags & PIPE_FLUSH_WAIT) {
+   if (flags & CELL_FLUSH_WAIT) {
       /* Wait for ack */
       for (i = 0; i < cell->num_spus; i++) {
          uint k = wait_mbox_message(cell_global.spe_contexts[i]);
@@ -82,3 +95,17 @@ cell_flush_int(struct pipe_context *pipe, unsigned flags)
 
    flushing = FALSE;
 }
+
+
+void
+cell_flush_buffer_range(struct cell_context *cell, void *ptr,
+                       unsigned size)
+{
+   uint64_t batch[1 + (ROUNDUP8(sizeof(struct cell_buffer_range)) / 8)];
+   struct cell_buffer_range *br = (struct cell_buffer_range *) & batch[1];
+
+   batch[0] = CELL_CMD_FLUSH_BUFFER_RANGE;
+   br->base = (uintptr_t) ptr;
+   br->size = size;
+   cell_batch_append(cell, batch, sizeof(batch));
+}