[PATCH i-g-t 1/2] tests/kms_plane_scaling: Pass display to get_num_scalars()

Rob Clark robdclark at gmail.com
Thu Feb 15 22:21:04 UTC 2024


From: Rob Clark <robdclark at chromium.org>

Prep for next patch.

Signed-off-by: Rob Clark <robdclark at chromium.org>
---
 lib/igt_kms.c             |  5 +++--
 lib/igt_kms.h             |  2 +-
 tests/kms_plane_scaling.c | 24 ++++++++++++------------
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 1b4d0d7612a2..899b3a5001c4 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6333,17 +6333,18 @@ int igt_get_dp_mst_connector_id(igt_output_t *output)
 
 /**
  * get_num_scalers:
- * @drm_fd: drm file descriptor
+ * @display: the display
  * @pipe: display pipe
  *
  * Returns: Number of scalers supported per pipe.
  */
-int get_num_scalers(int drm_fd, enum pipe pipe)
+int get_num_scalers(igt_display_t *display, enum pipe pipe)
 {
 	char buf[8120];
 	char *start_loc1, *start_loc2;
 	int dir, res;
 	int num_scalers = 0;
+	int drm_fd = display->drm_fd;
 	char dest[20] = ":pipe ";
 
 	strcat(dest, kmstest_pipe_name(pipe));
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b3882808b42f..7cbaf180a63b 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1217,6 +1217,6 @@ bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
 bool intel_pipe_output_combo_valid(igt_display_t *display);
 bool igt_check_output_is_dp_mst(igt_output_t *output);
 int igt_get_dp_mst_connector_id(igt_output_t *output);
-int get_num_scalers(int drm_fd, enum pipe pipe);
+int get_num_scalers(igt_display_t *display, enum pipe pipe);
 
 #endif /* __IGT_KMS_H__ */
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index acb4a1da1ecf..d2dd3fd843e8 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -1038,8 +1038,8 @@ static void test_scaler_with_multi_pipe_plane(data_t *d)
 	igt_output_set_pipe(output1, pipe1);
 	igt_output_set_pipe(output2, pipe2);
 
-	igt_require(get_num_scalers(d->drm_fd, pipe1) >= 2);
-	igt_require(get_num_scalers(d->drm_fd, pipe2) >= 2);
+	igt_require(get_num_scalers(display, pipe1) >= 2);
+	igt_require(get_num_scalers(display, pipe2) >= 2);
 
 	plane[0] = igt_output_get_plane(output1, 0);
 	igt_require(plane[0]);
@@ -1131,7 +1131,7 @@ static void invalid_parameter_tests(data_t *d)
 		igt_output_set_pipe(output, pipe);
 		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-		igt_require(get_num_scalers(d->drm_fd, pipe) >= 1);
+		igt_require(get_num_scalers(&d->display, pipe) >= 1);
 
 		igt_create_fb(d->drm_fd, 256, 256,
 			      DRM_FORMAT_XRGB8888,
@@ -1308,7 +1308,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 					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.drm_fd, pipe) < 1)
+						if (get_num_scalers(&data.display, pipe) < 1)
 							continue;
 
 						igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1333,7 +1333,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 					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.drm_fd, pipe) < 1)
+						if (get_num_scalers(&data.display, pipe) < 1)
 							continue;
 
 						igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1358,7 +1358,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 					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.drm_fd, pipe) < 1)
+						if (get_num_scalers(&data.display, pipe) < 1)
 							continue;
 
 						igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1382,7 +1382,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 				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.drm_fd, pipe) < 1)
+					if (get_num_scalers(&data.display, pipe) < 1)
 						continue;
 
 					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1402,7 +1402,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 				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.drm_fd, pipe) < 1)
+					if (get_num_scalers(&data.display, pipe) < 1)
 						continue;
 
 					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1422,7 +1422,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 				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.drm_fd, pipe) < 1)
+					if (get_num_scalers(&data.display, pipe) < 1)
 						continue;
 
 					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1442,7 +1442,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 				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.drm_fd, pipe) < 2)
+					if (get_num_scalers(&data.display, pipe) < 2)
 						continue;
 
 					igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), igt_output_name(output)) {
@@ -1469,7 +1469,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 					for_each_valid_output_on_pipe(&data.display, pipe, output) {
 						drmModeModeInfo *mode = NULL;
 
-						if (get_num_scalers(data.drm_fd, pipe) < 1)
+						if (get_num_scalers(&data.display, pipe) < 1)
 							continue;
 						/*
 						 * Need to find mode with lowest vrefresh else
@@ -1494,7 +1494,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 			for_each_pipe_with_valid_output(&data.display, pipe, output) {
 				if (!pipe_output_combo_valid(&data.display, pipe, output))
 					continue;
-				if (get_num_scalers(data.drm_fd, pipe) < 1)
+				if (get_num_scalers(&data.display, pipe) < 1)
 						continue;
 
 				igt_dynamic_f("pipe-%s-%s-invalid-num-scalers",
-- 
2.43.0



More information about the igt-dev mailing list