aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2013-07-31 20:00:16 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-08 08:10:20 -0400
commit8b9c2b9411dd55617442f8151fb6fb2849c72f7e (patch)
tree93098931e345d8e44c878386e465191cbee7182f
parent95f5301dd880da2dea2c9a9c29750064536d426a (diff)
drm/i915: Add vma to list at creation
With the current code there shouldn't be a distinction - however with an upcoming change we intend to allocate a vma much earlier, before it's actually bound anywhere. To do this we have to check node allocation as well for the _bound() check. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> [danvet: move list_del(&vma->vma_link) from vma_unbind to vma_destroy, again fallout from the loss of "rm/i915: Cleanup more of VMA in destroy".] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> fixup for drm/i915: Add vma to list at creation
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 985a13035550..f5d389a20024 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2642,7 +2642,6 @@ int i915_vma_unbind(struct i915_vma *vma)
2642 if (i915_is_ggtt(vma->vm)) 2642 if (i915_is_ggtt(vma->vm))
2643 obj->map_and_fenceable = true; 2643 obj->map_and_fenceable = true;
2644 2644
2645 list_del(&vma->vma_link);
2646 drm_mm_remove_node(&vma->node); 2645 drm_mm_remove_node(&vma->node);
2647 i915_gem_vma_destroy(vma); 2646 i915_gem_vma_destroy(vma);
2648 2647
@@ -3186,12 +3185,6 @@ search_free:
3186 list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); 3185 list_move_tail(&obj->global_list, &dev_priv->mm.bound_list);
3187 list_add_tail(&vma->mm_list, &vm->inactive_list); 3186 list_add_tail(&vma->mm_list, &vm->inactive_list);
3188 3187
3189 /* Keep GGTT vmas first to make debug easier */
3190 if (i915_is_ggtt(vm))
3191 list_add(&vma->vma_link, &obj->vma_list);
3192 else
3193 list_add_tail(&vma->vma_link, &obj->vma_list);
3194
3195 fenceable = 3188 fenceable =
3196 i915_is_ggtt(vm) && 3189 i915_is_ggtt(vm) &&
3197 i915_gem_obj_ggtt_size(obj) == fence_size && 3190 i915_gem_obj_ggtt_size(obj) == fence_size &&
@@ -4074,12 +4067,19 @@ struct i915_vma *i915_gem_vma_create(struct drm_i915_gem_object *obj,
4074 vma->vm = vm; 4067 vma->vm = vm;
4075 vma->obj = obj; 4068 vma->obj = obj;
4076 4069
4070 /* Keep GGTT vmas first to make debug easier */
4071 if (i915_is_ggtt(vm))
4072 list_add(&vma->vma_link, &obj->vma_list);
4073 else
4074 list_add_tail(&vma->vma_link, &obj->vma_list);
4075
4077 return vma; 4076 return vma;
4078} 4077}
4079 4078
4080void i915_gem_vma_destroy(struct i915_vma *vma) 4079void i915_gem_vma_destroy(struct i915_vma *vma)
4081{ 4080{
4082 WARN_ON(vma->node.allocated); 4081 WARN_ON(vma->node.allocated);
4082 list_del(&vma->vma_link);
4083 kfree(vma); 4083 kfree(vma);
4084} 4084}
4085 4085
@@ -4767,7 +4767,7 @@ bool i915_gem_obj_bound(struct drm_i915_gem_object *o,
4767 struct i915_vma *vma; 4767 struct i915_vma *vma;
4768 4768
4769 list_for_each_entry(vma, &o->vma_list, vma_link) 4769 list_for_each_entry(vma, &o->vma_list, vma_link)
4770 if (vma->vm == vm) 4770 if (vma->vm == vm && drm_mm_node_allocated(&vma->node))
4771 return true; 4771 return true;
4772 4772
4773 return false; 4773 return false;