[PATCH i-g-t v1 2/5] tests/kms_flip: Add gamma LUT test support

Naladala Ramanaidu ramanaidu.naladala at intel.com
Thu Aug 7 07:31:46 UTC 2025


Introduces gamma LUT test capability by adding a new flag and
integrating its setup and cleanup into the test flow, enhancing
color pipeline validation.

Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
---
 tests/kms_flip.c | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 6b91ad6eb..74e0d1a89 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -259,6 +259,7 @@
 #define TEST_BASIC		(1 << 30)
 
 #define TEST_DEGAMMA		(1 << 17)
+#define TEST_GAMMA		(1 << 25)
 
 #define EVENT_FLIP		(1 << 0)
 #define EVENT_VBLANK		(1 << 1)
@@ -1562,6 +1563,13 @@ test_setup(data_t *data, enum pipe p, uint64_t modifier)
 		igt_assert_lt(0, data->degamma_lut_size);
 	}
 
+	if (igt_pipe_obj_has_prop(&data->display.pipes[p], IGT_CRTC_GAMMA_LUT_SIZE)) {
+		data->gamma_lut_size =
+			igt_pipe_obj_get_prop(&data->display.pipes[p],
+					      IGT_CRTC_GAMMA_LUT_SIZE);
+		igt_assert_lt(0, data->gamma_lut_size);
+	}
+
 	pipe = &data->display.pipes[p];
 	igt_require(pipe->n_planes >= 0);
 
@@ -1580,7 +1588,7 @@ static void __run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	uint64_t modifier;
 	int i, ret;
 	data_t data = {};
-	gamma_lut_t *degamma_lut;
+	gamma_lut_t *degamma_lut, *gamma_full;
 	igt_pipe_t *pipe;
 
 restart:
@@ -1598,7 +1606,7 @@ restart:
 	else
 		modifier = DRM_FORMAT_MOD_LINEAR;
 
-	if (o->flags & TEST_DEGAMMA) {
+	if ((o->flags & TEST_DEGAMMA) || (o->flags & TEST_GAMMA)) {
 		test_setup(&data, o->pipe, modifier);
 		pipe = &data.display.pipes[o->pipe];
 	}
@@ -1637,6 +1645,14 @@ restart:
 		}
 	}
 
+	if (o->flags & TEST_GAMMA) {
+		if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT)) {
+			gamma_full = generate_table_max(data.gamma_lut_size);
+			set_gamma(&data, pipe, gamma_full);
+			igt_display_commit(&display);
+		}
+	}
+
 	paint_flip_mode(&o->fb_info[0], false);
 	if (!(o->flags & TEST_BO_TOOBIG))
 		paint_flip_mode(&o->fb_info[1], true);
@@ -1703,6 +1719,11 @@ retry:
 				free_lut(degamma_lut);
 			}
 
+			if (o->flags & TEST_GAMMA) {
+				disable_gamma(pipe);
+				free_lut(gamma_full);
+			}
+
 			igt_display_commit(&display);
 		}
 		igt_assert(!retried);
@@ -1759,6 +1780,11 @@ retry:
 				free_lut(degamma_lut);
 			}
 
+			if (o->flags & TEST_GAMMA) {
+				disable_gamma(pipe);
+				free_lut(gamma_full);
+			}
+
 			igt_display_commit(&display);
 		}
 
@@ -1788,6 +1814,11 @@ out:
 		free_lut(degamma_lut);
 	}
 
+	if (o->flags & TEST_GAMMA) {
+		disable_gamma(pipe);
+		free_lut(gamma_full);
+	}
+
 	igt_display_commit(&display);
 
 	last_connector = NULL;
-- 
2.43.0



More information about the Intel-gfx-trybot mailing list