summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorChris Wilson2014-09-09 08:02:43 +0200
committerDaniel Vetter2014-09-19 14:41:15 +0200
commit1d1ef21dafd13ff5cedbde840544d6e86669fe1d (patch)
tree56ab2f9d5d3d27fa91d151ca0a5e4ca563dd5744 /drivers/gpu/drm/i915/i915_gem.c
parentdrm/i915: Objects on the unbound list may still have an active reference (diff)
downloadkernel-qcow2-linux-1d1ef21dafd13ff5cedbde840544d6e86669fe1d.tar.gz
kernel-qcow2-linux-1d1ef21dafd13ff5cedbde840544d6e86669fe1d.tar.xz
kernel-qcow2-linux-1d1ef21dafd13ff5cedbde840544d6e86669fe1d.zip
drm/i915: Drop any active reference before unbinding
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>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1ef6700e5d98..2a5351df46da 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -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);