[PATCH i-g-t 6/9] tests/kms_plane: Use the square pattern even when using multiple planes

Louis Chauvet louis.chauvet at bootlin.com
Wed Mar 6 17:28:40 UTC 2024


When the capture_format_crcs_multiple function is used, it was only using
plain colors. It is enough to detect if the format conversion don't
return the correct color, but it was not sufficient to check if the
correct pixel is converted.

As seen in [1], the capture_format_crcs_multiple was "SUCCESS" because if
the whole plane have only one color, if the wrong pixel is read, it will
always convert to the correct color.

[1]: https://lore.kernel.org/dri-devel/ZbvXV-1hrfXLcvC3@localhost.localdomain/

Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
 tests/kms_plane.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index f0be09b8e506..bb8229124b8c 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -728,6 +728,12 @@ static void capture_format_crcs_multiple(data_t *data, enum pipe pipe,
 	struct drm_event_vblank ev;
 	int i;
 
+	/* Also run single colors to capture more failures */
+	capture_format_crcs_single(data, pipe, plane, format, modifier, width, height, encoding, range, crc, fb);
+
+	/* Skip the first crc as it's taken by "capture_format_crcs_single" */
+	crc = crc + 1;
+
 restart_round:
 	for (i = 0; i < data->num_colors; i++) {
 		const color_t *c = &data->colors[i];
@@ -853,7 +859,7 @@ static bool test_format_plane_colors(data_t *data, enum pipe pipe,
 				     igt_crc_t ref_crc[],
 				     struct igt_fb *fb)
 {
-	igt_crc_t crc[ARRAY_SIZE(colors_extended)];
+	igt_crc_t crc[ARRAY_SIZE(colors_extended) + 1];
 	unsigned int crc_mismatch_mask = 0;
 	int crc_mismatch_count = 0;
 	bool result = true;
@@ -863,7 +869,7 @@ static bool test_format_plane_colors(data_t *data, enum pipe pipe,
 		capture_format_crcs_multiple(data, pipe, plane, format, modifier,
 					     width, height, encoding, range, crc,
 					     fb);
-		total_crcs = data->num_colors;
+		total_crcs = data->num_colors + 1;
 	} else {
 		capture_format_crcs_single(data, pipe, plane, format, modifier,
 					   width, height, encoding, range, crc,
@@ -881,7 +887,7 @@ static bool test_format_plane_colors(data_t *data, enum pipe pipe,
 	if (crc_mismatch_count)
 		igt_warn("CRC mismatches with format " IGT_FORMAT_FMT " on %s.%u with %d/%d solid colors tested (0x%X)\n",
 			 IGT_FORMAT_ARGS(format), kmstest_pipe_name(pipe),
-			 plane->index, crc_mismatch_count, data->num_colors, crc_mismatch_mask);
+			 plane->index, crc_mismatch_count, total_crcs, crc_mismatch_mask);
 
 	return result;
 }
@@ -1010,7 +1016,7 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 	struct igt_fb *clear_fb = plane->type == DRM_PLANE_TYPE_PRIMARY ? primary_fb : NULL;
 	drmModeModeInfo *mode;
 	uint64_t width, height;
-	igt_crc_t ref_crc[MAX_CRC_SET][ARRAY_SIZE(colors_extended)];
+	igt_crc_t ref_crc[MAX_CRC_SET][ARRAY_SIZE(colors_extended) + 1];
 	struct igt_vec tested_formats;
 	struct format_mod ref = {};
 	igt_crc_t *crcset;

-- 
2.43.0



More information about the igt-dev mailing list