Re: [PATCH 1/3] drm/i915: Cleanup i915_gem_restore_gtt_mappings()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 18, 2016 at 12:06:01PM +0200, David Weinehall wrote:
> On resume we unbind+bind our VMA-mappings. This patch simplifies
> this a bit by introducing a rebind() helper.  As a nice side-effect
> this also makes the resume callgraph self-documenting.
> 
> Patch by Chris.
> 
> Signed-off-by: David Weinehall <david.weinehall@xxxxxxxxxxxxxxx>
> CC: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Not really sold all that much on this being more readable. Looks correct,
but needs some more acks form Tvrtko or Joonas. With that you can have my
r-b. Patches 2&3 look correct and are

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |  7 +------
>  drivers/gpu/drm/i915/i915_vma.c     | 10 ++++++++++
>  drivers/gpu/drm/i915/i915_vma.h     |  6 ++++--
>  3 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index b4bde1452f2a..76af33443fcd 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3299,12 +3299,7 @@ void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
>  			if (vma->vm != &ggtt->base)
>  				continue;
>  
> -			if (!i915_vma_unbind(vma))
> -				continue;
> -
> -			WARN_ON(i915_vma_bind(vma, obj->cache_level,
> -					      PIN_UPDATE));
> -			ggtt_bound = true;
> +			ggtt_bound |= i915_vma_rebind(vma);
>  		}
>  
>  		if (ggtt_bound)
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 738ff3a5cd6e..1fc54686c2c3 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -648,3 +648,13 @@ int i915_vma_unbind(struct i915_vma *vma)
>  	return 0;
>  }
>  
> +bool i915_vma_rebind(struct i915_vma *vma)
> +{
> +	if (i915_vma_is_pinned(vma)) {
> +		WARN_ON(i915_vma_bind(vma, vma->obj->cache_level, PIN_UPDATE));
> +		return true;
> +	} else {
> +		WARN_ON(i915_vma_unbind(vma));
> +		return false;
> +	}
> +}
> diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
> index 2e49f5dd6107..16fa9cdc0dd2 100644
> --- a/drivers/gpu/drm/i915/i915_vma.h
> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -200,8 +200,11 @@ i915_vma_compare(struct i915_vma *vma,
>  		      sizeof(view->params));
>  }
>  
> -int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> +int i915_vma_bind(struct i915_vma *vma,
> +		  enum i915_cache_level cache_level,
>  		  u32 flags);
> +bool i915_vma_rebind(struct i915_vma *vma);
> +
>  bool i915_gem_valid_gtt_space(struct i915_vma *vma, unsigned long cache_level);
>  bool
>  i915_vma_misplaced(struct i915_vma *vma, u64 size, u64 alignment, u64 flags);
> @@ -339,4 +342,3 @@ i915_vma_unpin_fence(struct i915_vma *vma)
>  }
>  
>  #endif
> -
> -- 
> 2.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux