Restore missing intel_batchbuffer_reset() which was needed.
authorEric Anholt <eric@anholt.net>
Thu, 17 May 2007 22:36:43 +0000 (15:36 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 17 May 2007 22:36:43 +0000 (15:36 -0700)
src/mesa/drivers/dri/i915tex/intel_batchbuffer.c

index 55e40d5d97d2cefd10af7db1f77860073dee1cfd..67fca371a7e14be2e1830d54e6ef14f1a2bf6548 100644 (file)
@@ -80,12 +80,16 @@ intel_dump_batchbuffer(GLuint offset, GLuint * ptr, GLuint count)
 /*======================================================================
  * Public functions
  */
-struct intel_batchbuffer *
-intel_batchbuffer_alloc(struct intel_context *intel)
+void
+intel_batchbuffer_reset(struct intel_batchbuffer *batch)
 {
-   struct intel_batchbuffer *batch = calloc(sizeof(*batch), 1);
+   struct intel_context *intel = batch->intel;
+
+   if (batch->buf != NULL) {
+      dri_bo_unreference(batch->buf);
+      batch->buf = NULL;
+   }
 
-   batch->intel = intel;
    batch->buf = dri_bo_alloc(intel->intelScreen->bufmgr, "batchbuffer",
                             intel->intelScreen->maxBatchSize, 4096,
                             DRM_BO_FLAG_MEM_TT |
@@ -94,9 +98,17 @@ intel_batchbuffer_alloc(struct intel_context *intel)
    batch->map = batch->buf->virtual;
    batch->size = intel->intelScreen->maxBatchSize;
    batch->ptr = batch->map;
+}
+
+struct intel_batchbuffer *
+intel_batchbuffer_alloc(struct intel_context *intel)
+{
+   struct intel_batchbuffer *batch = calloc(sizeof(*batch), 1);
 
+   batch->intel = intel;
    batch->last_fence = NULL;
    intel_batchbuffer_reset(batch);
+
    return batch;
 }