diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-01-29 16:07:11 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-01-29 16:19:17 -0500 |
commit | c2c1d4912cd7028384d7f25d2faefefb8958f64d (patch) | |
tree | fb536b1a9f7cbd39722fc60ef7243f599bb61f77 | |
parent | 3036537dbfeaa9940bad7cbdab6671576e1dff69 (diff) |
drm/i915: Kerneldoc for i915_gem_evict.c
Request by Ben Widawsky in his review of a patch touching this code.
v2: Clarify the disdinction between evicting vmas (to free up virtual
address space) and evicting objects (to free up actual system memory).
Suggested by Ben.
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Acked-by: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_evict.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index 50e7e3a5d1cb..5168d6a08054 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c | |||
@@ -46,6 +46,25 @@ mark_free(struct i915_vma *vma, struct list_head *unwind) | |||
46 | return drm_mm_scan_add_block(&vma->node); | 46 | return drm_mm_scan_add_block(&vma->node); |
47 | } | 47 | } |
48 | 48 | ||
49 | /** | ||
50 | * i915_gem_evict_something - Evict vmas to make room for binding a new one | ||
51 | * @dev: drm_device | ||
52 | * @vm: address space to evict from | ||
53 | * @size: size of the desired free space | ||
54 | * @alignment: alignment constraint of the desired free space | ||
55 | * @cache_level: cache_level for the desired space | ||
56 | * @mappable: whether the free space must be mappable | ||
57 | * @nonblocking: whether evicting active objects is allowed or not | ||
58 | * | ||
59 | * This function will try to evict vmas until a free space satisfying the | ||
60 | * requirements is found. Callers must check first whether any such hole exists | ||
61 | * already before calling this function. | ||
62 | * | ||
63 | * This function is used by the object/vma binding code. | ||
64 | * | ||
65 | * To clarify: This is for freeing up virtual address space, not for freeing | ||
66 | * memory in e.g. the shrinker. | ||
67 | */ | ||
49 | int | 68 | int |
50 | i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, | 69 | i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, |
51 | int min_size, unsigned alignment, unsigned cache_level, | 70 | int min_size, unsigned alignment, unsigned cache_level, |
@@ -177,19 +196,19 @@ found: | |||
177 | } | 196 | } |
178 | 197 | ||
179 | /** | 198 | /** |
180 | * i915_gem_evict_vm - Try to free up VM space | 199 | * i915_gem_evict_vm - Evict all idle vmas from a vm |
181 | * | 200 | * |
182 | * @vm: Address space to evict from | 201 | * @vm: Address space to cleanse |
183 | * @do_idle: Boolean directing whether to idle first. | 202 | * @do_idle: Boolean directing whether to idle first. |
184 | * | 203 | * |
185 | * VM eviction is about freeing up virtual address space. If one wants fine | 204 | * This function evicts all idles vmas from a vm. If all unpinned vmas should be |
186 | * grained eviction, they should see evict something for more details. In terms | 205 | * evicted the @do_idle needs to be set to true. |
187 | * of freeing up actual system memory, this function may not accomplish the | ||
188 | * desired result. An object may be shared in multiple address space, and this | ||
189 | * function will not assert those objects be freed. | ||
190 | * | 206 | * |
191 | * Using do_idle will result in a more complete eviction because it retires, and | 207 | * This is used by the execbuf code as a last-ditch effort to defragment the |
192 | * inactivates current BOs. | 208 | * address space. |
209 | * | ||
210 | * To clarify: This is for freeing up virtual address space, not for freeing | ||
211 | * memory in e.g. the shrinker. | ||
193 | */ | 212 | */ |
194 | int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle) | 213 | int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle) |
195 | { | 214 | { |
@@ -213,6 +232,14 @@ int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle) | |||
213 | return 0; | 232 | return 0; |
214 | } | 233 | } |
215 | 234 | ||
235 | /** | ||
236 | * i915_gem_evict_everything - Try to evict all objects | ||
237 | * @dev: Device to evict objects for | ||
238 | * | ||
239 | * This functions tries to evict all gem objects from all address spaces. Used | ||
240 | * by the shrinker as a last-ditch effort and for suspend, before releasing the | ||
241 | * backing storage of all unbound objects. | ||
242 | */ | ||
216 | int | 243 | int |
217 | i915_gem_evict_everything(struct drm_device *dev) | 244 | i915_gem_evict_everything(struct drm_device *dev) |
218 | { | 245 | { |