From 2d7ef395b310e17c86fa6190f21ea1f2eccae5d1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 20 Sep 2009 23:13:10 +0100 Subject: drm/i915: Immediately discard any backing storage for uneeded objects Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/gpu/drm') diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c69f1fa38cc..62ba9c121a1 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); -- cgit v1.2.3