From 3bdafec92fae2d04cb69354ffc26e1e32ac60d65 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 13 Apr 2017 08:18:10 +0100 Subject: igt/gem_exec_reloc: Check interactions with WC domain Signed-off-by: Chris Wilson --- lib/ioctl_wrappers.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/ioctl_wrappers.c') diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 72fb0ebc..48bdcc56 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -702,17 +702,23 @@ bool gem_mmap__has_wc(int fd) if (has_wc == -1) { struct drm_i915_getparam gp; - int val = -1; + int mmap_version = -1; + int gtt_version = -1; has_wc = 0; memset(&gp, 0, sizeof(gp)); - gp.param = 30; /* MMAP_VERSION */ - gp.value = &val; + gp.param = 40; /* MMAP_GTT_VERSION */ + gp.value = >t_version; + ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); - /* Do we have the new mmap_ioctl? */ + memset(&gp, 0, sizeof(gp)); + gp.param = 30; /* MMAP_VERSION */ + gp.value = &mmap_version; ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); - if (val >= 1) { + + /* Do we have the new mmap_ioctl with DOMAIN_WC? */ + if (mmap_version >= 1 && gtt_version >= 2) { struct local_i915_gem_mmap_v2 arg; /* Does this device support wc-mmaps ? */ -- cgit v1.2.3