[igt-dev] [RFC 1/5] tests/prime_self_import: Swap gtt mapping for cpu

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 21 22:08:25 UTC 2019


Quoting Antonio Argenziano (2019-02-21 21:51:14)
> 
> 
> On 21/02/19 11:46, Chris Wilson wrote:
> > Quoting Antonio Argenziano (2019-02-21 19:27:41)
> >> The test uses gtt mapping to check two BOs have the same content, since
> >> it seems there is no contention on the BOs use cpu mapping to make it
> >> compatible with platforms that do not have a mappable aperture.
> >>
> >> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
> >> ---
> >>   tests/prime_self_import.c | 4 ++--
> >>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
> >> index 8c4f5321..905ffffb 100644
> >> --- a/tests/prime_self_import.c
> >> +++ b/tests/prime_self_import.c
> >> @@ -59,8 +59,8 @@ check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2)
> >>          char *ptr1, *ptr2;
> >>          int i;
> >>   
> >> -       ptr1 = gem_mmap__gtt(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE);
> >> -       ptr2 = gem_mmap__gtt(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE);
> >> +       ptr1 = gem_mmap__cpu(fd1, handle1, 0, BO_SIZE, PROT_READ | PROT_WRITE);
> >> +       ptr2 = gem_mmap__cpu(fd2, handle2, 0, BO_SIZE, PROT_READ | PROT_WRITE);
> > 
> > set_domain() would be required for pedagogy, mmap__gtt is magic.
> 
> Why do we need the set_domain here? It looks like we are not writing to 
> those BOs.

gem_mmap__gtt() is an implicit set_domain, gem_mmap__cpu() is not.
(Learn from our mistakes!)

check_bo is both a reader and writer
-Chris


More information about the igt-dev mailing list