drm/i915: Move vm page allocation in proper place
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Fri, 10 Apr 2015 12:54:58 +0000 (15:54 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 10 Apr 2015 14:18:02 +0000 (16:18 +0200)
Move to i915_vma_bind as it is part of the binding.

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_gtt.c

index 8d28a5d2437fbcff940dd13f50bb09d084d9b268..8ce363aa492c991fae1a2b25b1b7b9014ee26cbb 100644 (file)
@@ -3556,17 +3556,6 @@ search_free:
        if (ret)
                goto err_remove_node;
 
-       /*  allocate before insert / bind */
-       if (vma->vm->allocate_va_range) {
-               trace_i915_va_alloc(vma->vm, vma->node.start, vma->node.size,
-                               VM_TO_TRACE_NAME(vma->vm));
-               ret = vma->vm->allocate_va_range(vma->vm,
-                                               vma->node.start,
-                                               vma->node.size);
-               if (ret)
-                       goto err_remove_node;
-       }
-
        trace_i915_vma_bind(vma, flags);
        ret = i915_vma_bind(vma, obj->cache_level,
                            flags & PIN_GLOBAL ? GLOBAL_BIND : 0);
index 559cecaccf7ff27e3871408522661502abef6975..0b679143772aecf6758092307d90c3e220f3cd45 100644 (file)
@@ -2927,8 +2927,22 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
 int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
                  u32 flags)
 {
+       int ret;
+
+       if (vma->vm->allocate_va_range) {
+               trace_i915_va_alloc(vma->vm, vma->node.start,
+                                   vma->node.size,
+                                   VM_TO_TRACE_NAME(vma->vm));
+
+               ret = vma->vm->allocate_va_range(vma->vm,
+                                                vma->node.start,
+                                                vma->node.size);
+               if (ret)
+                       return ret;
+       }
+
        if (i915_is_ggtt(vma->vm)) {
-               int ret = i915_get_ggtt_vma_pages(vma);
+               ret = i915_get_ggtt_vma_pages(vma);
 
                if (ret)
                        return ret;