summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-09-20 23:13:10 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-09-23 01:10:37 +0100
commit2d7ef395b310e17c86fa6190f21ea1f2eccae5d1 (patch)
treea1886204a9266fb87dbcc584eb02b0c947d5f08d /drivers/gpu
parent963b483691314ed174ceb883f2b9f13b3ef7fb33 (diff)
downloadlinux-2d7ef395b310e17c86fa6190f21ea1f2eccae5d1.tar.gz
linux-2d7ef395b310e17c86fa6190f21ea1f2eccae5d1.tar.bz2
linux-2d7ef395b310e17c86fa6190f21ea1f2eccae5d1.zip
drm/i915: Immediately discard any backing storage for uneeded objects
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index c69f1fa38cc8..62ba9c121a14 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4110,6 +4110,11 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
obj_priv->madv = args->madv;
args->retained = obj_priv->gtt_space != NULL;
+ /* if the object is no longer bound, discard its backing storage */
+ if (i915_gem_object_is_purgeable(obj_priv) &&
+ obj_priv->gtt_space == NULL)
+ i915_gem_object_truncate(obj);
+
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);