|
@@ -237,48 +237,3 @@ int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
-/**
|
|
|
- * i915_gem_evict_everything - Try to evict all objects
|
|
|
- * @dev: Device to evict objects for
|
|
|
- *
|
|
|
- * This functions tries to evict all gem objects from all address spaces. Used
|
|
|
- * by the shrinker as a last-ditch effort and for suspend, before releasing the
|
|
|
- * backing storage of all unbound objects.
|
|
|
- */
|
|
|
-int
|
|
|
-i915_gem_evict_everything(struct drm_device *dev)
|
|
|
-{
|
|
|
- struct drm_i915_private *dev_priv = dev->dev_private;
|
|
|
- struct i915_address_space *vm, *v;
|
|
|
- bool lists_empty = true;
|
|
|
- int ret;
|
|
|
-
|
|
|
- list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
|
|
|
- lists_empty = (list_empty(&vm->inactive_list) &&
|
|
|
- list_empty(&vm->active_list));
|
|
|
- if (!lists_empty)
|
|
|
- lists_empty = false;
|
|
|
- }
|
|
|
-
|
|
|
- if (lists_empty)
|
|
|
- return -ENOSPC;
|
|
|
-
|
|
|
- trace_i915_gem_evict_everything(dev);
|
|
|
-
|
|
|
- /* The gpu_idle will flush everything in the write domain to the
|
|
|
- * active list. Then we must move everything off the active list
|
|
|
- * with retire requests.
|
|
|
- */
|
|
|
- ret = i915_gpu_idle(dev);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
-
|
|
|
- i915_gem_retire_requests(dev);
|
|
|
-
|
|
|
- /* Having flushed everything, unbind() should never raise an error */
|
|
|
- list_for_each_entry_safe(vm, v, &dev_priv->vm_list, global_link)
|
|
|
- WARN_ON(i915_gem_evict_vm(vm, false));
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|