[PATCH i-g-t] tests/gem_exec_basic: don't use gem_require_ring to check ring availability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx>

gem_require_ring will submit an execbuf using the provided flags and
skip the test if the ioctl fails. This test is however designed to catch
issues with the ioctl, so it should fail if the ioctl fails on a ring
that the HW possesses.

Instead of using gem_require_ring we can use the getparam ioctl. The new
checker has been added to the test file and not to the commmon library
because this test is the only special case where we want to not use
gem_has_ring

Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx>
---
 tests/gem_exec_basic.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/tests/gem_exec_basic.c b/tests/gem_exec_basic.c
index 3f91b78..9a5de64 100644
--- a/tests/gem_exec_basic.c
+++ b/tests/gem_exec_basic.c
@@ -25,6 +25,30 @@
 
 IGT_TEST_DESCRIPTION("Basic sanity check of execbuf-ioctl rings.");
 
+static bool has_ring(int fd, unsigned ring)
+{
+	switch (ring & I915_EXEC_RING_MASK) {
+	case 0:
+	case I915_EXEC_RENDER:
+		return true;
+
+	case I915_EXEC_BSD:
+		if (ring & 3<<13)
+			return gem_has_bsd2(fd);
+		else
+			return gem_has_bsd(fd);
+
+	case I915_EXEC_BLT:
+		return gem_has_blt(fd);
+
+	case I915_EXEC_VEBOX:
+		return gem_has_vebox(fd);
+	}
+
+	igt_assert_f(0, "invalid exec flag 0x%x\n", ring);
+	return false;
+}
+
 static void noop(int fd, unsigned ring)
 {
 	uint32_t bbe = MI_BATCH_BUFFER_END;
@@ -32,7 +56,11 @@ static void noop(int fd, unsigned ring)
 	struct drm_i915_gem_exec_object2 exec;
 	int ret;
 
-	gem_require_ring(fd, ring);
+	/* we can't use gem_require_ring here because otherwise the test will
+	 * skip if there is a bug with the flags, but we want to fail in that
+	 * situation
+	 */
+	igt_require(has_ring(fd, ring));
 
 	memset(&exec, 0, sizeof(exec));
 	exec.handle = gem_create(fd, 4096);
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux