[145/190] drm/i915: Stop discarding GTT cache-domain on unbind vma
diff mbox

Message ID 1452510091-6833-4-git-send-email-chris@chris-wilson.co.uk
State New
Headers show

Commit Message

Chris Wilson Jan. 11, 2016, 11 a.m. UTC
Since

commit 43566dedde54f9729113f5f9fde77d53e75e61e9
Author: Chris Wilson <chris@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()!

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>
---
 drivers/gpu/drm/i915/i915_gem.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

Comments

Joonas Lahtinen Jan. 12, 2016, 1:22 p.m. UTC | #1
On ma, 2016-01-11 at 11:00 +0000, Chris Wilson wrote:
> Since
> 
> commit 43566dedde54f9729113f5f9fde77d53e75e61e9
> Author: Chris Wilson <chris@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()!
> 
> 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>

I'm fairly sure I did this already in the past, but here goes again...

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 26 +++-----------------------
>  1 file changed, 3 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c
> b/drivers/gpu/drm/i915/i915_gem.c
> index 6ceed074f738..08287d8857c9 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2618,27 +2618,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_destroy(struct i915_vma *vma)
>  {
>  	GEM_BUG_ON(vma->node.allocated);
> @@ -2691,13 +2670,14 @@ int i915_vma_unbind(struct i915_vma *vma)
>  	GEM_BUG_ON(obj->pages == NULL);
>  
>  	if (vma->map_and_fenceable) {
> -		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);
> +
>  		if (vma->iomap) {
>  			iounmap(vma->iomap);
>  			vma->iomap = NULL;

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6ceed074f738..08287d8857c9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2618,27 +2618,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_destroy(struct i915_vma *vma)
 {
 	GEM_BUG_ON(vma->node.allocated);
@@ -2691,13 +2670,14 @@  int i915_vma_unbind(struct i915_vma *vma)
 	GEM_BUG_ON(obj->pages == NULL);
 
 	if (vma->map_and_fenceable) {
-		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);
+
 		if (vma->iomap) {
 			iounmap(vma->iomap);
 			vma->iomap = NULL;