[igt-dev] [PATCH i-g-t 4/4] tests/kms_plane: Test all modifiers as well

Ville Syrjala ville.syrjala at linux.intel.com
Thu Mar 28 17:57:27 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Instead of just testing each pixel format let's test every
format+modifier combo.

Obviously testing with solid filled fbs isn't the most effective
way to detect tiling problems, but we can't really do much more if
we want to keep comparing YUV vs. RGB results (unless we start to
render the RGB content in a way that matches the YUV subsampling
behaviour of the hardware).

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_plane.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 3f14dbf8e9b9..33e2905a8d71 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -392,7 +392,8 @@ static void set_legacy_lut(data_t *data, enum pipe pipe,
 
 static void test_format_plane_color(data_t *data, enum pipe pipe,
 				    igt_plane_t *plane,
-				    uint32_t format, int width, int height,
+				    uint32_t format, uint64_t modifier,
+				    int width, int height,
 				    int color, igt_crc_t *crc, struct igt_fb *fb)
 {
 	const color_t *c = &colors[color];
@@ -400,7 +401,7 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 
 	if (data->crop == 0 || format == DRM_FORMAT_XRGB8888) {
 		igt_create_color_fb(data->drm_fd, width, height,
-				    format, DRM_FORMAT_MOD_NONE,
+				    format, modifier,
 				    c->red, c->green, c->blue, fb);
 	} else {
 		/*
@@ -412,7 +413,7 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 		igt_create_fb(data->drm_fd,
 			      width + data->crop * 2,
 			      height + data->crop * 2,
-			      format, DRM_FORMAT_MOD_NONE, fb);
+			      format, modifier, fb);
 
 		cr = igt_get_cairo_ctx(data->drm_fd, fb);
 
@@ -450,6 +451,7 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 	struct igt_fb fb = {};
 	drmModeModeInfo *mode;
 	uint32_t format, ref_format;
+	uint64_t modifier, ref_modifier;
 	uint64_t width, height;
 	igt_crc_t ref_crc[ARRAY_SIZE(colors)];
 	bool result = true;
@@ -465,6 +467,7 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 		width = mode->hdisplay;
 		height = mode->vdisplay;
 		ref_format = format = DRM_FORMAT_XRGB8888;
+		ref_modifier = modifier = DRM_FORMAT_MOD_NONE;
 	} else {
 		if (!plane->drm_plane) {
 			igt_debug("Only legacy cursor ioctl supported, skipping cursor plane\n");
@@ -473,6 +476,7 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 		do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_WIDTH, &width));
 		do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_HEIGHT, &height));
 		ref_format = format = DRM_FORMAT_ARGB8888;
+		ref_modifier = modifier = DRM_FORMAT_MOD_NONE;
 	}
 
 	igt_debug("Testing connector %s on %s plane %s.%u\n",
@@ -481,8 +485,8 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 
 	igt_pipe_crc_start(data->pipe_crc);
 
-	igt_info("Testing format " IGT_FORMAT_FMT " on %s.%u\n",
-		 IGT_FORMAT_ARGS(format),
+	igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 " on %s.%u\n",
+		 IGT_FORMAT_ARGS(format), modifier,
 		 kmstest_pipe_name(pipe), plane->index);
 
 	if (data->display.is_atomic) {
@@ -508,30 +512,34 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 
 	for (int i = 0; i < ARRAY_SIZE(colors); i++) {
 		test_format_plane_color(data, pipe, plane,
-					format, width, height,
+					format, modifier,
+					width, height,
 					i, &ref_crc[i], &fb);
 	}
 
-	for (int i = 0; i < plane->drm_plane->count_formats; i++) {
+	for (int i = 0; i < plane->format_mod_count; i++) {
 		int crc_mismatch_count = 0;
 		int crc_mismatch_mask = 0;
 		igt_crc_t crc;
 
-		format = plane->drm_plane->formats[i];
+		format = plane->formats[i];
+		modifier = plane->modifiers[i];
 
-		if (format == ref_format)
+		if (format == ref_format &&
+		    modifier == ref_modifier)
 			continue;
 
 		if (!igt_fb_supported_format(format))
 			continue;
 
-		igt_info("Testing format " IGT_FORMAT_FMT " on %s.%u\n",
-			 IGT_FORMAT_ARGS(format),
+		igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 " on %s.%u\n",
+			 IGT_FORMAT_ARGS(format), modifier,
 			 kmstest_pipe_name(pipe), plane->index);
 
 		for (int j = 0; j < ARRAY_SIZE(colors); j++) {
 			test_format_plane_color(data, pipe, plane,
-						format, width, height,
+						format, modifier,
+						width, height,
 						j, &crc, &fb);
 
 			if (!igt_check_crc_equal(&crc, &ref_crc[j])) {
-- 
2.19.2



More information about the igt-dev mailing list