Remove fences from the i915simple winsys interface.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 22 Nov 2007 10:56:09 +0000 (10:56 +0000)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 22 Nov 2007 10:56:09 +0000 (10:56 +0000)
Fences will be part of the pipe winsys interface, so remove this to avoid
merge conflicts later on.

This reverts commit ca7f68a7cf25a51f382bba8c42d8c6ab7db57b5d.
This reverts commit dec60d33b2570cf2bdce72a00a1539ee93133f91.
This reverts commit 90dd0cb822f2fe14258c786e5c37da69472b7d17.

src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c
src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h
src/mesa/drivers/dri/intel_winsys/intel_winsys.h
src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c
src/mesa/pipe/i915simple/i915_batch.h
src/mesa/pipe/i915simple/i915_context.c
src/mesa/pipe/i915simple/i915_context.h
src/mesa/pipe/i915simple/i915_flush.c
src/mesa/pipe/i915simple/i915_winsys.h

index ed223977e2c1ba81b334a7dce0bc5630a89b0c16..49e04d81ec1ef1315e58d561070628fb534ce69c 100644 (file)
@@ -307,6 +307,20 @@ 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
index 2c943e68e5c47281a3fc62d33cd0561982d10d73..82feafa21f625b14a11ab819e971e6d4ae1ab7b8 100644 (file)
@@ -72,6 +72,8 @@ 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);
 
index f944cd23c36cb7354f032286b4807daef1ca3791..89e63e0a797271a913680d7f05d00512d9c68579 100644 (file)
@@ -32,9 +32,7 @@ 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 );
@@ -68,20 +66,5 @@ 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
index d73b309fd421bbb8585752b6753e0fb9d79f8221..8e0eea43922d5bafc5348e04dd5eaff6519ab659 100644 (file)
@@ -111,62 +111,19 @@ static void intel_i915_batch_reloc( struct i915_winsys *sws,
 
 
 
-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 );
 }
 
 
@@ -186,10 +143,7 @@ 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.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:
index 603d193f626327b78acd45922286dce5833c972e..fb88cd6db0de937cb45200109b69d9a1fd28ea12 100644 (file)
 
 #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 
index f5d770ce0dfd1d184b73ad78b1f7beba0a7b4180..e43274dc6674539131ef280a135c110a45aa5139 100644 (file)
@@ -175,8 +175,6 @@ static void i915_destroy( struct pipe_context *pipe )
 
    draw_destroy( i915->draw );
 
-   i915->winsys->fence_reference( i915->winsys, &i915->last_fence, NULL );
-   
    free( i915 );
 }
 
index 488682f852e3eb9a7aeed2b1469729ca75a7409b..ee430ebc9029a7abfb7a188a9463a308b8bb9dec 100644 (file)
@@ -80,7 +80,6 @@
 
 
 
-struct pipe_fence;
 struct i915_cache_context;
 
 /* Use to calculate differences between state emitted to hardware and
@@ -185,8 +184,6 @@ struct i915_context
    unsigned dirty;
 
    unsigned *batch_start;
-   
-   struct pipe_fence *last_fence;
 
    /** Vertex buffer */
    struct pipe_buffer_handle *vbo;
index 1044cb1bdbd187d9e549c7b3148706f8f3087bdb..3c2069b8273f96b0e35cf442683d5d57ae600f15 100644 (file)
@@ -69,8 +69,7 @@ static void i915_flush( struct pipe_context *pipe,
    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);
    }
 }
 
index 386ed745d373e6fffc6758ce1f5a1b6eae703930..2c0f335d34665539d06ad4ce86cb5da31bcf09a0 100644 (file)
@@ -52,7 +52,6 @@
 
 struct pipe_buffer_handle;
 struct pipe_winsys;
-struct pipe_fence;
 
 
 /**
@@ -98,28 +97,8 @@ struct i915_winsys {
                        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