Skip to content

Commit

Permalink
drm/i915: Immediately discard any backing storage for uneeded objects
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
  • Loading branch information
Chris Wilson committed Sep 23, 2009
1 parent 963b483 commit 2d7ef39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2d7ef39

Please sign in to comment.