[igt-dev] [PATCH i-g-t v3 07/52] lib/intel_batchbuffer: Try to avoid relocations in blitting

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu Aug 5 07:34:25 UTC 2021


On Wed, Aug 04, 2021 at 04:42:30PM -0700, Dixit, Ashutosh wrote:
> On Mon, 26 Jul 2021 12:59:41 -0700, Zbigniew Kempczyński wrote:
> >
> > We're proposing not overlapping offsets in both blitter copying functions
> > so we can try to skip relocations.
> 
> OK, afaiu I915_EXEC_NO_RELOC is a hint so when I915_EXEC_IS_PINNED is not
> specified relocations will be applied when needed (and we are providing
> presumed_offset's even in the relocation case):

If you use NO_RELOC relocations will be applied only when kernel decides
to move your object offset. Otherwise relocation won't appear. So passing
NO_RELOC, presumed_offset == -1, obj.offset == 0x40000 won't relocate
unless kernel will move obj to different offset. So if you just provide
batch without 0x40000 you can expect not valid result or hang.

--
Zbigniew

> 
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
> 
> > Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> > Cc: Petri Latvala <petri.latvala at intel.com>
> > Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  lib/intel_batchbuffer.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> > index d4a59e508..bbf8e0da2 100644
> > --- a/lib/intel_batchbuffer.c
> > +++ b/lib/intel_batchbuffer.c
> > @@ -711,7 +711,7 @@ static void exec_blit(int fd,
> >	struct drm_i915_gem_execbuffer2 exec = {
> >		.buffers_ptr = to_user_pointer(objs),
> >		.buffer_count = count,
> > -		.flags = gen >= 6 ? I915_EXEC_BLT : 0,
> > +		.flags = gen >= 6 ? I915_EXEC_BLT : 0 | I915_EXEC_NO_RELOC,
> >		.rsvd1 = ctx,
> >	};
> >
> > --
> > 2.26.0
> >


More information about the igt-dev mailing list