drm/i915: range-restricted eviction support
Add a mappable parameter to i915_gem_evict_something to distinguish
the two cases (non-restricted vs. mappable gtt allocations). No
functional changes because the mappable limit is set to the end of
the gtt currently.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d0aaf97..254eb0c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -187,6 +187,7 @@
end - start);
dev_priv->mm.gtt_total = end - start;
+ dev_priv->mm.gtt_mappable_end = end;
return 0;
}
@@ -413,7 +414,8 @@
struct drm_device *dev = obj->dev;
ret = i915_gem_evict_something(dev, obj->size,
- i915_gem_get_gtt_alignment(obj));
+ i915_gem_get_gtt_alignment(obj),
+ false);
if (ret)
return ret;
@@ -2672,7 +2674,7 @@
/* If the gtt is empty and we're still having trouble
* fitting our object in, we're out of memory.
*/
- ret = i915_gem_evict_something(dev, obj->size, alignment);
+ ret = i915_gem_evict_something(dev, obj->size, alignment, true);
if (ret)
return ret;
@@ -2687,7 +2689,7 @@
if (ret == -ENOMEM) {
/* first try to clear up some space from the GTT */
ret = i915_gem_evict_something(dev, obj->size,
- alignment);
+ alignment, true);
if (ret) {
/* now try to shrink everyone else */
if (gfpmask) {
@@ -2717,7 +2719,7 @@
drm_mm_put_block(obj_priv->gtt_space);
obj_priv->gtt_space = NULL;
- ret = i915_gem_evict_something(dev, obj->size, alignment);
+ ret = i915_gem_evict_something(dev, obj->size, alignment, true);
if (ret)
return ret;