summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Argenziano <antonio.argenziano@intel.com>2019-02-25 10:28:04 -0800
committerAntonio Argenziano <antonio.argenziano@intel.com>2019-02-25 14:28:20 -0800
commit7cc428962158ed4335d998a5cd447050d423e618 (patch)
treecfc870c1af2b0f93048d7328ca54f31667df28ea
parent06b0830fb948b9b632342cd26100342aa01cbc79 (diff)
tests/i915/gem_mmap_wc: Add local MMAP wrapper
Incoming patches for the common library wrappers will try mapping through the MMAP_OFFSET IOCTL first. Since the tests in gem_mmap_wc are targeted at the GEM_MMAP IOCTL, add a local wrapper. Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/i915/gem_mmap_wc.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/i915/gem_mmap_wc.c b/tests/i915/gem_mmap_wc.c
index 110883eb..baa68aa8 100644
--- a/tests/i915/gem_mmap_wc.c
+++ b/tests/i915/gem_mmap_wc.c
@@ -51,6 +51,21 @@ struct local_i915_gem_mmap_v2 {
static int OBJECT_SIZE = 16*1024*1024;
+/*
+ * Local WC mmap wrapper. This is used to make sure we go through
+ * the GEM_MMAP IOCTL.
+ * */
+static void *
+local_gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
+{
+ void *ptr;
+
+ ptr = __gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ igt_assert(ptr);
+
+ return ptr;
+}
+
static void set_domain(int fd, uint32_t handle)
{
gem_set_domain(fd, handle, I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
@@ -61,7 +76,7 @@ mmap_bo(int fd, uint32_t handle)
{
void *ptr;
- ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ ptr = local_gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
return ptr;
}
@@ -177,9 +192,9 @@ test_read_write2(int fd, enum test_read_write order)
handle = gem_create(fd, OBJECT_SIZE);
set_domain(fd, handle);
- r = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
+ r = local_gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
- w = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ w = local_gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
if (order == READ_BEFORE_WRITE) {
val = *(uint32_t *)r;
@@ -221,7 +236,7 @@ test_coherency(int fd)
handle = gem_create(fd, OBJECT_SIZE);
- wc = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
+ wc = local_gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
cpu = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
gem_set_domain(fd, handle, I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
@@ -299,7 +314,7 @@ test_write_cpu_read_wc(int fd, int force_domain)
handle = gem_create(fd, OBJECT_SIZE);
- dst = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
+ dst = local_gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
@@ -322,7 +337,7 @@ test_write_gtt_read_wc(int fd)
handle = gem_create(fd, OBJECT_SIZE);
set_domain(fd, handle);
- dst = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
+ dst = local_gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
src = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);