[Mesa-dev] [PATCH 12/18] i965: Reuse any available upload space for temporary MapBufferRange blits

Chris Wilson chris at chris-wilson.co.uk
Mon Jul 6 03:33:17 PDT 2015


Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 src/mesa/drivers/dri/i965/intel_buffer_objects.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index 283182d..7110ce6 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -354,17 +354,13 @@ brw_map_buffer_range(struct gl_context *ctx,
           * guarantees the driver has advertised to the application.
           */
          const unsigned alignment = ctx->Const.MinMapBufferAlignment;
-
-         intel_obj->map_extra[index] = (uintptr_t) offset % alignment;
-         intel_obj->range_map_bo[index] =
-            brw_bo_create(&brw->batch,
-                          "BO blit temp",
-                          length + intel_obj->map_extra[index],
-                          alignment, 0);
+         const unsigned adj = (uintptr_t) offset % alignment;
 
          obj->Mappings[index].Pointer =
-            brw_bo_map(intel_obj->range_map_bo[index], MAP_WRITE) +
-            intel_obj->map_extra[index];
+            intel_upload_space(brw, length + adj, alignment,
+                               &intel_obj->range_map_bo[index],
+                               &intel_obj->map_extra[index]) + adj;
+         intel_obj->map_extra[index] += adj;
 
          return obj->Mappings[index].Pointer;
       } else {
-- 
2.1.4



More information about the mesa-dev mailing list