[igt-dev] [PATCH i-g-t] tests/gem_set_tiling_vs_pwrite: Skip on unknown swizzling

Tvrtko Ursulin tursulin at ursulin.net
Thu Oct 11 12:30:27 UTC 2018


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Same as in commit 78071c2fa53d ("igt/gem_tiled_partial_pwrite_pread: Check
for known swizzling"), to be able to compare the bo against the test
pattern we need to skip the test if the swizzling is not compatible.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102575
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
Eeek confidence level low - is this correct?
---
 tests/gem_set_tiling_vs_pwrite.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/gem_set_tiling_vs_pwrite.c b/tests/gem_set_tiling_vs_pwrite.c
index f0126b6484b7..3be908dbd103 100644
--- a/tests/gem_set_tiling_vs_pwrite.c
+++ b/tests/gem_set_tiling_vs_pwrite.c
@@ -42,6 +42,18 @@ IGT_TEST_DESCRIPTION("Check set_tiling vs pwrite coherency.");
 #define OBJECT_SIZE (1024*1024)
 #define TEST_STRIDE (1024*4)
 
+static bool known_swizzling(int fd, uint32_t handle)
+{
+	struct drm_i915_gem_get_tiling arg = {
+		.handle = handle,
+	};
+
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING, &arg))
+		return false;
+
+	return arg.phys_swizzle_mode == arg.swizzle_mode;
+}
+
 /**
  * Testcase: Check set_tiling vs pwrite coherency
  */
@@ -66,6 +78,12 @@ igt_simple_main
 
 	gem_set_tiling(fd, handle, I915_TILING_X, TEST_STRIDE);
 
+	/*
+	 * As we want to compare our template pattern against
+	 * the target bo, we need consistent swizzling on both.
+	 */
+	igt_require(known_swizzling(fd, handle));
+
 	/* touch it */
 	gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 	*ptr = 0xdeadbeef;
-- 
2.17.1



More information about the igt-dev mailing list