[igt-dev] [i-g-t V9 26/51] tests/kms_plane_scaling: Add support for Bigjoiner

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Mar 17 05:09:39 UTC 2023


As many 2x tests are currently running on Pipe-A & B only, those
tests will always SKIP if there is any 8K supported panel in the
config. Instead of Skipping the test, add some intelligence to
the subtest to identify the valid pipe/output combo to execute
the subtest.

V2: - Use updated helper name
V3: - Rebase

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Reviewed-by: Swati Sharma <swati2.sharma at intel.com>
---
 tests/kms_plane_scaling.c | 212 +++++++++++++++++++++++++-------------
 1 file changed, 142 insertions(+), 70 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 3a6904afb..e18c56989 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -627,30 +627,45 @@ static void test_scaler_with_pixel_format_pipe(data_t *d, int width, int height,
 	}
 }

-static void find_connected_pipe(igt_display_t *display, bool second, enum pipe *pipe, igt_output_t **output)
+static enum pipe
+find_connected_pipe(igt_display_t *display, bool second, igt_output_t **output)
 {
-	enum pipe first = PIPE_NONE;
-	igt_output_t *first_output = NULL;
+	enum pipe pipe;
+	bool first_output = false;
 	bool found = false;

-	for_each_pipe_with_valid_output(display, *pipe, *output) {
-		if (first == *pipe || *output == first_output)
-			continue;
+	igt_display_reset(display);

-		if (second) {
-			first = *pipe;
-			first_output = *output;
-			second = false;
-			continue;
-		}
+	for_each_pipe(display, pipe) {
+		for_each_valid_output_on_pipe(display, pipe, *output) {
+			if((*output)->pending_pipe != PIPE_NONE)
+				continue;
+
+			igt_output_set_pipe(*output, pipe);
+			if (i915_pipe_output_combo_valid(display)) {
+				found = true;

-		return;
+				if (second) {
+					first_output = true;
+					second = false;
+					found = false;
+				}
+				break;
+			}
+			igt_output_set_pipe(*output, PIPE_NONE);
+		}
+		if (found)
+			break;
 	}

+	igt_display_reset(display);
+
 	if (first_output)
 		igt_require_f(found, "No second valid output found\n");
 	else
 		igt_require_f(found, "No valid outputs found\n");
+
+	return pipe;
 }

 static void
@@ -837,13 +852,16 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
 	enum pipe pipe1, pipe2;
 	int ret1, ret2;

-	cleanup_crtc(d);
-
-	find_connected_pipe(display, false, &pipe1, &output1);
-	find_connected_pipe(display, true, &pipe2, &output2);
+	cleanup_fbs(d);

+	pipe1 = find_connected_pipe(display, false, &output1);
+	pipe2 = find_connected_pipe(display, true, &output2);
 	igt_skip_on(!output1 || !output2);

+	igt_info("Using (pipe %s + %s) and (pipe %s + %s) to run the subtest.\n",
+		 kmstest_pipe_name(pipe1), igt_output_name(output1),
+		 kmstest_pipe_name(pipe2), igt_output_name(output2));
+
 	igt_output_set_pipe(output1, pipe1);
 	igt_output_set_pipe(output2, pipe2);

@@ -1051,6 +1069,22 @@ static void i915_max_source_size_test(data_t *d, enum pipe pipe, igt_output_t *o
 	cleanup_fbs(d);
 }

+static bool
+pipe_output_combo_valid(igt_display_t *display,
+			enum pipe pipe, igt_output_t *output)
+{
+	bool ret = true;
+
+	igt_display_reset(display);
+
+	igt_output_set_pipe(output, pipe);
+	if (!i915_pipe_output_combo_valid(display))
+		ret = false;
+	igt_output_set_pipe(output, PIPE_NONE);
+
+	return ret;
+}
+
 static int opt_handler(int opt, int opt_index, void *_data)
 {
 	data_t *data = _data;
@@ -1092,17 +1126,22 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 		for (int index = 0; index < ARRAY_SIZE(scaler_with_pixel_format_tests); index++) {
 			igt_describe(scaler_with_pixel_format_tests[index].describe);
 			igt_subtest_with_dynamic(scaler_with_pixel_format_tests[index].name) {
-			for_each_pipe_with_single_output(&data.display, pipe, output)
-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
-					drmModeModeInfo *mode;
+				for_each_pipe(&data.display, pipe) {
+					for_each_valid_output_on_pipe(&data.display, pipe, output) {
+						if (!pipe_output_combo_valid(&data.display, pipe, output))
+							continue;

-					mode = igt_output_get_mode(output);
+						igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+							drmModeModeInfo *mode = igt_output_get_mode(output);

-					test_scaler_with_pixel_format_pipe(&data,
-							get_width(mode, scaler_with_pixel_format_tests[index].sf),
-							get_height(mode, scaler_with_pixel_format_tests[index].sf),
-							scaler_with_pixel_format_tests[index].is_upscale,
-							pipe, output);
+							test_scaler_with_pixel_format_pipe(&data,
+								get_width(mode, scaler_with_pixel_format_tests[index].sf),
+								get_height(mode, scaler_with_pixel_format_tests[index].sf),
+								scaler_with_pixel_format_tests[index].is_upscale,
+								pipe, output);
+						}
+						break;
+					}
 				}
 			}
 		}
@@ -1110,17 +1149,22 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 		for (int index = 0; index < ARRAY_SIZE(scaler_with_rotation_tests); index++) {
 			igt_describe(scaler_with_rotation_tests[index].describe);
 			igt_subtest_with_dynamic(scaler_with_rotation_tests[index].name) {
-			for_each_pipe_with_single_output(&data.display, pipe, output)
-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
-					drmModeModeInfo *mode;
+				for_each_pipe(&data.display, pipe) {
+					for_each_valid_output_on_pipe(&data.display, pipe, output) {
+						if (!pipe_output_combo_valid(&data.display, pipe, output))
+							continue;

-					mode = igt_output_get_mode(output);
+						igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+							drmModeModeInfo *mode = igt_output_get_mode(output);

-					test_scaler_with_rotation_pipe(&data,
-							get_width(mode, scaler_with_rotation_tests[index].sf),
-							get_height(mode, scaler_with_rotation_tests[index].sf),
-							scaler_with_rotation_tests[index].is_upscale,
-							pipe, output);
+							test_scaler_with_rotation_pipe(&data,
+								get_width(mode, scaler_with_rotation_tests[index].sf),
+								get_height(mode, scaler_with_rotation_tests[index].sf),
+								scaler_with_rotation_tests[index].is_upscale,
+								pipe, output);
+						}
+						break;
+					}
 				}
 			}
 		}
