[PATCH i-g-t 1/3] tests/kms_bw: convert to dynamic subtest

Kunal Joshi kunal1.joshi at intel.com
Thu May 23 10:02:46 UTC 2024


Convert the test structure from individual subtests for each
display mode (1080, 2k, 4k...) and display count (1, 2... n)
to a dynamic subtest structure. The change addresses the issue
of high skip counts due to potentially missing configurations,
which previously required blacklisting.

In the new structure, the display mode is set at the subtest level,
while the number of displays is dynamic. This ensures that the subtest
passes regardless of the number of connected displays.
To cover all scenarios, it may be necessary to connect the
maximum possible number of displays.

Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 tests/kms_bw.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/tests/kms_bw.c b/tests/kms_bw.c
index 05f7e79ad..b50f324af 100644
--- a/tests/kms_bw.c
+++ b/tests/kms_bw.c
@@ -37,12 +37,10 @@
 #include <xf86drmMode.h>
 
 /**
- * SUBTEST: linear-tiling-%d-displays-%s
- * Description: bw test with %arg[2]
+ * SUBTEST: linear-tiling-%s
+ * Description: bw test with %arg[1]
  *
- * arg[1].values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
- *
- * arg[2]:
+ * arg[1]:
  *
  * @1920x1080p:       1920x1080 resolution
  * @2560x1440p:       2560x1440 resolution
@@ -62,6 +60,7 @@ typedef struct data {
         int w[IGT_MAX_PIPES];
         int h[IGT_MAX_PIPES];
         int fd;
+	int num_pipes;
 } data_t;
 
 static drmModeModeInfo test_mode[] = {
@@ -178,16 +177,10 @@ static void run_test_linear_tiling(data_t *data, int pipe, const drmModeModeInfo
 	igt_output_t *output;
 	struct igt_fb buffer[IGT_MAX_PIPES];
 	igt_crc_t zero, captured[IGT_MAX_PIPES];
-	int i = 0, num_pipes = 0;
-	enum pipe p;
 	int ret;
 
-	/* Cannot use igt_display_get_n_pipes() due to fused pipes on i915 where they do
-	 * not give the numver of valid crtcs and always return IGT_MAX_PIPES */
-	for_each_pipe(display, p) num_pipes++;
-
-	igt_skip_on_f(pipe >= num_pipes,
-                      "ASIC does not have %d pipes\n", pipe);
+	igt_skip_on_f(pipe >= data->num_pipes,
+				  "ASIC does not have %d pipes\n", pipe);
 
 	test_init(data);
 
@@ -244,28 +237,37 @@ igt_main
 {
 	data_t data;
 	int i = 0, j = 0;
+	enum pipe p;
 
 	memset(&data, 0, sizeof(data));
 
 	igt_fixture
 	{
 		data.fd = drm_open_driver_master(DRIVER_ANY);
+		data.num_pipes = 0;
 
 		kmstest_set_vt_graphics_mode();
 
 		igt_display_require(&data.display, data.fd);
 		igt_require(&data.display.is_atomic);
 		igt_display_require_output(&data.display);
+		/*
+		 * Cannot use igt_display_get_n_pipes() due to fused pipes on i915 where they do
+		 * not give the numver of valid crtcs and always return IGT_MAX_PIPES
+		 */
+		for_each_pipe(&data.display, p) data.num_pipes++;
 
 	}
 
 	/* We're not using for_each_pipe_static because we need the
 	 * _amount_ of pipes */
-	for (i = 0; i < IGT_MAX_PIPES; i++) {
-		for (j = 0; j < ARRAY_SIZE(test_mode); j++) {
-			igt_subtest_f("linear-tiling-%d-displays-%s", i+1,
-			      test_mode[j].name)
-			run_test_linear_tiling(&data, i, &test_mode[j]);
+	for (j = 0; j < ARRAY_SIZE(test_mode); j++) {
+		igt_subtest_with_dynamic_f("linear-tiling-%s", test_mode[j].name)
+		{
+			for (i = 0; i < data.num_pipes; i++) {
+				igt_dynamic_f("%d-display%s", i+1, i == 0 ? "" : "s")
+					run_test_linear_tiling(&data, i, &test_mode[j]);
+			}
 		}
 	}
 
-- 
2.25.1



More information about the igt-dev mailing list