drm/i915: Use ggtt_vm to save some typing
authorBen Widawsky <ben@bwidawsk.net>
Wed, 31 Jul 2013 23:59:59 +0000 (16:59 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 5 Aug 2013 17:04:10 +0000 (19:04 +0200)
Just some small cleanups, and a rename of vm->ggtt_vm requested by
Daniel.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_stolen.c

index 90a276e35909332c857e98011477eae434fc5a57..f38cc696be7f5c57df3dc1c3cf454fb00bbce1f0 100644 (file)
@@ -643,7 +643,8 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
         * aperture.  One page should be enough to keep any prefetching inside
         * of the aperture.
         */
-       drm_i915_private_t *dev_priv = dev->dev_private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_address_space *ggtt_vm = &dev_priv->gtt.base;
        struct drm_mm_node *entry;
        struct drm_i915_gem_object *obj;
        unsigned long hole_start, hole_end;
@@ -651,19 +652,19 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
        BUG_ON(mappable_end > end);
 
        /* Subtract the guard page ... */
-       drm_mm_init(&dev_priv->gtt.base.mm, start, end - start - PAGE_SIZE);
+       drm_mm_init(&ggtt_vm->mm, start, end - start - PAGE_SIZE);
        if (!HAS_LLC(dev))
                dev_priv->gtt.base.mm.color_adjust = i915_gtt_color_adjust;
 
        /* Mark any preallocated objects as occupied */
        list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
-               struct i915_vma *vma = i915_gem_obj_to_vma(obj, &dev_priv->gtt.base);
+               struct i915_vma *vma = i915_gem_obj_to_vma(obj, ggtt_vm);
                int ret;
                DRM_DEBUG_KMS("reserving preallocated space: %lx + %zx\n",
                              i915_gem_obj_ggtt_offset(obj), obj->base.size);
 
                WARN_ON(i915_gem_obj_ggtt_bound(obj));
-               ret = drm_mm_reserve_node(&dev_priv->gtt.base.mm, &vma->node);
+               ret = drm_mm_reserve_node(&ggtt_vm->mm, &vma->node);
                if (ret)
                        DRM_DEBUG_KMS("Reservation failed\n");
                obj->has_global_gtt_mapping = 1;
@@ -674,19 +675,15 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
        dev_priv->gtt.base.total = end - start;
 
        /* Clear any non-preallocated blocks */
-       drm_mm_for_each_hole(entry, &dev_priv->gtt.base.mm,
-                            hole_start, hole_end) {
+       drm_mm_for_each_hole(entry, &ggtt_vm->mm, hole_start, hole_end) {
                const unsigned long count = (hole_end - hole_start) / PAGE_SIZE;
                DRM_DEBUG_KMS("clearing unused GTT space: [%lx, %lx]\n",
                              hole_start, hole_end);
-               dev_priv->gtt.base.clear_range(&dev_priv->gtt.base,
-                                              hole_start / PAGE_SIZE,
-                                              count);
+               ggtt_vm->clear_range(ggtt_vm, hole_start / PAGE_SIZE, count);
        }
 
        /* And finally clear the reserved guard page */
-       dev_priv->gtt.base.clear_range(&dev_priv->gtt.base,
-                                      end / PAGE_SIZE - 1, 1);
+       ggtt_vm->clear_range(ggtt_vm, end / PAGE_SIZE - 1, 1);
 }
 
 static bool
index 4bbde2ae1819c0025926aa0e158c646099f55e13..934840860c6d8576cfd6936cac37160dfdc77f60 100644 (file)
@@ -333,7 +333,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
                                               u32 size)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct i915_address_space *vm = &dev_priv->gtt.base;
+       struct i915_address_space *ggtt = &dev_priv->gtt.base;
        struct drm_i915_gem_object *obj;
        struct drm_mm_node *stolen;
        struct i915_vma *vma;
@@ -376,7 +376,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
        if (gtt_offset == I915_GTT_OFFSET_NONE)
                return obj;
 
-       vma = i915_gem_vma_create(obj, &dev_priv->gtt.base);
+       vma = i915_gem_vma_create(obj, ggtt);
        if (IS_ERR(vma)) {
                ret = PTR_ERR(vma);
                goto err_out;
@@ -389,8 +389,8 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
         */
        vma->node.start = gtt_offset;
        vma->node.size = size;
-       if (drm_mm_initialized(&dev_priv->gtt.base.mm)) {
-               ret = drm_mm_reserve_node(&dev_priv->gtt.base.mm, &vma->node);
+       if (drm_mm_initialized(&ggtt->mm)) {
+               ret = drm_mm_reserve_node(&ggtt->mm, &vma->node);
                if (ret) {
                        DRM_DEBUG_KMS("failed to allocate stolen GTT space\n");
                        i915_gem_vma_destroy(vma);
@@ -401,7 +401,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
        obj->has_global_gtt_mapping = 1;
 
        list_add_tail(&obj->global_list, &dev_priv->mm.bound_list);
-       list_add_tail(&obj->mm_list, &vm->inactive_list);
+       list_add_tail(&obj->mm_list, &ggtt->inactive_list);
 
        return obj;