[PATCH i-g-t v1 3/5] tests/kms_plane_scaling: Return error code in test_planes_scaling_combo

Naladala Ramanaidu ramanaidu.naladala at intel.com
Thu Sep 5 14:50:36 UTC 2024


Change the return type of test_planes_scaling_combo from void to
uint32_t to return error codes. Modify the loop in
scaler_with_2_planes_tests to break on successful
test_planes_scaling_combo execution.

v1: fix crash issues. (swati)

Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
---
 tests/kms_plane_scaling.c | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index f03a73a5e..5d69eabf4 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -933,7 +933,7 @@ static void setup_fb(int fd, int width, int height, struct igt_fb *fb)
 		      fb);
 }
 
-static void
+static uint32_t
 test_planes_scaling_combo(data_t *d, double sf_plane1,
 			  double sf_plane2,
 			  enum pipe pipe,
@@ -997,13 +997,14 @@ test_planes_scaling_combo(data_t *d, double sf_plane1,
 							  pipe, output, p1, p2,
 							  &d->fb[1], &d->fb[2],
 							  test_type);
-			if (ret != 0)
-				break;
+			if (ret != 0) {
+				cleanup_fbs(d);
+				return ret;
+			}
 		}
 		cleanup_fbs(d);
 	}
-	igt_skip_on_f(ret == -EINVAL || ret == -ERANGE, "Unsupported scaling operation in driver with return value %s\n",
-		      (ret == -EINVAL) ? "-EINVAL" : "-ERANGE");
+	return ret;
 }
 
 static void
@@ -1524,25 +1525,27 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 		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(&data.display, pipe) {
-				for_each_valid_output_on_pipe(&data.display, pipe, output) {
-					if (!pipe_output_combo_valid(&data.display, pipe, output))
-						continue;
-					if (get_num_scalers(&data.display, pipe) < 2)
-						continue;
-
-					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
-
-						test_planes_scaling_combo(&data,
+				for_each_pipe(&data.display, pipe) {
+					igt_dynamic_f("pipe-%s", kmstest_pipe_name(pipe)) {
+						for_each_valid_output_on_pipe(&data.display, pipe, output) {
+							if (!pipe_output_combo_valid(&data.display, pipe, output))
+								continue;
+							if (get_num_scalers(&data.display, pipe) < 2)
+								continue;
+							ret = test_planes_scaling_combo(&data,
 								scaler_with_2_planes_tests[index].sf_plane1,
 								scaler_with_2_planes_tests[index].sf_plane2,
 								pipe, output,
 								scaler_with_2_planes_tests[index].test_type);
+							if (ret == 0)
+								break;
+						}
+						igt_skip_on_f(ret == -ERANGE || ret == -EINVAL,
+							      "Unsupported scaling operation in driver with return value %s\n",
+							      (ret == -EINVAL) ? "-EINVAL" : "-ERANGE");
 					}
-					break;
 				}
 			}
-			}
 		}
 
 		for (int index = 0; index < ARRAY_SIZE(intel_paramtests); index++) {
-- 
2.43.0



More information about the igt-dev mailing list