}
+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
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);
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 );
}
-/* 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
-static void
-intel_i915_batch_flush( struct i915_winsys *sws,
- struct pipe_fence **fence )
+static void intel_i915_batch_flush( struct i915_winsys *sws )
{
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);
-}
-
-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;
+ intel_batchbuffer_flush( intel->batch );
+// if (0) intel_i915_batch_wait_idle( sws );
}
-static int
-intel_i915_fence_is_signalled( struct i915_winsys *sws,
- struct pipe_fence *fence )
+static void intel_i915_batch_finish( struct i915_winsys *sws )
{
- 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;
+ struct intel_context *intel = intel_i915_winsys(sws)->intel;
+ intel_batchbuffer_finish( intel->batch );
}
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.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->winsys.batch_finish = intel_i915_batch_finish;
iws->intel = intel;
/* Create the i915simple context:
#define ADVANCE_BATCH()
-#define FLUSH_BATCH() do { \
- if (0) i915_dump_batchbuffer( i915 ); \
- i915->winsys->batch_flush( i915->winsys, &i915->last_fence ); \
- i915->batch_start = NULL; \
- i915->hardware_dirty = ~0; \
+#define FLUSH_BATCH() do { \
+ if (0) i915_dump_batchbuffer( i915 ); \
+ i915->winsys->batch_flush( i915->winsys ); \
+ i915->batch_start = NULL; \
+ i915->hardware_dirty = ~0; \
} while (0)
#endif
draw_destroy( i915->draw );
- i915->winsys->fence_reference( i915->winsys, &i915->last_fence, NULL );
-
free( i915 );
}
-struct pipe_fence;
struct i915_cache_context;
/* Use to calculate differences between state emitted to hardware and
unsigned dirty;
unsigned *batch_start;
-
- struct pipe_fence *last_fence;
/** Vertex buffer */
struct pipe_buffer_handle *vbo;
FLUSH_BATCH();
if (flags & PIPE_FLUSH_WAIT) {
- if( i915->last_fence )
- i915->winsys->fence_wait(i915->winsys, i915->last_fence);
+ i915->winsys->batch_finish(i915->winsys);
}
}
struct pipe_buffer_handle;
struct pipe_winsys;
-struct pipe_fence;
/**
unsigned access_flags,
unsigned delta );
- /**
- * 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
- */
- void (*fence_reference)( struct i915_winsys *sws,
- struct pipe_fence **dst_fence,
- struct pipe_fence *src_fence );
-
- int (*fence_is_signalled)( struct i915_winsys *sws,
- struct pipe_fence *fence );
-
- int (*fence_wait)( struct i915_winsys *sws,
- struct pipe_fence *fence );
-
+ void (*batch_flush)( struct i915_winsys *sws );
+ void (*batch_finish)( struct i915_winsys *sws );
};
#define I915_BUFFER_ACCESS_WRITE 0x1