[Intel-gfx] [PATCH 1/5] drm/i915/gtt: Make I915_PDPES_PER_PDP inline function

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 28 15:36:10 UTC 2017


On Tue, Feb 28, 2017 at 05:28:07PM +0200, Mika Kuoppala wrote:
> +static inline unsigned int
> +i915_pdpes_per_pdp(const struct i915_address_space *vm)
> +{
> +	if (i915_vm_is_48bit(vm))
> +		return GEN8_PML4ES_PER_PML4;
> +
> +	return GEN8_LEGACY_PDPES;
> +}

Does this need to be in the header? Isn't it private to i915_gem_ppgtt.c?

>  /* Equivalent to the gen6 version, For each pde iterates over every pde
>   * between from start until start + length. On gen8+ it simply iterates
>   * over every page directory entry in a page directory.
> @@ -471,7 +483,7 @@ static inline u32 gen6_pde_index(u32 addr)
>  
>  #define gen8_for_each_pdpe(pd, pdp, start, length, iter)		\
>  	for (iter = gen8_pdpe_index(start);				\
> -	     length > 0 && iter < I915_PDPES_PER_PDP(dev) &&		\
> +	     length > 0 && iter < i915_pdpes_per_pdp(vm) &&		\

Oh. Because of a pair of impossible conditions here.

Add rewriting these iterators based on the knowleged that length is
assert to be > 0 and <= total - start to the task list. 

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

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list