-static struct pipe_fence *
-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;
-
- return pipe_fo(intel_batchbuffer_flush( intel->batch ));
+ 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);
}
struct pipe_fence *fence )
{
struct _DriFenceObject *dri_fence = dri_fo(fence);
- int ret = 1;
- if (fence) {
- driFenceReference(dri_fence);
- ret = driFenceSignaled(dri_fence,
+ if (fence)
+ return driFenceSignaled(dri_fence,
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW);
- driFenceUnReference(dri_fence);
- }
- return ret;
+ return 1;
}
struct pipe_fence *fence )
{
struct _DriFenceObject *dri_fence = dri_fo(fence);
- if (fence) {
- driFenceReference(dri_fence);
+ if (fence)
driFenceFinish(dri_fence,
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
GL_FALSE);
- driFenceUnReference(dri_fence);
- }
return 1;
}
#define FLUSH_BATCH() do { \
if (0) i915_dump_batchbuffer( i915 ); \
- i915->last_fence = i915->winsys->batch_flush( i915->winsys ); \
+ i915->winsys->batch_flush( i915->winsys, &i915->last_fence ); \
i915->batch_start = NULL; \
i915->hardware_dirty = ~0; \
} while (0)
unsigned access_flags,
unsigned delta );
- struct pipe_fence *(*batch_flush)( struct i915_winsys *sws );
+ /**
+ * Flush the batch buffer.
+ *
+ * Fence argument must point to NULL or to a previous fence, and the caller
+ * must call fence_reference when done with the fence.
+ */
+ void (*batch_flush)( struct i915_winsys *sws,
+ struct pipe_fence **fence );
/* Fence