[Mesa-dev] [PATCH 2/3] i965: Convert reloc.target_handle into an index for I915_EXEC_HANDLE_LUT

Chris Wilson chris at chris-wilson.co.uk
Fri May 26 18:03:04 UTC 2017


On Fri, May 26, 2017 at 10:47:18AM -0700, Kenneth Graunke wrote:
> On Friday, May 26, 2017 4:25:20 AM PDT Chris Wilson wrote:
> > Passing the index of the target buffer via the reloc.target_handle is
> > marginally more efficient for the kernel (it can avoid some allocations,
> > and can use a direct lookup rather than a hash or search). It is also
> > useful for ourselves as we can use the index into our exec_bos for other
> > tasks.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Kenneth Graunke <kenneth at whitecape.org>
> > Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> > ---
> >  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 30 ++++++++++++++++++---------
> >  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> I wrote this patch as well, and it turned out to hurt performance by a
> small amount in every CPU-limited benchmark I tried.

If you are end up looking at many relocs, yeah. I've used yet another
array just to store the batch relocs that needed fixing up, but with
BATCH_FIRST it's not required.
 
> I think the extra loop to rewrite -1 to the batch index was enough to
> make it hurt.  That would go away with I915_EXEC_BATCH_FIRST...

With a very small change, it looks like we can apply patch 3 first and
then only apply HANDLE_LUT when we have BATCH_FIRST. I'll play a bit
more, but I was surprised at how close the code was for NO_RELOC and
wanted to share!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the mesa-dev mailing list