drm/i915: Stop discarding GTT cache-domain on unbind vma
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 16:17:09 +0000 (17:17 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 21:36:57 +0000 (22:36 +0100)
Since commit 43566dedde54 ("drm/i915: Broaden application of
set-domain(GTT)") we allowed objects to be in the GTT domain, but unbound.
Therefore removing the GTT cache domain when removing the GGTT vma is no
longer semantically correct.

An unfortunate side-effect is we lose the wondrously named
i915_gem_object_finish_gtt(), not to be confused with
i915_gem_gtt_finish_object()!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Akash Goel <akash.goel@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160818161718.27187-30-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c

index 14c624ee6dbf5318417e018f6d522d42bf97f035..0e1f5dde2e872016ac3f27bf50023e0d53445931 100644 (file)
@@ -2857,27 +2857,6 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,
        return 0;
 }
 
-static void i915_gem_object_finish_gtt(struct drm_i915_gem_object *obj)
-{
-       u32 old_write_domain, old_read_domains;
-
-       /* Force a pagefault for domain tracking on next user access */
-       i915_gem_release_mmap(obj);
-
-       if ((obj->base.read_domains & I915_GEM_DOMAIN_GTT) == 0)
-               return;
-
-       old_read_domains = obj->base.read_domains;
-       old_write_domain = obj->base.write_domain;
-
-       obj->base.read_domains &= ~I915_GEM_DOMAIN_GTT;
-       obj->base.write_domain &= ~I915_GEM_DOMAIN_GTT;
-
-       trace_i915_gem_object_change_domain(obj,
-                                           old_read_domains,
-                                           old_write_domain);
-}
-
 static void __i915_vma_iounmap(struct i915_vma *vma)
 {
        GEM_BUG_ON(i915_vma_is_pinned(vma));
@@ -2933,13 +2912,14 @@ int i915_vma_unbind(struct i915_vma *vma)
        GEM_BUG_ON(!obj->pages);
 
        if (i915_vma_is_map_and_fenceable(vma)) {
-               i915_gem_object_finish_gtt(obj);
-
                /* release the fence reg _after_ flushing */
                ret = i915_vma_put_fence(vma);
                if (ret)
                        return ret;
 
+               /* Force a pagefault for domain tracking on next user access */
+               i915_gem_release_mmap(obj);
+
                __i915_vma_iounmap(vma);
                vma->flags &= ~I915_VMA_CAN_FENCE;
        }