[igt-dev] [PATCH i-g-t 4/9] tests/prime_mmap: use device coherent mapping instead of mmap_gtt

Dixit, Ashutosh ashutosh.dixit at intel.com
Tue Feb 4 06:29:24 UTC 2020


On Fri, 31 Jan 2020 22:57:29 -0800, Dixit, Ashutosh wrote:
>
> On Fri, 31 Jan 2020 09:31:04 -0800, Ramalingam C wrote:
> >
> > Since on new discrete GPUs we dont have the mappable aperture, if that
> > is acceptable for the test purpose, we should use GEM_MMAP_OFFSET.
> > Hence using gem_mmap_device_coherent() which wraps the mmap options in
> > the order of gem_mmap_offset / gem_mmap / mmap_gtt
> >
> > Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
> > ---
> >  tests/prime_mmap.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/prime_mmap.c b/tests/prime_mmap.c
> > index fc985784407b..1433424109c8 100644
> > --- a/tests/prime_mmap.c
> > +++ b/tests/prime_mmap.c
> > @@ -85,8 +85,8 @@ test_correct(void)
> >	dma_buf_fd = prime_handle_to_fd(fd, handle);
> >	igt_assert(errno == 0);
> >
> > -	/* Check correctness vs GEM_MMAP_GTT */
> > -	ptr1 = gem_mmap__gtt(fd, handle, BO_SIZE, PROT_READ);
> > +	/* Check correctness vs GEM_MMAP */
> > +	ptr1 = gem_mmap__device_coherent(fd, handle, 0, BO_SIZE, PROT_READ);
>
> Once again, does this test pass with gtt mapping but fail with wc mapping?
> I thought gtt mapping also bypasses the cache like wc? What about prime
> mmap's? Can someone please confirm? Otherwise I will try to look.

Similar to prime_mmap_coherency: according to Chris "the gtt mapping uses
WC" so cache effects for both WC and GTT mappings should be
equivalent. Also it is the regular handle not the prime handle which is
being mmap'd using gem_mmap__device_coherent(). Therefore:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>


More information about the igt-dev mailing list