i965: Fix assertion failure on gen6 BufferSubData to busy BO.
authorEric Anholt <eric@anholt.net>
Mon, 18 Oct 2010 18:32:19 +0000 (11:32 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 18 Oct 2010 19:56:44 +0000 (12:56 -0700)
Fixes fbo-blit and probably several other tests.

src/mesa/drivers/dri/intel/intel_buffer_objects.c

index 1e99f9040af872aedf8bdf1e098f78c932d98e9a..fea99b2ad60c1b580323e47755d715ddfb9e2d85 100644 (file)
@@ -214,21 +214,28 @@ intel_bufferobj_subdata(struct gl_context * ctx,
       memcpy((char *)intel_obj->sys_buffer + offset, data, size);
    else {
       /* Flush any existing batchbuffer that might reference this data. */
-      if (drm_intel_bo_busy(intel_obj->buffer) ||
-         drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
-        drm_intel_bo *temp_bo;
+      if (intel->gen < 6) {
+        if (drm_intel_bo_busy(intel_obj->buffer) ||
+            drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
+           drm_intel_bo *temp_bo;
 
-        temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
+           temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
 
-        drm_intel_bo_subdata(temp_bo, 0, size, data);
+           drm_intel_bo_subdata(temp_bo, 0, size, data);
 
-        intel_emit_linear_blit(intel,
-                               intel_obj->buffer, offset,
-                               temp_bo, 0,
-                               size);
+           intel_emit_linear_blit(intel,
+                                  intel_obj->buffer, offset,
+                                  temp_bo, 0,
+                                  size);
 
-        drm_intel_bo_unreference(temp_bo);
+           drm_intel_bo_unreference(temp_bo);
+        } else {
+           drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
+        }
       } else {
+        if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
+           intel_batchbuffer_flush(intel->batch);
+        }
         drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
       }
    }