Since

commit 43566dedde54f9729113f5f9fde77d53e75e61e9
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Jan 2 16:29:29 2015 +0530

    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()!

v2: Akash worried that we were discarding the serialisation point with
outstanding GTT writes before doing the unbind, so restore the wmb() for
the writes. We only lose the write domain now, and not both - 1 one
sided barrier now, rather than 2 full barriers previously.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Akash Goel <akash.g...@intel.com>
Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 13e83fd3a780..205549dbd78a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3171,23 +3171,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)
-{
-       /* 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;
-
-       /* Wait for any direct GTT access to complete */
-       mb();
-
-       obj->base.read_domains &= ~I915_GEM_DOMAIN_GTT;
-       obj->base.write_domain &= ~I915_GEM_DOMAIN_GTT;
-
-       trace_i915_gem_object_change_domain(obj);
-}
-
 int i915_vma_unbind(struct i915_vma *vma)
 {
        struct drm_i915_gem_object *obj = vma->obj;
@@ -3219,12 +3202,15 @@ int i915_vma_unbind(struct i915_vma *vma)
         */
 
        if (vma->is_ggtt && vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL) {
-               i915_gem_object_finish_gtt(obj);
+               i915_gem_object_flush_gtt_write_domain(obj);
 
                /* release the fence reg _after_ flushing */
                ret = i915_gem_object_put_fence(obj);
                if (ret)
                        return ret;
+
+               /* Force a pagefault for domain tracking on next user access */
+               i915_gem_release_mmap(obj);
        }
 
        trace_i915_vma_unbind(vma);
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to