[Intel-gfx] [PATCH v2 03/22] drm/i915: Micro-optimise gen8_ppgtt_insert_entries()

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 13 15:12:19 UTC 2017


On Mon, Feb 13, 2017 at 04:58:06PM +0200, Mika Kuoppala wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> > +static __always_inline bool
> > +gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,
> >  			      struct i915_page_directory_pointer *pdp,
> > -			      struct sg_page_iter *sg_iter,
> > -			      uint64_t start,
> > +			      struct sgt_dma *iter,
> > +			      u64 start,
> >  			      enum i915_cache_level cache_level)
> >  {
> > -	struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
> > -	gen8_pte_t *pt_vaddr;
> > -	unsigned pdpe = gen8_pdpe_index(start);
> > -	unsigned pde = gen8_pde_index(start);
> > -	unsigned pte = gen8_pte_index(start);
> > +	unsigned int pdpe = gen8_pdpe_index(start);
> > +	unsigned int pde = gen8_pde_index(start);
> > +	unsigned int pte = gen8_pte_index(start);
> > +	struct i915_page_directory *pd;
> > +	const gen8_pte_t pte_encode = gen8_pte_encode(0, cache_level);
> > +	gen8_pte_t *vaddr;
> > +	bool ret = true;
> >  
> > -	pt_vaddr = NULL;
> > +	pd = pdp->page_directory[pdpe];
> > +	vaddr = kmap_px(pd->page_table[pde]);
> > +	do {
> > +		vaddr[pte] = pte_encode | iter->dma;
> > +		iter->dma += PAGE_SIZE;
> > +		if (iter->dma >= iter->max) {
> > +			iter->sg = __sg_next(iter->sg);
> > +			if (!iter->sg) {
> > +				ret = false;
> > +				break;
> 
> We never exit with ret = true in this loop.

Indeed, and I have a test now to prove it.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list