aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2013-01-17 15:45:15 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-17 16:33:56 -0500
commit5d4545aef561ad47f91bcf75814af20c104b5a9e (patch)
treeb9a1c3d2226b56285b8de0e23b2bd7f0137c9336 /drivers/gpu/drm/i915/i915_gem.c
parent00fc2c3c53d7bfc9a29e5f4bdf2677f0c399f3bc (diff)
drm/i915: Create a gtt structure
The purpose of the gtt structure is to help isolate our gtt specific properties from the rest of the code (in doing so it help us finish the isolation from the AGP connection). The following members are pulled out (and renamed): gtt_start gtt_total gtt_mappable_end gtt_mappable gtt_base_addr gsm The gtt structure will serve as a nice place to put gen specific gtt routines in upcoming patches. As far as what else I feel belongs in this structure: it is meant to encapsulate the GTT's physical properties. This is why I've not added fields which track various drm_mm properties, or things like gtt_mtrr (which is itself a pretty transient field). Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> [Ben modified commit messages] Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a2bb18914329..51fdf16181a7 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -186,7 +186,7 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
186 pinned += obj->gtt_space->size; 186 pinned += obj->gtt_space->size;
187 mutex_unlock(&dev->struct_mutex); 187 mutex_unlock(&dev->struct_mutex);
188 188
189 args->aper_size = dev_priv->mm.gtt_total; 189 args->aper_size = dev_priv->gtt.total;
190 args->aper_available_size = args->aper_size - pinned; 190 args->aper_available_size = args->aper_size - pinned;
191 191
192 return 0; 192 return 0;
@@ -637,7 +637,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
637 * source page isn't available. Return the error and we'll 637 * source page isn't available. Return the error and we'll
638 * retry in the slow path. 638 * retry in the slow path.
639 */ 639 */
640 if (fast_user_write(dev_priv->mm.gtt_mapping, page_base, 640 if (fast_user_write(dev_priv->gtt.mappable, page_base,
641 page_offset, user_data, page_length)) { 641 page_offset, user_data, page_length)) {
642 ret = -EFAULT; 642 ret = -EFAULT;
643 goto out_unpin; 643 goto out_unpin;
@@ -1362,7 +1362,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1362 1362
1363 obj->fault_mappable = true; 1363 obj->fault_mappable = true;
1364 1364
1365 pfn = ((dev_priv->mm.gtt_base_addr + obj->gtt_offset) >> PAGE_SHIFT) + 1365 pfn = ((dev_priv->gtt.mappable_base + obj->gtt_offset) >> PAGE_SHIFT) +
1366 page_offset; 1366 page_offset;
1367 1367
1368 /* Finally, remap it using the new GTT offset */ 1368 /* Finally, remap it using the new GTT offset */
@@ -1544,7 +1544,7 @@ i915_gem_mmap_gtt(struct drm_file *file,
1544 goto unlock; 1544 goto unlock;
1545 } 1545 }
1546 1546
1547 if (obj->base.size > dev_priv->mm.gtt_mappable_end) { 1547 if (obj->base.size > dev_priv->gtt.mappable_end) {
1548 ret = -E2BIG; 1548 ret = -E2BIG;
1549 goto out; 1549 goto out;
1550 } 1550 }
@@ -2910,7 +2910,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2910 * before evicting everything in a vain attempt to find space. 2910 * before evicting everything in a vain attempt to find space.
2911 */ 2911 */
2912 if (obj->base.size > 2912 if (obj->base.size >
2913 (map_and_fenceable ? dev_priv->mm.gtt_mappable_end : dev_priv->mm.gtt_total)) { 2913 (map_and_fenceable ? dev_priv->gtt.mappable_end : dev_priv->gtt.total)) {
2914 DRM_ERROR("Attempting to bind an object larger than the aperture\n"); 2914 DRM_ERROR("Attempting to bind an object larger than the aperture\n");
2915 return -E2BIG; 2915 return -E2BIG;
2916 } 2916 }
@@ -2931,7 +2931,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2931 if (map_and_fenceable) 2931 if (map_and_fenceable)
2932 ret = drm_mm_insert_node_in_range_generic(&dev_priv->mm.gtt_space, node, 2932 ret = drm_mm_insert_node_in_range_generic(&dev_priv->mm.gtt_space, node,
2933 size, alignment, obj->cache_level, 2933 size, alignment, obj->cache_level,
2934 0, dev_priv->mm.gtt_mappable_end); 2934 0, dev_priv->gtt.mappable_end);
2935 else 2935 else
2936 ret = drm_mm_insert_node_generic(&dev_priv->mm.gtt_space, node, 2936 ret = drm_mm_insert_node_generic(&dev_priv->mm.gtt_space, node,
2937 size, alignment, obj->cache_level); 2937 size, alignment, obj->cache_level);
@@ -2971,7 +2971,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2971 (node->start & (fence_alignment - 1)) == 0; 2971 (node->start & (fence_alignment - 1)) == 0;
2972 2972
2973 mappable = 2973 mappable =
2974 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end; 2974 obj->gtt_offset + obj->base.size <= dev_priv->gtt.mappable_end;
2975 2975
2976 obj->map_and_fenceable = mappable && fenceable; 2976 obj->map_and_fenceable = mappable && fenceable;
2977 2977