Mesa (master): intel: When subdataing a busy buffer, use a temporary and blit in.

Eric Anholt anholt at kemper.freedesktop.org
Sat Nov 14 00:04:59 UTC 2009


Module: Mesa
Branch: master
Commit: 3c05c1eb6326dc28e8ab073d179eb669e5699f4b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c05c1eb6326dc28e8ab073d179eb669e5699f4b

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Nov 12 10:45:05 2009 -0800

intel: When subdataing a busy buffer, use a temporary and blit in.

This cuts a massive number of waits in ET:QW, which uses a VBO ringbuffer.
Unfortunately it doesn't BufferData when wrapping back to 0, so we can't
be clever with tracking what's been initialized.

---

 src/mesa/drivers/dri/intel/intel_buffer_objects.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index ea9d5a6..669becd 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -209,10 +209,23 @@ intel_bufferobj_subdata(GLcontext * ctx,
       memcpy((char *)intel_obj->sys_buffer + offset, data, size);
    else {
       /* Flush any existing batchbuffer that might reference this data. */
-      if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer))
-	 intelFlush(ctx);
+      if (drm_intel_bo_busy(intel_obj->buffer) ||
+	  drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
+	 drm_intel_bo *temp_bo;
 
-      dri_bo_subdata(intel_obj->buffer, offset, size, data);
+	 temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
+
+	 drm_intel_bo_subdata(temp_bo, 0, size, data);
+
+	 intel_emit_linear_blit(intel,
+				intel_obj->buffer, offset,
+				temp_bo, 0,
+				size);
+
+	 drm_intel_bo_unreference(temp_bo);
+      } else {
+	 dri_bo_subdata(intel_obj->buffer, offset, size, data);
+      }
    }
 }
 




More information about the mesa-commit mailing list