summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2008-03-26 09:36:40 +0000
committerMichel Dänzer <[email protected]>2008-03-26 09:36:40 +0000
commit4abe1eb980ed76d2b2d3383eaab520d0aa2ae6f4 (patch)
tree82ef00b79a812d6380b023e1da1a24c34437d66e /src/gallium/drivers
parente55dccd0bfc41dbcf306f864c01758f8e28fc660 (diff)
gallium: Change pipe->flush() interface to optionally return a fence.
The cell driver still uses an internal CELL_FLUSH_WAIT flag, in the long run proper fencing should be implemented for it.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_flush.c15
-rw-r--r--src/gallium/drivers/cell/ppu/cell_flush.h5
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vbuf.c2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vertex_shader.c2
-rw-r--r--src/gallium/drivers/failover/fo_context.c4
-rw-r--r--src/gallium/drivers/i915simple/i915_batch.h4
-rw-r--r--src/gallium/drivers/i915simple/i915_blit.c4
-rw-r--r--src/gallium/drivers/i915simple/i915_flush.c14
-rw-r--r--src/gallium/drivers/i915simple/i915_prim_emit.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_prim_vbuf.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_state_emit.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_winsys.h5
-rw-r--r--src/gallium/drivers/i965simple/brw_flush.c13
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c10
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.h4
15 files changed, 44 insertions, 44 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_flush.c b/src/gallium/drivers/cell/ppu/cell_flush.c
index 66a5627d844..3aaf3de6684 100644
--- a/src/gallium/drivers/cell/ppu/cell_flush.c
+++ b/src/gallium/drivers/cell/ppu/cell_flush.c
@@ -35,12 +35,19 @@
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);
@@ -58,7 +65,7 @@ cell_flush_int(struct pipe_context *pipe, unsigned flags)
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 +79,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]);
diff --git a/src/gallium/drivers/cell/ppu/cell_flush.h b/src/gallium/drivers/cell/ppu/cell_flush.h
index 7f940ae76b6..8f0645c4293 100644
--- a/src/gallium/drivers/cell/ppu/cell_flush.h
+++ b/src/gallium/drivers/cell/ppu/cell_flush.h
@@ -29,8 +29,11 @@
#ifndef CELL_FLUSH
#define CELL_FLUSH
+#define CELL_FLUSH_WAIT 0x80000000
+
extern void
-cell_flush(struct pipe_context *pipe, unsigned flags);
+cell_flush(struct pipe_context *pipe, unsigned flags,
+ struct pipe_fence_handle **fence);
extern void
cell_flush_int(struct pipe_context *pipe, unsigned flags);
diff --git a/src/gallium/drivers/cell/ppu/cell_vbuf.c b/src/gallium/drivers/cell/ppu/cell_vbuf.c
index cc727ff4edb..3a181b585c5 100644
--- a/src/gallium/drivers/cell/ppu/cell_vbuf.c
+++ b/src/gallium/drivers/cell/ppu/cell_vbuf.c
@@ -243,7 +243,7 @@ cell_vbuf_draw(struct vbuf_render *vbr,
#if 0
/* helpful for debug */
- cell_flush_int(&cell->pipe, PIPE_FLUSH_WAIT);
+ cell_flush_int(&cell->pipe, CELL_FLUSH_WAIT);
#endif
}
diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
index f5c27852c14..b418857ccd8 100644
--- a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
@@ -133,7 +133,7 @@ cell_vertex_shader_queue_flush(struct draw_context *draw)
vs->num_elts = n;
send_mbox_message(cell_global.spe_contexts[0], CELL_CMD_VS_EXECUTE);
- cell_flush_int(& cell->pipe, PIPE_FLUSH_WAIT);
+ cell_flush_int(& cell->pipe, CELL_FLUSH_WAIT);
}
draw->vs.post_nr = draw->vs.queue_nr;
diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index afc0d7eb1ec..cb95ba516f9 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -69,7 +69,7 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
start,
count )) {
- failover->hw->flush( failover->hw, ~0 );
+ failover->hw->flush( failover->hw, ~0, NULL );
failover->mode = FO_SW;
}
}
@@ -92,7 +92,7 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
* intervening flush. Unlikely to be much performance impact to
* this:
*/
- failover->sw->flush( failover->sw, ~0 );
+ failover->sw->flush( failover->sw, ~0, NULL );
}
return TRUE;
diff --git a/src/gallium/drivers/i915simple/i915_batch.h b/src/gallium/drivers/i915simple/i915_batch.h
index fb88cd6db0d..4ea06ce02bf 100644
--- a/src/gallium/drivers/i915simple/i915_batch.h
+++ b/src/gallium/drivers/i915simple/i915_batch.h
@@ -44,9 +44,9 @@
#define ADVANCE_BATCH()
-#define FLUSH_BATCH() do { \
+#define FLUSH_BATCH(fence) do { \
if (0) i915_dump_batchbuffer( i915 ); \
- i915->winsys->batch_flush( i915->winsys ); \
+ i915->winsys->batch_flush( i915->winsys, fence ); \
i915->batch_start = NULL; \
i915->hardware_dirty = ~0; \
} while (0)
diff --git a/src/gallium/drivers/i915simple/i915_blit.c b/src/gallium/drivers/i915simple/i915_blit.c
index db4671ff553..24449e3fb33 100644
--- a/src/gallium/drivers/i915simple/i915_blit.c
+++ b/src/gallium/drivers/i915simple/i915_blit.c
@@ -70,7 +70,7 @@ i915_fill_blit(struct i915_context *i915,
if (!BEGIN_BATCH(6, 1)) {
- FLUSH_BATCH();
+ FLUSH_BATCH(NULL);
assert(BEGIN_BATCH(6, 1));
}
OUT_BATCH(CMD);
@@ -145,7 +145,7 @@ i915_copy_blit( struct i915_context *i915,
if (!BEGIN_BATCH(8, 2)) {
- FLUSH_BATCH();
+ FLUSH_BATCH(NULL);
assert(BEGIN_BATCH(8, 2));
}
OUT_BATCH(CMD);
diff --git a/src/gallium/drivers/i915simple/i915_flush.c b/src/gallium/drivers/i915simple/i915_flush.c
index 96a54281f11..7d23e6b6b90 100644
--- a/src/gallium/drivers/i915simple/i915_flush.c
+++ b/src/gallium/drivers/i915simple/i915_flush.c
@@ -37,11 +37,9 @@
#include "i915_batch.h"
-/**
- * In future we may want a fence-like interface instead of finish.
- */
static void i915_flush( struct pipe_context *pipe,
- unsigned flags )
+ unsigned flags,
+ struct pipe_fence_handle **fence )
{
struct i915_context *i915 = i915_context(pipe);
@@ -60,7 +58,7 @@ static void i915_flush( struct pipe_context *pipe,
flush |= FLUSH_MAP_CACHE;
if (!BEGIN_BATCH(1, 0)) {
- FLUSH_BATCH();
+ FLUSH_BATCH(NULL);
assert(BEGIN_BATCH(1, 0));
}
OUT_BATCH( flush );
@@ -69,11 +67,7 @@ static void i915_flush( struct pipe_context *pipe,
/* If there are no flags, just flush pending commands to hardware:
*/
- FLUSH_BATCH();
-
- if (flags & PIPE_FLUSH_WAIT) {
- i915->winsys->batch_finish(i915->winsys);
- }
+ FLUSH_BATCH(fence);
}
diff --git a/src/gallium/drivers/i915simple/i915_prim_emit.c b/src/gallium/drivers/i915simple/i915_prim_emit.c
index d8de5178f60..b6fb0a6d88f 100644
--- a/src/gallium/drivers/i915simple/i915_prim_emit.c
+++ b/src/gallium/drivers/i915simple/i915_prim_emit.c
@@ -140,7 +140,7 @@ emit_prim( struct draw_stage *stage,
assert(vertex_size >= 12); /* never smaller than 12 bytes */
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
- FLUSH_BATCH();
+ FLUSH_BATCH(NULL);
/* Make sure state is re-emitted after a flush:
*/
diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c
index eb64f51943b..7fb2adbb53b 100644
--- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c
@@ -161,7 +161,7 @@ i915_vbuf_render_draw( struct vbuf_render *render,
i915_emit_hardware_state( i915 );
if (!BEGIN_BATCH( 1 + (nr_indices + 1)/2, 1 )) {
- FLUSH_BATCH();
+ FLUSH_BATCH(NULL);
/* Make sure state is re-emitted after a flush:
*/
diff --git a/src/gallium/drivers/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c
index a7498d22b7e..6f947d43468 100644
--- a/src/gallium/drivers/i915simple/i915_state_emit.c
+++ b/src/gallium/drivers/i915simple/i915_state_emit.c
@@ -115,7 +115,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
#endif
if(!BEGIN_BATCH(dwords, relocs)) {
- FLUSH_BATCH();
+ FLUSH_BATCH(NULL);
assert(BEGIN_BATCH(dwords, relocs));
}
diff --git a/src/gallium/drivers/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h
index aea30032818..5e16543f4ec 100644
--- a/src/gallium/drivers/i915simple/i915_winsys.h
+++ b/src/gallium/drivers/i915simple/i915_winsys.h
@@ -56,6 +56,7 @@ extern "C" {
*/
struct pipe_buffer;
+struct pipe_fence_handle;
struct pipe_winsys;
struct pipe_screen;
@@ -103,8 +104,8 @@ struct i915_winsys {
unsigned access_flags,
unsigned delta );
- void (*batch_flush)( struct i915_winsys *sws );
- void (*batch_finish)( struct i915_winsys *sws );
+ void (*batch_flush)( struct i915_winsys *sws,
+ struct pipe_fence_handle **fence );
};
#define I915_BUFFER_ACCESS_WRITE 0x1
diff --git a/src/gallium/drivers/i965simple/brw_flush.c b/src/gallium/drivers/i965simple/brw_flush.c
index 5216c680cf6..e6001c30d94 100644
--- a/src/gallium/drivers/i965simple/brw_flush.c
+++ b/src/gallium/drivers/i965simple/brw_flush.c
@@ -36,14 +36,11 @@
#include "brw_batch.h"
-/**
- * In future we may want a fence-like interface instead of finish.
- */
static void brw_flush( struct pipe_context *pipe,
- unsigned flags )
+ unsigned flags,
+ struct pipe_fence_handle **fence )
{
struct brw_context *brw = brw_context(pipe);
- struct pipe_fence_handle *fence;
/* Do we need to emit an MI_FLUSH command to flush the hardware
* caches?
@@ -65,11 +62,7 @@ static void brw_flush( struct pipe_context *pipe,
/* If there are no flags, just flush pending commands to hardware:
*/
- FLUSH_BATCH( &fence );
-
- if (flags & PIPE_FLUSH_WAIT) {
-// brw->winsys->wait_fence(brw->winsys, fence);
- }
+ FLUSH_BATCH( fence );
}
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 2cbd0d7cabe..0625b69099b 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -40,13 +40,10 @@
#include "sp_winsys.h"
-/* There will be actual work to do here. In future we may want a
- * fence-like interface instead of finish, and perhaps flush will take
- * flags to indicate what type of flush is required.
- */
void
softpipe_flush( struct pipe_context *pipe,
- unsigned flags )
+ unsigned flags,
+ struct pipe_fence_handle **fence )
{
struct softpipe_context *softpipe = softpipe_context(pipe);
uint i;
@@ -72,5 +69,8 @@ softpipe_flush( struct pipe_context *pipe,
* to unmap surfaces when flushing.
*/
softpipe_unmap_surfaces(softpipe);
+
+ if (fence)
+ *fence = NULL;
}
diff --git a/src/gallium/drivers/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h
index 34ec617866b..68d9b5fa835 100644
--- a/src/gallium/drivers/softpipe/sp_flush.h
+++ b/src/gallium/drivers/softpipe/sp_flush.h
@@ -29,7 +29,9 @@
#define SP_FLUSH_H
struct pipe_context;
+struct pipe_fence_handle;
-void softpipe_flush(struct pipe_context *pipe, unsigned flags );
+void softpipe_flush(struct pipe_context *pipe, unsigned flags,
+ struct pipe_fence_handle **fence);
#endif