[igt-dev] [RFC PATCH v3 6/8] tests/i915/gem_basic: add multi-gpu tests

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Nov 25 12:01:46 UTC 2022


This is only PoC for one subtest to run on more than one gpu
simultanosly. For this to work test should be run with
--device option, for example with:

--device=pci:vendor=Intel,device=discrete,card=0\;pci:vendor=Intel,device=discrete,card=1

As this is only PoC test will assume two cards and will skip
on second one when it is not present.

Cc: Anna Karas <anna.karas at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/i915/gem_basic.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_basic.c b/tests/i915/gem_basic.c
index 2aa5d850..1d549938 100644
--- a/tests/i915/gem_basic.c
+++ b/tests/i915/gem_basic.c
@@ -40,6 +40,7 @@
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_types.h"
+#include "lib/igt_device_scan.h"
 
 IGT_TEST_DESCRIPTION("Tests basic gem_create and gem_close IOCTLs");
 
@@ -83,17 +84,42 @@ test_create_fd_close(int fd)
 igt_main
 {
 	igt_fd_t(fd);
+	int gpu_count = 1;
 
-	igt_fixture
+	igt_fixture {
+		int count;
 		fd = drm_open_driver(DRIVER_INTEL);
 
+		count = igt_device_filter_count();
+		if (count > 1)
+			gpu_count = count;
+
+		gpu_count = 2; //FIXME
+	}
+
 	igt_describe("Verify that gem_close fails with bad params.");
 	igt_subtest("bad-close")
 		test_bad_close(fd);
 
+#if 0
 	igt_describe("Verify basic functionality of gem_create and gem_close.");
 	igt_subtest("create-close")
 		test_create_close(fd);
+#endif
+	igt_describe("Verify basic functionality of gem_create and gem_close with multi-gpu.");
+#define myname "create-close"
+
+	igt_subtest_with_dynamic(myname)
+	for (int j__ = 1, size__ = gpu_count; j__; igt_waitchildren_dyn(), j__ = 0)
+	igt_fork_dyn(child, size__)
+	igt_dynamic_f("%s-gpu-%d", myname, child) {
+		int gpu_fd;
+
+		gpu_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+		if (gpu_fd < 0)
+			igt_skip("cannot open gpu-%d", child);
+		test_create_close(gpu_fd);
+	}
 
 	igt_describe("Verify that closing drm driver is possible with opened gem object.");
 	igt_subtest("create-fd-close")
-- 
2.34.1



More information about the igt-dev mailing list