[igt-dev] [PATCH i-g-t] lib/intel_batchbuffer: Use safe alignment in fast-copy raw

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Feb 23 10:34:30 UTC 2022


On Tue, Feb 22, 2022 at 01:33:50PM -0800, Dixit, Ashutosh wrote:
> On Mon, 21 Feb 2022 00:41:23 -0800, Zbigniew Kempczyński wrote:
> >
> > diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> > index e5666cd4f..23055855b 100644
> > --- a/lib/intel_batchbuffer.c
> > +++ b/lib/intel_batchbuffer.c
> > @@ -990,13 +990,14 @@ void igt_blitter_fast_copy__raw(int fd,
> >	uint32_t dword0, dword1;
> >	uint32_t src_pitch, dst_pitch;
> >	uint64_t batch_offset, src_offset, dst_offset;
> > +	uint64_t align = gem_detect_safe_alignment(fd);
> >	int i = 0;
> >
> >	batch_handle = gem_create(fd, 4096);
> >	if (ahnd) {
> > -		src_offset = get_offset(ahnd, src_handle, src_size, 0);
> > -		dst_offset = get_offset(ahnd, dst_handle, dst_size, 0);
> > -		batch_offset = get_offset(ahnd, batch_handle, 4096, 0);
> > +		src_offset = get_offset(ahnd, src_handle, src_size, align);
> > +		dst_offset = get_offset(ahnd, dst_handle, dst_size, align);
> > +		batch_offset = get_offset(ahnd, batch_handle, 4096, align);
> 
> Is it possible to modify the allocator so that say '0' (or alternatively
> -1ULL) denotes the "default" alignment? And the default alignment will the
> safe_alignment which can be stored as part of the allocator itself?
> 
> This will avoid having to pass this safe_alignment in a large number of
> IGT's. If some IGT's want to override the default alignment they can always
> do so. Thoughts?

Yes. I like your idea - we can save a lot of time to avoid rewriting tests.

Here it is:

https://patchwork.freedesktop.org/series/100627/

--
Zbigniew


More information about the igt-dev mailing list