[PATCH igt] tests/gem_spin_batch: Add multiengine test

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

 



Parallel spin on all engines.

Signed-off-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxx>
---
 tests/gem_spin_batch.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/tests/gem_spin_batch.c b/tests/gem_spin_batch.c
index baf796a..a22da32 100644
--- a/tests/gem_spin_batch.c
+++ b/tests/gem_spin_batch.c
@@ -32,7 +32,7 @@
 		     "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\
 		     #x, #ref, (long long)x, tolerance, (long long)ref)
 
-static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
+static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 {
 	const uint64_t timeout_100ms = 100000000LL;
 	unsigned long loops = 0;
@@ -63,6 +63,30 @@ static void basic(int fd, unsigned int engine, unsigned int timeout_sec)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
+static void spin_exit_handler(int sig)
+{
+	igt_fixture {
+		igt_terminate_spin_batches();
+	}
+}
+
+static void spin_on_all_engines(int fd, unsigned int timeout_sec)
+{
+	unsigned engine;
+
+	for_each_engine(fd, engine) {
+		if (engine == 0)
+			continue;
+
+		igt_fork(child, 1) {
+			igt_install_exit_handler(spin_exit_handler);
+			spin(fd, engine, timeout_sec);
+		}
+	}
+
+	igt_waitchildren();
+}
+
 igt_main
 {
 	const struct intel_execution_engine *e;
@@ -82,9 +106,12 @@ igt_main
 			continue;
 
 		igt_subtest_f("basic-%s", e->name)
-			basic(fd, e->exec_id, 3);
+			spin(fd, e->exec_id, 3);
 	}
 
+	igt_subtest("multiengine")
+		spin_on_all_engines(fd, 3);
+
 	igt_fixture {
 		igt_stop_hang_detector();
 		close(fd);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://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