public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v1] tests/kms_color: Add 10-bit color depth support to gamma test for MediaTek
@ 2026-03-20  7:33 Jay Liu
  2026-03-20  8:45 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Jay Liu @ 2026-03-20  7:33 UTC (permalink / raw)
  To: igt-dev
  Cc: Jason-JH Lin, Paul-PL Chen, Nancy Lin, Singo Chang, Gil Dekel,
	Yacoub, Project_Global_Chrome_Upstream_Group, Jay Liu

1.Add 10-bit color depth flow to gamma test for MediaTek devices, which only
support bit-true results with 10-bit data. The test now selects 8-bit or
10-bit color depth and framebuffer format based on device type.

2. Change the maximum gamma LUT value from 4095 to 4092 for MediaTek devices.

Signed-off-by: Jay Liu <jay.liu@mediatek.com>
---
 tests/kms_color.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 565edb2dc..27fc08ab9 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -288,7 +288,7 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	fb_id = igt_create_fb(data->drm_fd,
 			      mode->hdisplay,
 			      mode->vdisplay,
-			      DRM_FORMAT_XRGB8888,
+			      data->drm_format,
 			      DRM_FORMAT_MOD_LINEAR,
 			      &fb);
 	igt_assert(fb_id);
@@ -296,7 +296,7 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	fb_modeset_id = igt_create_fb(data->drm_fd,
 				      mode->hdisplay,
 				      mode->vdisplay,
-				      DRM_FORMAT_XRGB8888,
+				      data->drm_format,
 				      DRM_FORMAT_MOD_LINEAR,
 				      &fb_modeset);
 	igt_assert(fb_modeset_id);
@@ -322,8 +322,16 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	igt_plane_set_fb(primary, &fb);
 
 	red_lut[0] = green_lut[0] = blue_lut[0] = 0;
-	for (i = 1; i < legacy_lut_size; i++)
-		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
+	for (i = 1; i < legacy_lut_size; i++) {
+		/*
+		 * Use 4092 for mtk gamma LUT to remap all values
+		 * to max red/green/blue.
+		 */
+		if (is_mtk_device(data->drm_fd))
+			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffd0;
+		else
+			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
+	}
 	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->crtc->crtc_id,
 					  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
 	igt_display_commit(&data->display);
@@ -752,14 +760,20 @@ static void
 run_gamma_degamma_tests_for_crtc(data_t *data, igt_crtc_t *crtc,
 				 bool (*test_t)(data_t*, igt_plane_t*))
 {
+	bool depth_10bit = false;
+
 	test_setup(data, crtc);
 
+	/* MediaTek can only support bit-ture in 10-bit depth pre color */
+	if (is_mtk_device(data->drm_fd))
+		depth_10bit = true;
+
 	/*
-	 * We assume an 8bits depth per color for degamma/gamma LUTs
+	 * We assume an 8bits or 10bits depth per color for degamma/gamma LUTs
 	 * for CRC checks with framebuffer references.
 	 */
-	data->color_depth = 8;
-	data->drm_format = DRM_FORMAT_XRGB8888;
+	data->color_depth = depth_10bit ? 10 : 8;
+	data->drm_format = depth_10bit ? DRM_FORMAT_XRGB2101010 : DRM_FORMAT_XRGB8888;
 	data->mode = igt_output_get_mode(data->output);
 
 	igt_require(crtc_output_combo_valid(data, crtc));
-- 
2.46.0


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

end of thread, other threads:[~2026-04-09 13:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20  7:33 [PATCH i-g-t v1] tests/kms_color: Add 10-bit color depth support to gamma test for MediaTek Jay Liu
2026-03-20  8:45 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-03-20  9:10 ` ✓ i915.CI.BAT: " Patchwork
2026-03-20 20:28 ` ✗ i915.CI.Full: failure " Patchwork
2026-03-21  4:37 ` ✗ Xe.CI.FULL: " Patchwork
2026-03-25 19:36 ` [PATCH i-g-t v1] " Sharma, Swati2
2026-04-09 13:02   ` Jay Liu (刘博)

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