diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c69f1fa38cc8174d927deb307d4a9021688dbb6d..62ba9c121a1406c3ab93b1acba281df1ff9ee7ae 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);