[Intel-gfx] [PATCH] drm/i915/gtt: Allocate va range only if vma is not bound

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 28 08:05:26 PDT 2015


On Tue, Apr 28, 2015 at 05:56:17PM +0300, Mika Kuoppala wrote:
> When we have bound vma into an address space, the layout
> of page table structures is immutable. So we can be absolutely
> certain that if vma is already bound, there is no need to
> (re)allocate a virtual address range for it.
> 
> v2: - add sanity checks and remove superfluous GLOBAL_BIND set
>     - we might do update for an unbound vma (Chris)
> 
> Testcase: igt/gem_exec_big #bdw
> Reported-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Michel Thierry <michel.thierry at intel.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 39 +++++++++++++++++++++----------------
>  1 file changed, 22 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 6fae6bd..9d3852c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1928,8 +1928,6 @@ static int ggtt_bind_vma(struct i915_vma *vma,
>  		vma->vm->insert_entries(vma->vm, pages,
>  					vma->node.start,
>  					cache_level, pte_flags);
> -
> -		vma->bound |= GLOBAL_BIND;
>  	}
>  
>  	if (dev_priv->mm.aliasing_ppgtt && flags & LOCAL_BIND) {
> @@ -2804,21 +2802,13 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
>  int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
>  		  u32 flags)
>  {
> -	int ret = 0;
> -	u32 bind_flags = 0;
> -
> -	if (vma->vm->allocate_va_range) {
> -		trace_i915_va_alloc(vma->vm, vma->node.start,
> -				    vma->node.size,
> -				    VM_TO_TRACE_NAME(vma->vm));
> +	int ret;
> +	u32 bind_flags;

Whilst you are here, can you fix this to be plain unsigned.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list