Commit f5af1659 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Add a simple is-bound check before unbinding

Only acquire the various atomic references required to unbind the vma if
we do need to unbind the vma.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarImre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191222210256.2066451-1-chris@chris-wilson.co.uk
parent 4941f35b
......@@ -138,6 +138,10 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
struct i915_address_space *vm = vma->vm;
bool awake = false;
list_move_tail(&vma->obj_link, &still_in_list);
if (!i915_vma_is_bound(vma, I915_VMA_BIND_MASK))
continue;
ret = -EAGAIN;
if (!i915_vm_tryopen(vm))
break;
......@@ -153,7 +157,6 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
}
}
list_move_tail(&vma->obj_link, &still_in_list);
spin_unlock(&obj->vma.lock);
ret = -EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment