[i-g-t 15/16] tests/kms_color_chamelium: Extended IGT tests to support logarithmic gamma mode

Bhanuprakash Modem bhanuprakash.modem at intel.com
Wed Jul 20 10:48:41 UTC 2022


Extended IGT tests to support logarithmic gamma mode on pipe

v2:
* Rebase

Cc: Harry Wentland <harry.wentland at amd.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Cc: Pekka Paalanen <ppaalanen at gmail.com>
Cc: Kunal Joshi <kunal1.joshi at intel.com>
Cc: Uma Shankar <uma.shankar at intel.com>
Signed-off-by: Mukunda Pramodh Kumar <mukunda.pramodh.kumar at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_color_chamelium.c | 40 ++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index 749a1ca8..c8158026 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -170,11 +170,22 @@ static bool test_pipe_gamma(data_t *data,
 			      &fbref);
 	igt_assert(fbref_id);
 
-	igt_plane_set_fb(primary, &fbref);
+	igt_plane_set_fb(primary, &fb_modeset);
+
+	/* Reset the color properties */
 	disable_ctm(primary->pipe);
 	disable_degamma(primary->pipe);
-	set_gamma(data, primary->pipe, gamma_full);
+	disable_gamma(primary->pipe);
 	igt_display_commit(&data->display);
+	igt_wait_for_vblank(data->drm_fd,
+			    data->display.pipes[primary->pipe->pipe].crtc_offset);
+
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE)) {
+		set_advance_gamma(data, primary->pipe, MAX_GAMMA);
+	} else {
+		set_gamma(data, primary->pipe, gamma_full);
+		igt_display_commit(&data->display);
+	}
 
 	/* Draw solid colors with no gamma transformation. */
 	paint_rectangles(data, mode, red_green_blue, &fbref);
@@ -196,7 +207,7 @@ static bool test_pipe_gamma(data_t *data,
 	ret = chamelium_frame_match_or_dump(data->chamelium, port,
 					    frame_fullcolors, &fbref,
 					    CHAMELIUM_CHECK_ANALOG);
-
+	/* Cleanup */
 	disable_gamma(primary->pipe);
 	igt_plane_set_fb(primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
@@ -261,7 +272,10 @@ static bool test_pipe_ctm(data_t *data,
 
 	if (memcmp(before, after, sizeof(color_t))) {
 		set_degamma(data, primary->pipe, degamma_linear);
-		set_gamma(data, primary->pipe, gamma_linear);
+		if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE))
+			disable_gamma(primary->pipe);
+		else
+			set_gamma(data, primary->pipe, gamma_linear);
 	} else {
 		/* Disable Degamma and Gamma for ctm max test */
 		disable_degamma(primary->pipe);
@@ -291,11 +305,14 @@ static bool test_pipe_ctm(data_t *data,
 					     &fbref,
 					     CHAMELIUM_CHECK_ANALOG);
 
+	/* Cleanup */
 	igt_plane_set_fb(primary, NULL);
 	disable_degamma(primary->pipe);
 	disable_gamma(primary->pipe);
+	disable_ctm(primary->pipe);
 	igt_output_set_pipe(output, PIPE_NONE);
 	igt_display_commit(&data->display);
+
 	free_lut(degamma_linear);
 	free_lut(gamma_linear);
 
@@ -363,7 +380,14 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 	igt_plane_set_fb(primary, &fb_modeset);
 
 	set_degamma(data, primary->pipe, degamma_linear);
-	set_gamma(data, primary->pipe, gamma_linear);
+	/*
+	 * No need of linear gamma for limited range ctm test
+	 * Not extending for new API interface.
+	 */
+	if (igt_pipe_obj_has_prop(primary->pipe, IGT_CRTC_GAMMA_MODE))
+		disable_gamma(primary->pipe);
+	else
+		set_gamma(data, primary->pipe, gamma_linear);
 	set_ctm(primary->pipe, ctm);
 
 	igt_output_set_prop_value(output,
@@ -398,6 +422,12 @@ static bool test_pipe_limited_range_ctm(data_t *data,
 					    frame_limited, &fbref,
 					    CHAMELIUM_CHECK_ANALOG);
 
+	/* Cleanup */
+	disable_gamma(primary->pipe);
+	disable_degamma(primary->pipe);
+	disable_ctm(primary->pipe);
+	igt_display_commit(&data->display);
+
 	free_lut(gamma_linear);
 	free_lut(degamma_linear);
 
-- 
2.35.1



More information about the Intel-gfx-trybot mailing list