Mesa (master): i965: Use the blitter in intel_bufferobj_subdata for busy BOs on Gen6+.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jul 12 20:40:19 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Jul  2 15:04:00 2012 -0700

i965: Use the blitter in intel_bufferobj_subdata for busy BOs on Gen6+.

Previously we only did this pre-Gen6, and used pwrite on Gen6+.
In one workload, this cuts significant amount of overhead.

v2: Simplify the function based on Eric's suggestions.

Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

---

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

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index ef511e6..37dc75c 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -205,16 +205,16 @@ intel_bufferobj_subdata(struct gl_context * ctx,
       drm_intel_bo_busy(intel_obj->buffer) ||
       drm_intel_bo_references(intel->batch.bo, intel_obj->buffer);
 
-   /* replace the current busy bo with fresh data */
-   if (busy && size == intel_obj->Base.Size) {
-      drm_intel_bo_unreference(intel_obj->buffer);
-      intel_bufferobj_alloc_buffer(intel, intel_obj);
-      drm_intel_bo_subdata(intel_obj->buffer, 0, size, data);
-   } else if (intel->gen < 6) {
-      if (busy) {
-	 drm_intel_bo *temp_bo;
-
-	 temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
+   if (busy) {
+      if (size == intel_obj->Base.Size) {
+	 /* Replace the current busy bo with fresh data. */
+	 drm_intel_bo_unreference(intel_obj->buffer);
+	 intel_bufferobj_alloc_buffer(intel, intel_obj);
+	 drm_intel_bo_subdata(intel_obj->buffer, 0, size, data);
+      } else {
+	 /* Use the blitter to upload the new data. */
+	 drm_intel_bo *temp_bo =
+	    drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
 
 	 drm_intel_bo_subdata(temp_bo, 0, size, data);
 
@@ -224,14 +224,8 @@ intel_bufferobj_subdata(struct gl_context * ctx,
 				size);
 
 	 drm_intel_bo_unreference(temp_bo);
-      } else {
-	 drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
       }
    } else {
-      /* Can't use the blit to modify the buffer in the middle of batch. */
-      if (drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) {
-	 intel_batchbuffer_flush(intel);
-      }
       drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
    }
 }




More information about the mesa-commit mailing list