@@ -1128,77 +1172,101 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 		for (int index = 0; index < ARRAY_SIZE(scaler_with_modifiers_tests); index++) {
 			igt_describe(scaler_with_modifiers_tests[index].describe);
 			igt_subtest_with_dynamic(scaler_with_modifiers_tests[index].name) {
-			for_each_pipe_with_single_output(&data.display, pipe, output)
-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
-					drmModeModeInfo *mode;
+				for_each_pipe(&data.display, pipe) {
+					for_each_valid_output_on_pipe(&data.display, pipe, output) {
+						if (!pipe_output_combo_valid(&data.display, pipe, output))
+							continue;

-					mode = igt_output_get_mode(output);
+						igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+							drmModeModeInfo *mode = igt_output_get_mode(output);

-					test_scaler_with_modifier_pipe(&data,
-							get_width(mode, scaler_with_rotation_tests[index].sf),
-							get_height(mode, scaler_with_rotation_tests[index].sf),
-							scaler_with_rotation_tests[index].is_upscale,
-							pipe, output);
+							test_scaler_with_modifier_pipe(&data,
+								get_width(mode, scaler_with_rotation_tests[index].sf),
+								get_height(mode, scaler_with_rotation_tests[index].sf),
+								scaler_with_rotation_tests[index].is_upscale,
+								pipe, output);
+						}
+						break;
+					}
 				}
 			}
 		}

 		igt_describe("Tests scaling with clipping and clamping, pixel formats.");
 		igt_subtest_with_dynamic("plane-scaler-with-clipping-clamping-pixel-formats") {
-			for_each_pipe_with_single_output(&data.display, pipe, output) {
-				drmModeModeInfo *mode;
+			for_each_pipe(&data.display, pipe) {
+				for_each_valid_output_on_pipe(&data.display, pipe, output) {
+					if (!pipe_output_combo_valid(&data.display, pipe, output))
+						continue;

-				mode = igt_output_get_mode(output);
+					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+						drmModeModeInfo *mode = igt_output_get_mode(output);

-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output))
-					test_scaler_with_pixel_format_pipe(&data, mode->hdisplay + 100,
+						test_scaler_with_pixel_format_pipe(&data, mode->hdisplay + 100,
 							mode->vdisplay + 100, false, pipe, output);
+					}
+					break;
+				}
 			}
 		}

 		igt_describe("Tests scaling with clipping and clamping, rotation.");
 		igt_subtest_with_dynamic("plane-scaler-with-clipping-clamping-rotation") {
-			for_each_pipe_with_single_output(&data.display, pipe, output) {
-				drmModeModeInfo *mode;
+			for_each_pipe(&data.display, pipe) {
+				for_each_valid_output_on_pipe(&data.display, pipe, output) {
+					if (!pipe_output_combo_valid(&data.display, pipe, output))
+						continue;

-				mode = igt_output_get_mode(output);
+					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+						drmModeModeInfo *mode = igt_output_get_mode(output);

-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output))
-					test_scaler_with_rotation_pipe(&data, mode->hdisplay + 100,
+						test_scaler_with_rotation_pipe(&data, mode->hdisplay + 100,
 							mode->vdisplay + 100, false, pipe, output);
+					}
+					break;
+				}
 			}
 		}

 		igt_describe("Tests scaling with clipping and clamping, modifiers.");
 		igt_subtest_with_dynamic("plane-scaler-with-clipping-clamping-modifiers") {
-			for_each_pipe_with_single_output(&data.display, pipe, output) {
-				drmModeModeInfo *mode;
-
-				mode = igt_output_get_mode(output);
+			for_each_pipe(&data.display, pipe) {
+				for_each_valid_output_on_pipe(&data.display, pipe, output) {
+					if (!pipe_output_combo_valid(&data.display, pipe, output))
+						continue;

-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output))
-					test_scaler_with_modifier_pipe(&data, mode->hdisplay + 100,
+					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+						drmModeModeInfo *mode = igt_output_get_mode(output);
+						test_scaler_with_modifier_pipe(&data, mode->hdisplay + 100,
 							mode->vdisplay + 100, false, pipe, output);
+					}
+					break;
+				}
 			}
 		}

 		for (int index = 0; index < ARRAY_SIZE(scaler_with_2_planes_tests); index++) {
 			igt_describe(scaler_with_2_planes_tests[index].describe);
 			igt_subtest_with_dynamic(scaler_with_2_planes_tests[index].name) {
-			for_each_pipe_with_single_output(&data.display, pipe, output)
-				igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
-					drmModeModeInfo *mode;
+			for_each_pipe(&data.display, pipe) {
+				for_each_valid_output_on_pipe(&data.display, pipe, output) {
+					if (!pipe_output_combo_valid(&data.display, pipe, output))
+						continue;

-					mode = igt_output_get_mode(output);
+					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
+						drmModeModeInfo *mode = igt_output_get_mode(output);

-					test_planes_scaling_combo(&data,
+						test_planes_scaling_combo(&data,
 							get_width(mode, scaler_with_2_planes_tests[index].sf_plane1),
 							get_height(mode, scaler_with_2_planes_tests[index].sf_plane1),
 							get_width(mode, scaler_with_2_planes_tests[index].sf_plane2),
 							get_height(mode, scaler_with_2_planes_tests[index].sf_plane2),
 							pipe, output, scaler_with_2_planes_tests[index].test_type);
+					}
+					break;
 				}
 			}
+			}
 		}

 		for (int index = 0; index < ARRAY_SIZE(i915_paramtests); index++) {
@@ -1227,12 +1295,16 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 		}

 		igt_describe("Negative test for number of scalers per pipe.");
-			igt_subtest_with_dynamic("invalid-num-scalers") {
-				for_each_pipe_with_valid_output(&data.display, pipe, output)
-					igt_dynamic_f("pipe-%s-%s-invalid-num-scalers",
-						       kmstest_pipe_name(pipe), igt_output_name(output))
-						test_invalid_num_scalers(&data, pipe, output);
+		igt_subtest_with_dynamic("invalid-num-scalers") {
+			for_each_pipe_with_valid_output(&data.display, pipe, output) {
+				if (!pipe_output_combo_valid(&data.display, pipe, output))
+					continue;
+
+				igt_dynamic_f("pipe-%s-%s-invalid-num-scalers",
+					       kmstest_pipe_name(pipe), igt_output_name(output))
+					test_invalid_num_scalers(&data, pipe, output);
 			}
+		}
 	}

 	igt_subtest_group
--
2.40.0



More information about the igt-dev mailing list