drm/i915: Only do gtt cleanup in vma_unbind for the global vma
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 14 Feb 2014 13:06:07 +0000 (14:06 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 14 May 2014 16:39:54 +0000 (18:39 +0200)
Otherwise we end up tearing down fences when e.g. the client quits
way too early. Might or might not fix a fence pin_count BUG Ville has
reported.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem.c

index ec774d95cf9966eb7b40a6ade23ab3d1855766e1..034ba2c6064aa31598dced1a984e232129af236f 100644 (file)
@@ -2761,12 +2761,14 @@ int i915_vma_unbind(struct i915_vma *vma)
         * cause memory corruption through use-after-free.
         */
 
-       i915_gem_object_finish_gtt(obj);
+       if (i915_is_ggtt(vma->vm)) {
+               i915_gem_object_finish_gtt(obj);
 
-       /* release the fence reg _after_ flushing */
-       ret = i915_gem_object_put_fence(obj);
-       if (ret)
-               return ret;
+               /* release the fence reg _after_ flushing */
+               ret = i915_gem_object_put_fence(obj);
+               if (ret)
+                       return ret;
+       }
 
        trace_i915_vma_unbind(vma);