drm/i915: Tidy aliasing_gtt_bind_vma()
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 20 Nov 2015 10:27:18 +0000 (10:27 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 23 Mar 2016 17:02:47 +0000 (18:02 +0100)
In commit 0a878716265e9af9f697264dc2e858fcc060d833
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Oct 15 14:23:01 2015 +0200

    drm/i915: restore ggtt double-bind avoidance

we wrote the ggtt_bind_vma() observing a number of cleanups we could do
over the template of aliasing_gtt_bind_vma(). Now let's apply the
cleanups we made there back to the original. The essence is to avoid
redundant variables and assignements, and by doing so make the code
easier to read.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448015238-24639-1-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_gtt.c

index 0715bb74d306256f5a1165cffddbd402d5637e7a..cbbd666b0d97680af2dda6faecd9b374c64850b1 100644 (file)
@@ -2613,32 +2613,31 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma,
                                 enum i915_cache_level cache_level,
                                 u32 flags)
 {
-       struct drm_device *dev = vma->vm->dev;
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       struct drm_i915_gem_object *obj = vma->obj;
-       struct sg_table *pages = obj->pages;
-       u32 pte_flags = 0;
+       u32 pte_flags;
        int ret;
 
        ret = i915_get_ggtt_vma_pages(vma);
        if (ret)
                return ret;
-       pages = vma->ggtt_view.pages;
 
        /* Currently applicable only to VLV */
-       if (obj->gt_ro)
+       pte_flags = 0;
+       if (vma->obj->gt_ro)
                pte_flags |= PTE_READ_ONLY;
 
 
        if (flags & GLOBAL_BIND) {
-               vma->vm->insert_entries(vma->vm, pages,
+               vma->vm->insert_entries(vma->vm,
+                                       vma->ggtt_view.pages,
                                        vma->node.start,
                                        cache_level, pte_flags);
        }
 
        if (flags & LOCAL_BIND) {
-               struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt;
-               appgtt->base.insert_entries(&appgtt->base, pages,
+               struct i915_hw_ppgtt *appgtt =
+                       to_i915(vma->vm->dev)->mm.aliasing_ppgtt;
+               appgtt->base.insert_entries(&appgtt->base,
+                                           vma->ggtt_view.pages,
                                            vma->node.start,
                                            cache_level, pte_flags);
        }