[igt-dev] [PATCH i-g-t 3/3] i915/gem_exec_gttfill: fix multigpu subtest

Kamil Konieczny kamil.konieczny at linux.intel.com
Tue Feb 14 19:28:30 UTC 2023


Fix multigpu subtest and open cards in order, starting
from first one.

Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/i915/gem_exec_gttfill.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
index 137277fe..c310a981 100644
--- a/tests/i915/gem_exec_gttfill.c
+++ b/tests/i915/gem_exec_gttfill.c
@@ -266,11 +266,23 @@ igt_main
 	}
 
 	igt_subtest("multigpu-basic") { /* run on two or more discrete cards */
+#define MAX_GPU 16
+		int fds[MAX_GPU];
+
 		igt_require(gpu_count > 1);
+		igt_require(gpu_count <= MAX_GPU);
+		for (int i = 0; i < gpu_count; i++) {
+			int n_fd;
+
+			n_fd = i ? __drm_open_driver_another(i, DRIVER_INTEL) : gem_reopen_driver(i915);
+			igt_assert(n_fd >= 0);
+			fds[i] = n_fd;
+		}
+
 		igt_multi_fork(child, gpu_count) {
 			int g_fd;
 			// prepare
-			g_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+			g_fd = gem_reopen_driver(fds[child]);
 			igt_assert(g_fd >= 0);
 			ctx = intel_ctx_create_all_physical(g_fd);
 			igt_fork_hang_detector(g_fd);
-- 
2.37.2



More information about the igt-dev mailing list