[Intel-gfx] [PATCH i-g-t v2 2/2] tests/gem_mmap_gtt: add huge BO test
Chris Wilson
chris at chris-wilson.co.uk
Wed Apr 8 04:00:48 PDT 2015
On Wed, Apr 08, 2015 at 01:51:52PM +0300, Joonas Lahtinen wrote:
> + /* Test read/write to first/last page through CPU after GTT writes.
> + * Require that previous GTT written values still exist.
> + */
> + ptr_cpu = gem_mmap__cpu(fd, bo, 0, huge_object_size,
> + PROT_READ | PROT_WRITE);
> + if (!ptr_cpu) {
> + igt_warn("Not enough free memory to complete huge BO test!\n");
> + goto out;
> + }
> +
> + set_domain_cpu(fd, bo);
> +
> + igt_assert(memcmp(ptr_cpu , gtt_pattern, PAGE_SIZE) == 0);
> + igt_assert(memcmp(ptr_cpu + last_offset, gtt_pattern, PAGE_SIZE) == 0);
> +
> + memcpy(ptr_cpu, cpu_pattern, PAGE_SIZE);
> + igt_assert(memcmp(ptr_cpu , cpu_pattern, PAGE_SIZE) == 0);
> + igt_assert(memcmp(ptr_cpu + last_offset, gtt_pattern, PAGE_SIZE) == 0);
> +
> + memcpy(ptr_cpu + last_offset, cpu_pattern, PAGE_SIZE);
> + igt_assert(memcmp(ptr_cpu , cpu_pattern, PAGE_SIZE) == 0);
> + igt_assert(memcmp(ptr_cpu + last_offset, cpu_pattern, PAGE_SIZE) == 0);
On second thought I think this is better using pread as on non-llc
platforms this will a second gigantic clflush. Otherwise lgtm.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list