summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2007-11-21 15:38:28 +1100
committerBen Skeggs <skeggsb@gmail.com>2007-11-21 15:38:28 +1100
commitaf1a38893946cf2fabd0fc6956efd07ef15b954b (patch)
tree32802116388e3fd0e49e524b172fba04b6fc6710 /src/mesa/drivers
parent0655cdcf48daecbe10ff8c16c443686a64848d1b (diff)
parent5a6017d496ccce94d7e3cf9a6cfe1db886dcc767 (diff)
Merge branch 'upstream-gallium-0.1' into darktama-gallium-0.1
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c14
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h2
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys.h17
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c60
4 files changed, 70 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c
index 49e04d81ec..ed223977e2 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c
@@ -307,20 +307,6 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch)
}
-void
-intel_batchbuffer_finish(struct intel_batchbuffer *batch)
-{
- struct _DriFenceObject *fence = intel_batchbuffer_flush(batch);
- if (fence) {
- driFenceReference(fence);
- driFenceFinish(fence,
- DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
- GL_FALSE);
- driFenceUnReference(fence);
- }
-}
-
-
/* This is the only way buffers get added to the validate list.
*/
boolean
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h
index 82feafa21f..2c943e68e5 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h
@@ -72,8 +72,6 @@ struct intel_batchbuffer *intel_batchbuffer_alloc(struct intel_context *intel);
void intel_batchbuffer_free(struct intel_batchbuffer *batch);
-void intel_batchbuffer_finish(struct intel_batchbuffer *batch);
-
struct _DriFenceObject *intel_batchbuffer_flush(struct intel_batchbuffer
*batch);
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h b/src/mesa/drivers/dri/intel_winsys/intel_winsys.h
index 89e63e0a79..f944cd23c3 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys.h
@@ -32,7 +32,9 @@ struct intel_context;
struct pipe_context;
struct pipe_winsys;
struct pipe_buffer_handle;
+struct pipe_fence;
struct _DriBufferObject;
+struct _DriFenceObject;
struct pipe_winsys *
intel_create_pipe_winsys( int fd );
@@ -66,5 +68,20 @@ pipe_bo( struct _DriBufferObject *bo )
}
+/* Turn the pipe opaque buffer pointer into a dri_bufmgr opaque
+ * buffer pointer...
+ */
+static INLINE struct _DriFenceObject *
+dri_fo( struct pipe_fence *bo )
+{
+ return (struct _DriFenceObject *)bo;
+}
+
+static INLINE struct pipe_fence *
+pipe_fo( struct _DriFenceObject *bo )
+{
+ return (struct pipe_fence *)bo;
+}
+
#endif
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
index 8e0eea4392..d73b309fd4 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
@@ -111,19 +111,62 @@ static void intel_i915_batch_reloc( struct i915_winsys *sws,
-static void intel_i915_batch_flush( struct i915_winsys *sws )
+static void
+intel_i915_batch_flush( struct i915_winsys *sws,
+ struct pipe_fence **fence )
{
struct intel_context *intel = intel_i915_winsys(sws)->intel;
+ struct pipe_fence *tmp_fence;
+
+ tmp_fence = pipe_fo(intel_batchbuffer_flush( intel->batch ));
+
+ /* this also increases the fence reference count, which is not done inside
+ * intel_batchbuffer_flush call above
+ */
+ sws->fence_reference(sws, fence, tmp_fence);
+}
- intel_batchbuffer_flush( intel->batch );
-// if (0) intel_i915_batch_wait_idle( sws );
+
+static void
+intel_i915_fence_reference( struct i915_winsys *sws,
+ struct pipe_fence **dst_fence,
+ struct pipe_fence *src_fence )
+{
+ struct _DriFenceObject **dri_dst_fence = (struct _DriFenceObject **)dst_fence;
+ struct _DriFenceObject *dri_src_fence = (struct _DriFenceObject *)src_fence;
+
+ if(dri_src_fence)
+ driFenceReference(dri_src_fence);
+
+ if(*dri_dst_fence)
+ driFenceUnReference(*dri_dst_fence);
+
+ *dri_dst_fence = dri_src_fence;
}
-static void intel_i915_batch_finish( struct i915_winsys *sws )
+static int
+intel_i915_fence_is_signalled( struct i915_winsys *sws,
+ struct pipe_fence *fence )
{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
- intel_batchbuffer_finish( intel->batch );
+ struct _DriFenceObject *dri_fence = dri_fo(fence);
+ if (fence)
+ return driFenceSignaled(dri_fence,
+ DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW);
+ return 1;
+}
+
+
+static int
+intel_i915_fence_wait( struct i915_winsys *sws,
+ struct pipe_fence *fence )
+{
+ struct _DriFenceObject *dri_fence = dri_fo(fence);
+ if (fence)
+ driFenceFinish(dri_fence,
+ DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
+ GL_FALSE);
+ return 1;
}
@@ -143,7 +186,10 @@ intel_create_i915simple( struct intel_context *intel,
iws->winsys.batch_dword = intel_i915_batch_dword;
iws->winsys.batch_reloc = intel_i915_batch_reloc;
iws->winsys.batch_flush = intel_i915_batch_flush;
- iws->winsys.batch_finish = intel_i915_batch_finish;
+ iws->winsys.fence_reference = intel_i915_fence_reference;
+ iws->winsys.fence_is_signalled = intel_i915_fence_is_signalled;
+ iws->winsys.fence_wait = intel_i915_fence_wait;
+
iws->intel = intel;
/* Create the i915simple context: