[Mesa-dev] [PATCH 2/2] i965: Use the blitter in intel_bufferobj_subdata for busy BOs on Gen6+.

Kenneth Graunke kenneth at whitecape.org
Mon Jul 9 11:18:45 PDT 2012


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

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |   26 +++++++++------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 200fce3..169d777 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -178,26 +178,22 @@ intel_bufferobj_subdata(struct gl_context * ctx,
       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;
+   } else if (busy) {
+      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);
-      } else {
-	 drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
-      }
+      drm_intel_bo_unreference(temp_bo);
    } 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)) {
+      if (intel->gen >= 6 &&
+          drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) {
 	 intel_batchbuffer_flush(intel);
       }
       drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
-- 
1.7.10.4



More information about the mesa-dev mailing list