[igt-dev] [PATCH i-g-t] igt/gem_mmap_gtt: Check for known incoherency before testing

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 20 08:07:55 UTC 2018


We test map_gtt coherency (whether or not a write via the mmap_gtt is
immediately visible in the backing storage to a read via mmap_cpu) but
we know that several platforms are inherently incorrect and require some
form of hammer to workaround internal delays. These platforms break our
ABI guarantees and so we report the change in ABI via a driver getparam.

If we know the platform doesn't meet the ABI guarantee, skip the test.
If it is meant to work, test!

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 tests/gem_mmap_gtt.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index c8a0bedec..f63535556 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -309,6 +309,18 @@ test_write_gtt(int fd)
 	munmap(src, OBJECT_SIZE);
 }
 
+static bool is_coherent(int i915)
+{
+	int val = 1; /* by default, we assume GTT is coherent, hence the test */
+	struct drm_i915_getparam gp = {
+		gp.param = 52, /* GTT_COHERENT */
+		gp.value = &val,
+	};
+
+	ioctl(i915, DRM_IOCTL_I915_GETPARAM, &gp);
+	return val;
+}
+
 static void
 test_coherency(int fd)
 {
@@ -316,6 +328,7 @@ test_coherency(int fd)
 	uint32_t *gtt, *cpu;
 	int i;
 
+	igt_require(is_coherent(fd));
 	igt_require(igt_setup_clflush());
 
 	handle = gem_create(fd, OBJECT_SIZE);
-- 
2.18.0



More information about the igt-dev mailing list