Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/chamelium/kms_chamelium_color: Add YUYV and NV12 coverage to color subtests
@ 2026-05-11 10:29 Pranay Samala
  2026-05-12  2:52 ` ✓ i915.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pranay Samala @ 2026-05-11 10:29 UTC (permalink / raw)
  To: igt-dev; +Cc: karthik.b.s, sameer.lattannavar, pranay.samala

Add multi-format coverage to kms_chamelium_color by iterating
DRM_FORMAT_XRGB8888, DRM_FORMAT_YUYV, and DRM_FORMAT_NV12 for
degamma, gamma, CTM, and limited-range CTM subtests.

Dynamic subtest names now include format suffix and unsupported
formats are skipped.

Observed behavior while validating:

ctm-green-to-red: RGB and YUYV render correctly, while NV12
shows a thin dark seam at the green-to-red transition.
ctm-negative: RGB is fully black as expected; YUYV/NV12 are
near-black with faint residual tint.

Signed-off-by: Pranay Samala <pranay.samala@intel.com>
---
 tests/chamelium/kms_chamelium_color.c | 281 +++++++++++++++++---------
 1 file changed, 181 insertions(+), 100 deletions(-)

diff --git a/tests/chamelium/kms_chamelium_color.c b/tests/chamelium/kms_chamelium_color.c
index 4b50a148d..d2ced32c8 100644
--- a/tests/chamelium/kms_chamelium_color.c
+++ b/tests/chamelium/kms_chamelium_color.c
@@ -58,6 +58,15 @@
 
 IGT_TEST_DESCRIPTION("Test Color Features at Pipe level using Chamelium to verify instead of CRC");
 
+static const struct {
+	const char *name;
+	uint32_t format;
+} formats[] = {
+	{ "RGB", DRM_FORMAT_XRGB8888 },
+	{ "YUYV", DRM_FORMAT_YUYV },
+	{ "NV12", DRM_FORMAT_NV12 },
+};
+
 /*
  * Draw 3 gradient rectangles in red, green and blue, with a maxed out
  * degamma LUT and verify we have the same frame dump as drawing solid color
@@ -87,28 +96,40 @@ static bool test_pipe_degamma(data_t *data,
 	igt_output_set_crtc(output, primary->crtc);
 
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
+	fb_id = igt_create_fb_with_bo_size(data->drm_fd,
+					   mode->hdisplay,
+					   mode->vdisplay,
+					   data->drm_format,
+					   DRM_FORMAT_MOD_LINEAR,
+					   IGT_COLOR_YCBCR_BT709,
+					   IGT_COLOR_YCBCR_FULL_RANGE,
+					   &fb,
+					   0,
+					   0);
 	igt_assert(fb_id);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
+	fb_modeset_id = igt_create_fb_with_bo_size(data->drm_fd,
+						   mode->hdisplay,
+						   mode->vdisplay,
+						   data->drm_format,
+						   DRM_FORMAT_MOD_LINEAR,
+						   IGT_COLOR_YCBCR_BT709,
+						   IGT_COLOR_YCBCR_FULL_RANGE,
+						   &fb_modeset,
+						   0,
+						   0);
 	igt_assert(fb_modeset_id);
 
-	fbref_id = igt_create_fb(data->drm_fd,
-				 mode->hdisplay,
-				 mode->vdisplay,
-				 DRM_FORMAT_XRGB8888,
-				 DRM_FORMAT_MOD_LINEAR,
-				 &fbref);
+	fbref_id = igt_create_fb_with_bo_size(data->drm_fd,
+					      mode->hdisplay,
+					      mode->vdisplay,
+					      data->drm_format,
+					      DRM_FORMAT_MOD_LINEAR,
+					      IGT_COLOR_YCBCR_BT709,
+					      IGT_COLOR_YCBCR_FULL_RANGE,
+					      &fbref,
+					      0,
+					      0);
 	igt_assert(fbref_id);
 
 	igt_plane_set_fb(primary, &fb_modeset);
@@ -178,28 +199,40 @@ static bool test_pipe_gamma(data_t *data,
 	igt_output_set_crtc(output, primary->crtc);
 
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
+	fb_id = igt_create_fb_with_bo_size(data->drm_fd,
+					   mode->hdisplay,
+					   mode->vdisplay,
+					   data->drm_format,
+					   DRM_FORMAT_MOD_LINEAR,
+					   IGT_COLOR_YCBCR_BT709,
+					   IGT_COLOR_YCBCR_FULL_RANGE,
+					   &fb,
+					   0,
+					   0);
 	igt_assert(fb_id);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
+	fb_modeset_id = igt_create_fb_with_bo_size(data->drm_fd,
+						   mode->hdisplay,
+						   mode->vdisplay,
+						   data->drm_format,
+						   DRM_FORMAT_MOD_LINEAR,
+						   IGT_COLOR_YCBCR_BT709,
+						   IGT_COLOR_YCBCR_FULL_RANGE,
+						   &fb_modeset,
+						   0,
+						   0);
 	igt_assert(fb_modeset_id);
 
-	fbref_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fbref);
+	fbref_id = igt_create_fb_with_bo_size(data->drm_fd,
+					      mode->hdisplay,
+					      mode->vdisplay,
+					      data->drm_format,
+					      DRM_FORMAT_MOD_LINEAR,
+					      IGT_COLOR_YCBCR_BT709,
+					      IGT_COLOR_YCBCR_FULL_RANGE,
+					      &fbref,
+					      0,
+					      0);
 	igt_assert(fbref_id);
 
 	igt_plane_set_fb(primary, &fbref);
@@ -267,28 +300,40 @@ static bool test_pipe_ctm(data_t *data,
 	igt_output_set_crtc(output, primary->crtc);
 
 	/* Create a framebuffer at the size of the output. */
-	fb_id = igt_create_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &fb);
+	fb_id = igt_create_fb_with_bo_size(data->drm_fd,
+					   mode->hdisplay,
+					   mode->vdisplay,
+					   data->drm_format,
+					   DRM_FORMAT_MOD_LINEAR,
+					   IGT_COLOR_YCBCR_BT709,
+					   IGT_COLOR_YCBCR_FULL_RANGE,
+					   &fb,
+					   0,
+					   0);
 	igt_assert(fb_id);
 
-	fb_modeset_id = igt_create_fb(data->drm_fd,
-				      mode->hdisplay,
-				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
-				      DRM_FORMAT_MOD_LINEAR,
-				      &fb_modeset);
+	fb_modeset_id = igt_create_fb_with_bo_size(data->drm_fd,
+						   mode->hdisplay,
+						   mode->vdisplay,
+						   data->drm_format,
+						   DRM_FORMAT_MOD_LINEAR,
+						   IGT_COLOR_YCBCR_BT709,
+						   IGT_COLOR_YCBCR_FULL_RANGE,
+						   &fb_modeset,
+						   0,
+						   0);
 	igt_assert(fb_modeset_id);
 
-	fbref_id = igt_create_fb(data->drm_fd,
-				 mode->hdisplay,
-				 mode->vdisplay,
-				 DRM_FORMAT_XRGB8888,
-				 DRM_FORMAT_MOD_LINEAR,
-				 &fbref);
+	fbref_id = igt_create_fb_with_bo_size(data->drm_fd,
+					      mode->hdisplay,
+					      mode->vdisplay,
+					      data->drm_format,
+					      DRM_FORMAT_MOD_LINEAR,
+					      IGT_COLOR_YCBCR_BT709,
+					      IGT_COLOR_YCBCR_FULL_RANGE,
+					      &fbref,
+					      0,
+					      0);
 	igt_assert(fbref_id);
 
 	igt_plane_set_fb(primary, &fb_modeset);
@@ -372,20 +417,28 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_output_set_crtc(output, primary->crtc);
 
 	/* Create a framebuffer at the size of the output. */
-	fb_id0 = igt_create_fb(data->drm_fd,
-			       mode->hdisplay,
-			       mode->vdisplay,
-			       DRM_FORMAT_XRGB8888,
-			       DRM_FORMAT_MOD_LINEAR,
-			       &fb0);
+	fb_id0 = igt_create_fb_with_bo_size(data->drm_fd,
+					    mode->hdisplay,
+					    mode->vdisplay,
+					    data->drm_format,
+					    DRM_FORMAT_MOD_LINEAR,
+					    IGT_COLOR_YCBCR_BT709,
+					    IGT_COLOR_YCBCR_LIMITED_RANGE,
+					    &fb0,
+					    0,
+					    0);
 	igt_assert(fb_id0);
 
-	fb_id1 = igt_create_fb(data->drm_fd,
-		               mode->hdisplay,
-			       mode->vdisplay,
-			       DRM_FORMAT_XRGB8888,
-			       DRM_FORMAT_MOD_LINEAR,
-			       &fb1);
+	fb_id1 = igt_create_fb_with_bo_size(data->drm_fd,
+					    mode->hdisplay,
+					    mode->vdisplay,
+					    data->drm_format,
+					    DRM_FORMAT_MOD_LINEAR,
+					    IGT_COLOR_YCBCR_BT709,
+					    IGT_COLOR_YCBCR_LIMITED_RANGE,
+					    &fb1,
+					    0,
+					    0);
 	igt_assert(fb_id1);
 
 	set_degamma(data, primary->crtc, degamma_linear);
@@ -502,14 +555,25 @@ run_gamma_degamma_tests_for_crtc(data_t *data, igt_crtc_t *crtc,
 	igt_require(port_idx >= 0);
 
 	data->color_depth = 8;
-	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
 	if (!crtc_output_combo_valid(data, crtc))
 		return;
 
-	igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), data->output->name)
-		igt_assert(test_t(data, data->primary, data->ports[port_idx]));
+	for (int i = 0; i < ARRAY_SIZE(formats); i++) {
+		igt_dynamic_f("pipe-%s-%s-%s", igt_crtc_name(crtc),
+			      data->output->name, formats[i].name) {
+			if (!igt_plane_has_format_mod(data->primary,
+						      formats[i].format,
+						      DRM_FORMAT_MOD_LINEAR))
+				continue;
+			igt_info("Running on " IGT_FORMAT_FMT " format\n",
+				 IGT_FORMAT_ARGS(formats[i].format));
+			data->drm_format = formats[i].format;
+			igt_assert(test_t(data, data->primary,
+					  data->ports[port_idx]));
+		}
+	}
 }
 
 static void
@@ -541,41 +605,47 @@ run_ctm_tests_for_crtc(data_t *data, igt_crtc_t *crtc,
 	 */
 	data->color_depth = 8;
 	delta = 1.0 / (1 << data->color_depth);
-	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
 	if (!crtc_output_combo_valid(data, crtc))
 		return;
 
-	igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), data->output->name) {
-		bool success = false;
-		int i;
-
-		if (!iter)
-			success = test_pipe_ctm(data, data->primary,
-						red_green_blue,
-						expected_colors, ctm,
-						data->ports[port_idx]);
-
-		/*
-		 * We tests a few values around the expected result because
-		 * it depends on the hardware we're dealing with, we can either
-		 * get clamped or rounded values and we also need to account
-		 * for odd number of items in the LUTs.
-		 */
-		for (i = 0; i < iter; i++) {
-			expected_colors[0].r =
-				expected_colors[1].g =
-				expected_colors[2].b =
-				ctm[0] + delta * (i - (iter / 2));
-			if (test_pipe_ctm(data, data->primary,
-					  red_green_blue, expected_colors,
-					  ctm, data->ports[port_idx])) {
-				success = true;
-				break;
+	for (int fi = 0; fi < ARRAY_SIZE(formats); fi++) {
+		igt_dynamic_f("pipe-%s-%s-%s", igt_crtc_name(crtc),
+			      data->output->name, formats[fi].name) {
+			bool success = false;
+			int i;
+
+			data->drm_format = formats[fi].format;
+
+			if (!igt_plane_has_format_mod(data->primary,
+						      formats[fi].format,
+						      DRM_FORMAT_MOD_LINEAR))
+				continue;
+
+			igt_info("Running on " IGT_FORMAT_FMT " format\n",
+				 IGT_FORMAT_ARGS(formats[fi].format));
+
+			if (!iter)
+				success = test_pipe_ctm(data, data->primary,
+							red_green_blue,
+							expected_colors, ctm,
+							data->ports[port_idx]);
+
+			for (i = 0; i < iter; i++) {
+				expected_colors[0].r =
+					expected_colors[1].g =
+					expected_colors[2].b =
+					ctm[0] + delta * (i - (iter / 2));
+				if (test_pipe_ctm(data, data->primary,
+						  red_green_blue, expected_colors,
+						  ctm, data->ports[port_idx])) {
+					success = true;
+					break;
+				}
 			}
+			igt_assert(success);
 		}
-		igt_assert(success);
 	}
 }
 
@@ -590,14 +660,25 @@ run_limited_range_ctm_test_for_crtc(data_t *data, igt_crtc_t *crtc,
 	igt_require(igt_output_has_prop(data->output, IGT_CONNECTOR_BROADCAST_RGB));
 
 	data->color_depth = 8;
-	data->drm_format = DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
 	if (!crtc_output_combo_valid(data, crtc))
 		return;
 
-	igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc), data->output->name)
-		igt_assert(test_t(data, data->primary, data->ports[port_idx]));
+	for (int i = 0; i < ARRAY_SIZE(formats); i++) {
+		igt_dynamic_f("pipe-%s-%s-%s", igt_crtc_name(crtc),
+			      data->output->name, formats[i].name) {
+			if (!igt_plane_has_format_mod(data->primary,
+						      formats[i].format,
+						      DRM_FORMAT_MOD_LINEAR))
+				continue;
+			igt_info("Running on " IGT_FORMAT_FMT " format\n",
+				 IGT_FORMAT_ARGS(formats[i].format));
+			data->drm_format = formats[i].format;
+			igt_assert(test_t(data, data->primary,
+					  data->ports[port_idx]));
+		}
+	}
 }
 
 static void
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-12 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 10:29 [PATCH i-g-t] tests/chamelium/kms_chamelium_color: Add YUYV and NV12 coverage to color subtests Pranay Samala
2026-05-12  2:52 ` ✓ i915.CI.BAT: success for " Patchwork
2026-05-12  3:51 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-12  8:30 ` ✓ Xe.CI.FULL: " Patchwork
2026-05-12 15:11 ` ✗ i915.CI.Full: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox