intel: Drop the tracking of bo_map vs bo_map_gtt for unmapping.
authorEric Anholt <eric@anholt.net>
Fri, 24 Feb 2012 23:44:26 +0000 (15:44 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 21 Mar 2012 19:45:06 +0000 (12:45 -0700)
drm_intel_bo_unmap() supports both in the current libdrm version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_buffer_objects.c
src/mesa/drivers/dri/intel/intel_buffer_objects.h

index e55a8fe937ba05384868421792aea7c226367cbf..26f23fd0cb09457e29c5d5604b677d678cc78a69 100644 (file)
@@ -358,11 +358,9 @@ intel_bufferobj_map_range(struct gl_context * ctx,
                                                      length, 64);
         if (!(access & GL_MAP_READ_BIT)) {
            drm_intel_gem_bo_map_gtt(intel_obj->range_map_bo);
-           intel_obj->mapped_gtt = true;
         } else {
            drm_intel_bo_map(intel_obj->range_map_bo,
                             (access & GL_MAP_WRITE_BIT) != 0);
-           intel_obj->mapped_gtt = false;
         }
         obj->Pointer = intel_obj->range_map_bo->virtual;
       }
@@ -371,10 +369,8 @@ 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 = true;
    } else {
       drm_intel_bo_map(intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0);
-      intel_obj->mapped_gtt = false;
    }
 
    obj->Pointer = intel_obj->buffer->virtual + offset;
@@ -440,11 +436,7 @@ intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj)
       free(intel_obj->range_map_buffer);
       intel_obj->range_map_buffer = NULL;
    } else if (intel_obj->range_map_bo != NULL) {
-      if (intel_obj->mapped_gtt) {
-        drm_intel_gem_bo_unmap_gtt(intel_obj->range_map_bo);
-      } else {
-        drm_intel_bo_unmap(intel_obj->range_map_bo);
-      }
+      drm_intel_bo_unmap(intel_obj->range_map_bo);
 
       intel_emit_linear_blit(intel,
                             intel_obj->buffer, obj->Offset,
@@ -461,11 +453,7 @@ intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj)
       drm_intel_bo_unreference(intel_obj->range_map_bo);
       intel_obj->range_map_bo = NULL;
    } else if (intel_obj->buffer != NULL) {
-      if (intel_obj->mapped_gtt) {
-        drm_intel_gem_bo_unmap_gtt(intel_obj->buffer);
-      } else {
-        drm_intel_bo_unmap(intel_obj->buffer);
-      }
+      drm_intel_bo_unmap(intel_obj->buffer);
    }
    obj->Pointer = NULL;
    obj->Offset = 0;
index a487b5b9d07a04ea3e2e462ed6a81f4eaa8231be..92a4121ce501e3dbe8d7b57129d4b78f85801d5e 100644 (file)
@@ -51,7 +51,6 @@ struct intel_buffer_object
    unsigned int range_map_offset;
    GLsizei range_map_size;
 
-   bool mapped_gtt;
    bool source;
 };