[Intel-gfx] [PATCH 6/6] intel: use write only maps for MapRangeBuffer

Ben Widawsky ben at bwidawsk.net
Tue Sep 20 06:25:06 CEST 2011


Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index d35a50e..18bed4d 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -296,8 +296,6 @@ intel_bufferobj_get_subdata(struct gl_context * ctx,
    }
 }
 
-
-
 /**
  * Called via glMapBufferRange and glMapBuffer
  *
@@ -401,8 +399,16 @@ intel_bufferobj_map_range(struct gl_context * ctx,
    }
 
    if (!(access & GL_MAP_READ_BIT)) {
-      drm_intel_gem_bo_map_gtt(intel_obj->buffer);
-      intel_obj->mapped_gtt = GL_TRUE;
+      if (intel->gen >= 6) {
+	 drm_intel_gem_bo_map_wo(intel_obj->buffer);
+	 intel_obj->mapped_gtt = GL_FALSE;
+      } else if (access & GL_MAP_UNSYNCHRONIZED_BIT) {
+         drm_intel_gem_bo_map_gtt_wo(intel_obj->buffer, 0, 1);
+         intel_obj->mapped_gtt = GL_TRUE;
+      } else {
+         drm_intel_gem_bo_map_gtt(intel_obj->buffer);
+         intel_obj->mapped_gtt = GL_TRUE;
+      }
    } else {
       drm_intel_bo_map(intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0);
       intel_obj->mapped_gtt = GL_FALSE;
-- 
1.7.6.1




More information about the Intel-gfx mailing list