|
@@ -46,6 +46,25 @@ mark_free(struct i915_vma *vma, struct list_head *unwind)
|
|
|
return drm_mm_scan_add_block(&vma->node);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * i915_gem_evict_something - Evict vmas to make room for binding a new one
|
|
|
+ * @dev: drm_device
|
|
|
+ * @vm: address space to evict from
|
|
|
+ * @size: size of the desired free space
|
|
|
+ * @alignment: alignment constraint of the desired free space
|
|
|
+ * @cache_level: cache_level for the desired space
|
|
|
+ * @mappable: whether the free space must be mappable
|
|
|
+ * @nonblocking: whether evicting active objects is allowed or not
|
|
|
+ *
|
|
|
+ * This function will try to evict vmas until a free space satisfying the
|
|
|
+ * requirements is found. Callers must check first whether any such hole exists
|
|
|
+ * already before calling this function.
|
|
|
+ *
|
|
|
+ * This function is used by the object/vma binding code.
|
|
|
+ *
|
|
|
+ * To clarify: This is for freeing up virtual address space, not for freeing
|
|
|
+ * memory in e.g. the shrinker.
|
|
|
+ */
|
|
|
int
|
|
|
i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
|
|
|
int min_size, unsigned alignment, unsigned cache_level,
|
|
@@ -177,19 +196,19 @@ found:
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * i915_gem_evict_vm - Try to free up VM space
|
|
|
+ * i915_gem_evict_vm - Evict all idle vmas from a vm
|
|
|
*
|
|
|
- * @vm: Address space to evict from
|
|
|
+ * @vm: Address space to cleanse
|
|
|
* @do_idle: Boolean directing whether to idle first.
|
|
|
*
|
|
|
- * VM eviction is about freeing up virtual address space. If one wants fine
|
|
|
- * grained eviction, they should see evict something for more details. In terms
|
|
|
- * of freeing up actual system memory, this function may not accomplish the
|
|
|
- * desired result. An object may be shared in multiple address space, and this
|
|
|
- * function will not assert those objects be freed.
|
|
|
+ * This function evicts all idles vmas from a vm. If all unpinned vmas should be
|
|
|
+ * evicted the @do_idle needs to be set to true.
|
|
|
*
|
|
|
- * Using do_idle will result in a more complete eviction because it retires, and
|
|
|
- * inactivates current BOs.
|
|
|
+ * This is used by the execbuf code as a last-ditch effort to defragment the
|
|
|
+ * address space.
|
|
|
+ *
|
|
|
+ * To clarify: This is for freeing up virtual address space, not for freeing
|
|
|
+ * memory in e.g. the shrinker.
|
|
|
*/
|
|
|
int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle)
|
|
|
{
|
|
@@ -213,6 +232,14 @@ 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)
|
|
|
{
|