[igt-dev] [i-g-t v2 2/6] tests/kms_color_chamelium: Initialize lut_size before running the test

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Sep 3 07:32:47 UTC 2021


If we try to run the lut_size tests alone, we may get improper
result, b'coz lut_size is not initialized. But in the CI,
igt_runner will run gamma/degamma test first which will cache
the lut_size then run the size tests.

This patch will fix the logic to initialized lut_size before
running any test.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_color_chamelium.c | 45 ++++++++++++++++++++++++++++---------
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/tests/kms_color_chamelium.c b/tests/kms_color_chamelium.c
index bc4356bfa..97efdcaae 100644
--- a/tests/kms_color_chamelium.c
+++ b/tests/kms_color_chamelium.c
@@ -721,6 +721,39 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	}
 }
 
+static void run_size_tests(data_t *data)
+{
+	igt_pipe_t *pipe = &data->display.pipes[0];
+
+	igt_fixture {
+		if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT_SIZE)) {
+			data->degamma_lut_size =
+				igt_pipe_obj_get_prop(pipe,
+						      IGT_CRTC_DEGAMMA_LUT_SIZE);
+			igt_assert_lt(0, data->degamma_lut_size);
+		}
+
+		if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_GAMMA_LUT_SIZE)) {
+			data->gamma_lut_size =
+				igt_pipe_obj_get_prop(pipe,
+						      IGT_CRTC_GAMMA_LUT_SIZE);
+			igt_assert_lt(0, data->gamma_lut_size);
+		}
+	}
+
+	igt_describe("Negative check for invalid gamma lut sizes");
+	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
+		invalid_gamma_lut_sizes(data);
+
+	igt_describe("Negative check for invalid degamma lut sizes");
+	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
+		invalid_degamma_lut_sizes(data);
+
+	igt_describe("Negative check for color tranformation matrix sizes");
+	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
+		invalid_ctm_matrix_sizes(data);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -752,17 +785,9 @@ igt_main
 	for_each_pipe_static(pipe)
 		igt_subtest_group
 			run_tests_for_pipe(&data, pipe);
-	igt_describe("Negative test case gamma lut size");
-	igt_subtest_f("pipe-invalid-gamma-lut-sizes")
-		invalid_gamma_lut_sizes(&data);
 
-	igt_describe("Negative test case degamma lut size");
-	igt_subtest_f("pipe-invalid-degamma-lut-sizes")
-		invalid_degamma_lut_sizes(&data);
-
-	igt_describe("Negative test case ctm matrix size");
-	igt_subtest_f("pipe-invalid-ctm-matrix-sizes")
-		invalid_ctm_matrix_sizes(&data);
+	igt_subtest_group
+		run_size_tests(&data);
 
 	igt_fixture {
 		igt_display_fini(&data.display);
-- 
2.32.0



More information about the igt-dev mailing list