summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorChris Wilson2010-10-31 09:49:47 +0100
committerChris Wilson2010-10-31 13:31:30 +0100
commit5eac3ab45955b32f3a9d89e633918c4d6f133dfa (patch)
tree302cc30dde39e47dc238bc440bef87a267e9b656 /drivers/gpu/drm/i915/i915_gem.c
parentdrm/i915: Fix typo from e5281ccd in i915_gem_attach_phys_object() (diff)
downloadkernel-qcow2-linux-5eac3ab45955b32f3a9d89e633918c4d6f133dfa.tar.gz
kernel-qcow2-linux-5eac3ab45955b32f3a9d89e633918c4d6f133dfa.tar.xz
kernel-qcow2-linux-5eac3ab45955b32f3a9d89e633918c4d6f133dfa.zip
drm/i915: Evict just the purgeable GTT entries on the first pass
Take two passes to evict everything whilst searching for sufficient free space to bind the batchbuffer. After searching for sufficient free space using LRU eviction, evict everything that is purgeable and try again. Only then if there is insufficient free space (or the GTT is too badly fragmented) evict everything from the aperture and try one last time. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e3fc333e2e57..c8e516d3f8bc 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3519,7 +3519,8 @@ i915_gem_execbuffer_pin(struct drm_device *dev,
int ret, i, retry;
/* attempt to pin all of the buffers into the GTT */
- for (retry = 0; retry < 2; retry++) {
+ retry = 0;
+ do {
ret = 0;
for (i = 0; i < count; i++) {
struct drm_i915_gem_exec_object2 *entry = &exec_list[i];
@@ -3567,18 +3568,18 @@ i915_gem_execbuffer_pin(struct drm_device *dev,
while (i--)
i915_gem_object_unpin(object_list[i]);
- if (ret == 0)
- break;
-
- if (ret != -ENOSPC || retry)
+ if (ret != -ENOSPC || retry > 1)
return ret;
- ret = i915_gem_evict_everything(dev);
+ /* First attempt, just clear anything that is purgeable.
+ * Second attempt, clear the entire GTT.
+ */
+ ret = i915_gem_evict_everything(dev, retry == 0);
if (ret)
return ret;
- }
- return 0;
+ retry++;
+ } while (1);
}
/* Throttle our rendering by waiting until the ring has completed our requests
@@ -4484,7 +4485,7 @@ i915_gem_idle(struct drm_device *dev)
/* Under UMS, be paranoid and evict. */
if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
- ret = i915_gem_evict_inactive(dev);
+ ret = i915_gem_evict_inactive(dev, false);
if (ret) {
mutex_unlock(&dev->struct_mutex);
return ret;