diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-04-13 08:18:10 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-04-13 10:10:24 +0100 |
commit | 3bdafec92fae2d04cb69354ffc26e1e32ac60d65 (patch) | |
tree | 0315cc61e7fa53309fed2842d59bc6bdb754ae5b /tests/gem_exec_reloc.c | |
parent | 1ace3e0210400b70c60fcac11217a5b28b20b86e (diff) |
igt/gem_exec_reloc: Check interactions with WC domain
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_exec_reloc.c')
-rw-r--r-- | tests/gem_exec_reloc.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/tests/gem_exec_reloc.c b/tests/gem_exec_reloc.c index f3da7d0a..39b7810e 100644 --- a/tests/gem_exec_reloc.c +++ b/tests/gem_exec_reloc.c @@ -145,7 +145,7 @@ static void from_mmap(int fd, uint64_t size, enum mode mode) reloc_handle = gem_create(fd, size); relocs = gem_mmap__wc(fd, reloc_handle, 0, size, PROT_WRITE); gem_set_domain(fd, reloc_handle, - I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); + I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC); gem_close(fd, reloc_handle); break; } @@ -376,6 +376,8 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags) if (before == I915_GEM_DOMAIN_CPU) wc = gem_mmap__cpu(fd, obj.handle, 0, OBJSZ, PROT_WRITE); else if (before == I915_GEM_DOMAIN_GTT) + wc = gem_mmap__gtt(fd, obj.handle, OBJSZ, PROT_WRITE); + else if (before == I915_GEM_DOMAIN_WC) wc = gem_mmap__wc(fd, obj.handle, 0, OBJSZ, PROT_WRITE); else igt_assert(0); @@ -403,6 +405,8 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags) if (after == I915_GEM_DOMAIN_CPU) wc = gem_mmap__cpu(fd, obj.handle, 0, OBJSZ, PROT_READ); else if (after == I915_GEM_DOMAIN_GTT) + wc = gem_mmap__gtt(fd, obj.handle, OBJSZ, PROT_READ); + else if (after == I915_GEM_DOMAIN_WC) wc = gem_mmap__wc(fd, obj.handle, 0, OBJSZ, PROT_READ); else igt_assert(0); @@ -441,6 +445,8 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags) if (before == I915_GEM_DOMAIN_CPU) wc = gem_mmap__cpu(fd, obj.handle, 0, OBJSZ, PROT_WRITE); else if (before == I915_GEM_DOMAIN_GTT) + wc = gem_mmap__gtt(fd, obj.handle, OBJSZ, PROT_WRITE); + else if (before == I915_GEM_DOMAIN_WC) wc = gem_mmap__wc(fd, obj.handle, 0, OBJSZ, PROT_WRITE); else igt_assert(0); @@ -468,6 +474,8 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags) if (after == I915_GEM_DOMAIN_CPU) wc = gem_mmap__cpu(fd, obj.handle, 0, OBJSZ, PROT_READ); else if (after == I915_GEM_DOMAIN_GTT) + wc = gem_mmap__gtt(fd, obj.handle, OBJSZ, PROT_READ); + else if (after == I915_GEM_DOMAIN_WC) wc = gem_mmap__wc(fd, obj.handle, 0, OBJSZ, PROT_READ); else igt_assert(0); @@ -536,12 +544,19 @@ igt_main } modes[] = { { "cpu", I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU }, { "gtt", I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT }, + { "wc", I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC }, { "cpu-gtt", I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_GTT }, { "gtt-cpu", I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_CPU }, + { "cpu-wc", I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_WC }, + { "wc-cpu", I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_CPU }, + { "gtt-wc", I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_WC }, + { "wc-gtt", I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_GTT }, { "cpu-read", I915_GEM_DOMAIN_CPU, 0 }, { "gtt-read", I915_GEM_DOMAIN_GTT, 0 }, + { "wc-read", I915_GEM_DOMAIN_WC, 0 }, { "write-cpu", 0, I915_GEM_DOMAIN_CPU }, { "write-gtt", 0, I915_GEM_DOMAIN_GTT }, + { "write-wc", 0, I915_GEM_DOMAIN_WC }, { "write-read", 0, 0 }, { }, }, *m; @@ -577,8 +592,11 @@ igt_main igt_subtest_f("%s%s%s", f->basic ? "basic-" : "", m->name, - f->name) + f->name) { + if ((m->before | m->after) & I915_GEM_DOMAIN_WC) + igt_require(gem_mmap__has_wc(fd)); basic_reloc(fd, m->before, m->after, f->flags); + } } igt_fixture { @@ -598,8 +616,10 @@ igt_main from_mmap(fd, size, MEM | RO); igt_subtest_f("cpu-%u", find_last_set(size) - 1) from_mmap(fd, size, CPU); - igt_subtest_f("wc-%u", find_last_set(size) - 1) + igt_subtest_f("wc-%u", find_last_set(size) - 1) { + igt_require(gem_mmap__has_wc(fd)); from_mmap(fd, size, WC); + } igt_subtest_f("gtt-%u", find_last_set(size) - 1) from_mmap(fd, size, GTT); } |