[PATCH 2/2] tests/kms_plane_scaling: msm get_num_scalars() support

Rob Clark robdclark at gmail.com
Wed Aug 14 18:53:39 UTC 2024


From: Rob Clark <robdclark at chromium.org>

This may undercount # of scalars on hw with rgb pipes, but the scaling
on yuv and rgb pipes is functionally equivalent, so for test coverage
this is a good enough approximation.

Signed-off-by: Rob Clark <robdclark at chromium.org>
---
 lib/igt_kms.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 99cdeeb76033..dd530dbabf89 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6682,6 +6682,25 @@ int get_num_scalers(igt_display_t *display, enum pipe pipe)
 			igt_assert(start_loc2 = strstr(start_loc1, "num_scalers="));
 			igt_assert_eq(sscanf(start_loc2, "num_scalers=%d", &num_scalers), 1);
 		}
+	} else if (is_msm_device(drm_fd)) {
+		igt_plane_t *plane;
+
+		/*
+		 * msm devices have dma pipes (no csc, no scaling), rgb
+		 * pipes (no csc, has scaling), and vid pipes (has csc,
+		 * has scaling), but not all devices have rgb pipes.
+		 * We can use the # of pipes that support YUV formats
+		 * as a rough approximation of the # of scalars.. it may
+		 * undercount on some hw, but it will not overcount
+		 */
+		for_each_plane_on_pipe(display, pipe, plane) {
+			for (unsigned i = 0; i < plane->format_mod_count; i++) {
+				if (igt_format_is_yuv(plane->formats[i])) {
+					num_scalers++;
+					break;
+				}
+			}
+		}
 	}
 
 	return num_scalers;
-- 
2.46.0



More information about the igt-dev mailing list