From 5be93cf38b4b1a29fc46dd80a586bcc1eb25e438 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 8 May 2017 16:57:18 +0100 Subject: igt/gem_mmap_gtt: Check that userspace clflushing of the GTT mmap References: https://bugs.freedesktop.org/show_bug.cgi?id=100971 Signed-off-by: Chris Wilson --- tests/gem_mmap_gtt.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/gem_mmap_gtt.c') diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index 1fb1f015..4ff5e7f1 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -341,6 +341,25 @@ test_coherency(int fd) gem_close(fd, handle); } +static void +test_clflush(int fd) +{ + uint32_t handle; + uint32_t *gtt; + + igt_require(igt_setup_clflush()); + + handle = gem_create(fd, OBJECT_SIZE); + + gtt = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); + set_domain_gtt(fd, handle); + + igt_clflush_range(gtt, OBJECT_SIZE); + + munmap(gtt, OBJECT_SIZE); + gem_close(fd, handle); +} + static void test_hang(int fd) { @@ -792,6 +811,8 @@ igt_main test_write_gtt(fd); igt_subtest("coherency") test_coherency(fd); + igt_subtest("clflush") + test_clflush(fd); igt_subtest("hang") test_hang(fd); igt_subtest("basic-read-write") -- cgit v1.2.3