Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2] tests/kms_color: Always use atomic_commit for setting color properties
@ 2025-11-21  7:53 Jason-JH Lin
  2025-11-21  8:56 ` Ville Syrjälä
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Jason-JH Lin @ 2025-11-21  7:53 UTC (permalink / raw)
  To: igt-dev, Karthik B S, Swati Sharma, Uma, Chaitanya Kumar,
	Kamil Konieczny, Juha-Pekka Heikkila, Bhanuprakash Modem,
	Fei Shao
  Cc: Jani, Jason-JH Lin, Paul-PL Chen, Nancy Lin, Singo Chang,
	Gil Dekel, Yacoub, Project_Global_Chrome_Upstream_Group

When a driver makes use of gamma_lut, degamma_lut, or ctm properties
from crtc state, these properties are applied only via atomic commit.
This change ensures all relevant properties are properly synchronized
to crtc state during testing.

All upstream drivers that support color management properties also
support atomic commits, so legacy commit handling in kms_color is no
longer needed.

Update the test logic to always use igt_display_commit_atomic with
DRM_MODE_ATOMIC_ALLOW_MODESET for all color management operations.
This simplifies code and guarantees correct validation of gamma,
degamma, and ctm properties.

Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
---
 tests/kms_color.c | 47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index c424083b7fd4..0d2baf8f8aad 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -125,12 +125,12 @@ static bool test_pipe_degamma(data_t *data,
 	disable_ctm(primary->pipe);
 	disable_gamma(primary->pipe);
 	set_degamma(data, primary->pipe, degamma_linear);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	/* Draw solid colors with linear degamma transformation. */
 	paint_rectangles(data, mode, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
@@ -142,7 +142,7 @@ static bool test_pipe_degamma(data_t *data,
 	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_degamma(data, primary->pipe, degamma_full);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
@@ -156,7 +156,7 @@ static bool test_pipe_degamma(data_t *data,
 	disable_degamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_remove_fb(data->drm_fd, &fb);
 	igt_remove_fb(data->drm_fd, &fb_modeset);
 
@@ -215,12 +215,12 @@ static bool test_pipe_gamma(data_t *data,
 	disable_ctm(primary->pipe);
 	disable_degamma(primary->pipe);
 	set_gamma(data, primary->pipe, gamma_full);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	/* Draw solid colors with no gamma transformation. */
 	paint_rectangles(data, mode, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
@@ -231,7 +231,7 @@ static bool test_pipe_gamma(data_t *data,
 	 */
 	paint_gradient_rectangles(data, mode, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
@@ -245,7 +245,7 @@ static bool test_pipe_gamma(data_t *data,
 	disable_gamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_remove_fb(data->drm_fd, &fb);
 	igt_remove_fb(data->drm_fd, &fb_modeset);
 
@@ -312,12 +312,12 @@ static bool test_pipe_legacy_gamma(data_t *data,
 	disable_degamma(primary->pipe);
 	disable_gamma(primary->pipe);
 	disable_ctm(primary->pipe);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	/* Draw solid colors with no gamma transformation. */
 	paint_rectangles(data, mode, red_green_blue, &fb);
 	igt_plane_set_fb(primary, &fb);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
@@ -334,7 +334,7 @@ static bool test_pipe_legacy_gamma(data_t *data,
 		red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
 	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
 					  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
@@ -351,11 +351,11 @@ static bool test_pipe_legacy_gamma(data_t *data,
 
 	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
 					  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_remove_fb(data->drm_fd, &fb);
 	igt_remove_fb(data->drm_fd, &fb_modeset);
 
@@ -384,6 +384,7 @@ static bool test_pipe_legacy_gamma_reset(data_t *data,
 	uint16_t *red_lut, *green_lut, *blue_lut;
 	struct drm_color_lut *lut;
 	drmModePropertyBlobPtr blob;
+	igt_display_t *display = &data->display;
 	igt_output_t *output = data->output;
 	bool ret = true;
 
@@ -399,7 +400,7 @@ static bool test_pipe_legacy_gamma_reset(data_t *data,
 	disable_degamma(primary->pipe);
 	disable_ctm(primary->pipe);
 	disable_gamma(primary->pipe);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	/*
 	 * Set a degama & gamma LUT and a CTM using the
@@ -411,7 +412,7 @@ static bool test_pipe_legacy_gamma_reset(data_t *data,
 	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_CTM))
 		set_ctm(primary->pipe, ctm_identity);
 	set_gamma(data, primary->pipe, gamma_zero);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT)) {
 		blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
@@ -466,7 +467,7 @@ static bool test_pipe_legacy_gamma_reset(data_t *data,
 					  primary->pipe->crtc_id,
 					  legacy_lut_size,
 					  red_lut, green_lut, blue_lut), 0);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_DEGAMMA_LUT))
 		igt_assert(get_blob(data, primary->pipe,
@@ -493,7 +494,7 @@ static bool test_pipe_legacy_gamma_reset(data_t *data,
 end:
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	free_lut(degamma_linear);
 	free_lut(gamma_zero);
@@ -572,12 +573,12 @@ static bool test_pipe_ctm(data_t *data,
 	igt_debug("color after[2] %f,%f,%f\n", after[2].r, after[2].g, after[2].b);
 
 	disable_ctm(primary->pipe);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	paint_rectangles(data, mode, after, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_identity);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
@@ -586,7 +587,7 @@ static bool test_pipe_ctm(data_t *data,
 	paint_rectangles(data, mode, before, &fb);
 	igt_plane_set_fb(primary, &fb);
 	set_ctm(primary->pipe, ctm_matrix);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_wait_for_vblank(data->drm_fd,
 			    display->pipes[primary->pipe->pipe].crtc_offset);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
@@ -600,7 +601,7 @@ static bool test_pipe_ctm(data_t *data,
 	disable_ctm(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
-	igt_display_commit(&data->display);
+	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 	igt_remove_fb(data->drm_fd, &fb);
 	igt_remove_fb(data->drm_fd, &fb_modeset);
 
@@ -689,7 +690,7 @@ static void test_pipe_limited_range_ctm(data_t *data,
 		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB, BROADCAST_RGB_FULL);
 		paint_rectangles(data, mode, red_green_blue_limited, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 		igt_wait_for_vblank(data->drm_fd,
 				display->pipes[primary->pipe->pipe].crtc_offset);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_full);
@@ -698,7 +699,7 @@ static void test_pipe_limited_range_ctm(data_t *data,
 		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB, BROADCAST_RGB_16_235);
 		paint_rectangles(data, mode, red_green_blue_full, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 		igt_wait_for_vblank(data->drm_fd,
 				display->pipes[primary->pipe->pipe].crtc_offset);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_limited);
-- 
2.43.0


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

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

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21  7:53 [PATCH i-g-t v2] tests/kms_color: Always use atomic_commit for setting color properties Jason-JH Lin
2025-11-21  8:56 ` Ville Syrjälä
2025-11-21  9:47   ` Jason-JH Lin (林睿祥)
2025-11-21 10:38     ` Ville Syrjälä
2025-11-24  6:47       ` Jason-JH Lin (林睿祥)
2025-11-24 21:00         ` Ville Syrjälä
2025-11-25  2:19           ` Jason-JH Lin (林睿祥)
2025-11-25 17:06             ` Ville Syrjälä
2025-11-26 14:40               ` Jason-JH Lin (林睿祥)
2026-02-11 11:24                 ` Jason-JH Lin (林睿祥)
2026-02-11 13:31                   ` Ville Syrjälä
2026-02-12 10:15                     ` Jason-JH Lin (林睿祥)
2026-02-12 11:57                       ` Ville Syrjälä
2026-02-12 15:02                         ` Jason-JH Lin (林睿祥)
2025-11-25  2:50 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-11-25  3:03 ` ✓ i915.CI.BAT: " Patchwork
2025-11-25  4:43 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-25  8:52 ` ✗ i915.CI.Full: " Patchwork

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