[Intel-gfx] [PATCH i-g-t] tests/gem_mmap_gtt: add huge BO test
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Wed Apr 8 03:45:22 PDT 2015
Hi,
On ti, 2015-04-07 at 15:08 +0100, Chris Wilson wrote:
> On Tue, Apr 07, 2015 at 03:23:08PM +0300, Joonas Lahtinen wrote:
[snip]
> > +
> > + bo = gem_create(fd, huge_object_size);
> > +
> > + ptr_cpu = gem_mmap__cpu(fd, bo, 0, huge_object_size,
> > + PROT_READ | PROT_WRITE);
> > + if (!ptr_cpu) {
> > + igt_warn("Not enough free memory for huge BO test!\n");
> > + goto out;
> > + }
>
> Should be a set-domain(CPU, CPU) here.
Corrected, that went unnoticed when I moved the test to be last test.
>
> > + /* Test read/write to first/last page with CPU. */
> > + memcpy(ptr_cpu, cpu_pattern, PAGE_SIZE);
> > + igt_assert(memcmp(ptr_cpu, cpu_pattern, PAGE_SIZE) == 0);
> > +
> > + memcpy(ptr_cpu + last_offset, cpu_pattern, PAGE_SIZE);
> > + igt_assert(memcmp(ptr_cpu + last_offset, cpu_pattern, PAGE_SIZE) == 0);
> > +
> > + igt_assert(memcmp(ptr_cpu, ptr_cpu + last_offset, PAGE_SIZE) == 0);
> > +
> > + munmap(ptr_cpu, huge_object_size);
> > + ptr_cpu = NULL;
> > +
> > + ptr_gtt = gem_mmap__gtt(fd, bo, huge_object_size,
> > + PROT_READ | PROT_WRITE);
> > + if (!ptr_gtt) {
> > + igt_debug("Huge BO GTT mapping not supported!\n");
> > + goto out;
> > + }
> > +
> > + /* Test read/write to first/last page through GTT. */
> > + set_domain(fd, bo);
> > +
> > + igt_assert(memcmp(ptr_gtt, cpu_pattern, PAGE_SIZE) == 0);
> > + igt_assert(memcmp(ptr_gtt + last_offset, cpu_pattern, PAGE_SIZE) == 0);
> > +
> > + memset(ptr_gtt, 0x55, PAGE_SIZE);
> > + igt_assert(memcmp(ptr_gtt + last_offset, cpu_pattern, PAGE_SIZE) == 0);
> > +
> > + memset(ptr_gtt + last_offset, 0x55, PAGE_SIZE);
> > + igt_assert(memcmp(ptr_gtt, ptr_gtt + last_offset, PAGE_SIZE) == 0);
> > +
> > + munmap(ptr_gtt, huge_object_size);
>
> And repeat the CPU sanity check (for 0x55). Perhaps using pread this time.
>
I stuck to mmap in this test. Initial partial views revision will not
have fencing as agreed with Daniel, just checks to bail out if somebody
attempts to to partially map a tiled buffer because it's going to
require reworking all the fence calculation functions to calculate the
stride based on view size and not buffer size.
Will send a new patch (two actually) shortly.
Regards, Joonas
> And tiling checks.
> -Chris
>
More information about the Intel-gfx
mailing list