summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2007-11-15 17:07:50 +0000
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2007-11-15 17:07:50 +0000
commit90dd0cb822f2fe14258c786e5c37da69472b7d17 (patch)
tree709a0073a8e5cd66442199d4bd529a4097573cba /src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
parent193c85ec7a1aec44eebc67c6224fb6ecbb4607a5 (diff)
Include fences in the i915simple winsys interface.
Diffstat (limited to 'src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c60
1 files changed, 53 insertions, 7 deletions
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..7713d6e48d 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 struct pipe_fence *
+intel_i915_batch_flush( struct i915_winsys *sws )
{
struct intel_context *intel = intel_i915_winsys(sws)->intel;
- intel_batchbuffer_flush( intel->batch );
-// if (0) intel_i915_batch_wait_idle( sws );
+ return pipe_fo(intel_batchbuffer_flush( intel->batch ));
}
-static void intel_i915_batch_finish( struct i915_winsys *sws )
+static void
+intel_i915_fence_reference( struct i915_winsys *sws,
+ struct pipe_fence **dst_fence,
+ struct pipe_fence *src_fence )
{
- struct intel_context *intel = intel_i915_winsys(sws)->intel;
- intel_batchbuffer_finish( intel->batch );
+ struct _DriFenceObject **dri_dst_fence = (struct _DriFenceObject **)dst_fence;
+ struct _DriFenceObject *dri_src_fence = (struct _DriFenceObject *)dst_fence;
+
+ if(dri_src_fence)
+ driFenceReference(dri_src_fence);
+
+ if(*dri_dst_fence)
+ driFenceUnReference(*dri_dst_fence);
+
+ *dri_dst_fence = dri_src_fence;
+}
+
+
+static int
+intel_i915_fence_is_signalled( struct i915_winsys *sws,
+ struct pipe_fence *fence )
+{
+ struct _DriFenceObject *dri_fence = dri_fo(fence);
+ int ret = 1;
+ if (fence) {
+ driFenceReference(dri_fence);
+ ret = driFenceSignaled(dri_fence,
+ DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW);
+ driFenceUnReference(dri_fence);
+ }
+ return ret;
+}
+
+
+static int
+intel_i915_fence_wait( struct i915_winsys *sws,
+ struct pipe_fence *fence )
+{
+ struct _DriFenceObject *dri_fence = dri_fo(fence);
+ if (fence) {
+ driFenceReference(dri_fence);
+ driFenceFinish(dri_fence,
+ DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
+ GL_FALSE);
+ driFenceUnReference(dri_fence);
+ }
+ 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: