i915: Fixed fence related problems
authorJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 8 Apr 2008 15:24:33 +0000 (17:24 +0200)
committerJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 8 Apr 2008 15:24:33 +0000 (17:24 +0200)
src/gallium/winsys/dri/intel/intel_batchbuffer.c
src/gallium/winsys/dri/intel/intel_winsys_i915.c

index 05223bf700d4adb347ab64a86ffb8531533b2e3d..3a8ff5a4eba2cae732269ff35d897c33c1f69475 100644 (file)
@@ -386,8 +386,10 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch)
    GLboolean was_locked = intel->locked;
    struct _DriFenceObject *fence;
 
-   if (used == 0)
+   if (used == 0) {
+      driFenceReference(batch->last_fence);
       return batch->last_fence;
+   }
 
    /* Add the MI_BATCH_BUFFER_END.  Always add an MI_FLUSH - this is a
     * performance drain that we would like to avoid.
index ae3e9654d32a2f2abcfb12bad80f795b78f5bf11..a35825d36ab2d3640b221fa621b9ab3ffa7317e0 100644 (file)
@@ -113,10 +113,10 @@ static void intel_i915_batch_reloc( struct i915_winsys *sws,
                                 delta );
 #else /* new */
    intel_offset_relocation( intel->batch,
-                               delta,
-                               dri_bo( buf ),
-                               flags,
-                               mask );
+                           delta,
+                           dri_bo( buf ),
+                           flags,
+                           mask );
 #endif
 }
 
@@ -132,9 +132,13 @@ static void intel_i915_batch_flush( struct i915_winsys *sws,
       struct pipe_fence_handle *pipe;
    } fu;
 
+   if (fence)
+      assert(!*fence);
+
    fu.dri = intel_batchbuffer_flush( intel->batch );
 
-   if (!fu.dri && fence) {
+   if (!fu.dri) {
+      assert(0);
       *fence = NULL;
       return;
    }
@@ -143,11 +147,9 @@ static void intel_i915_batch_flush( struct i915_winsys *sws,
       if (fence)
         *fence = fu.pipe;
       else
-        iws->pws->fence_reference(iws->pws, &fu.dri, NULL);
+         driFenceUnReference(&fu.dri);
    }
 
-
-//   if (0) intel_i915_batch_wait_idle( sws );
 }