Skip to content

Commit

Permalink
drm/i915: Drop any active reference before unbinding
Browse files Browse the repository at this point in the history
Before we process the final unbind on an object and move it to the
unbound list, it is semantically cleaner if there are no more active
references to the object. (An active reference would imply that it was
still being accessed by the GPU after it became inaccessible.) The
caveat is that all callsites must be prepared for the object to
disappeared during the unbind - i.e. they must hold their own reference.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Sep 19, 2014
1 parent 21ab4e7 commit 1d1ef21
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,9 @@ int i915_vma_unbind(struct i915_vma *vma)
* cause memory corruption through use-after-free.
*/

/* Throw away the active reference before moving to the unbound list */
i915_gem_object_retire(obj);

if (i915_is_ggtt(vma->vm)) {
i915_gem_object_finish_gtt(obj);

Expand Down

0 comments on commit 1d1ef21

Please sign in to comment.