[igt-dev] [PATCH i-g-t 6/8] tests/kms_color: Add and additional "signed" subtest

Ville Syrjala ville.syrjala at linux.intel.com
Tue Apr 11 07:50:59 UTC 2023


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

i915 CHV CSC code has a bug where it treats the hardware
CSC coefficient as sign-magnitude instead of the two's
complement value that it is. None of the current tests
manage to notice this.

Add a testcase that uses suitable negative coefficients
to catch the issue. With CHV's s4.12 coefficients the
-0.25 ends up as -7.75 and the results won't match.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_color.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index d430ee12aaa3..35083122dfbf 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -959,6 +959,11 @@ run_tests_for_pipe(data_t *data)
 		{ 0.0, 1.0, 0.0 },
 		{ 0.0, 0.0, 1.0 },
 	};
+	static const color_t colors_cmy[] = {
+		{ 0.0, 1.0, 1.0 },
+		{ 1.0, 0.0, 1.0 },
+		{ 1.0, 1.0, 0.0 }
+	};
 	static const struct {
 		const char *name;
 		int iter;
@@ -1040,6 +1045,16 @@ run_tests_for_pipe(data_t *data)
 		  },
 		  .desc = "Check the color transformation for 0.75 transparency",
 		},
+		{ .name = "ctm-signed",
+		  .fb_colors = colors_cmy,
+		  .iter = 3,
+		  .ctm = {
+			  -0.25,  0.75,  0.75,
+			   0.75, -0.25,  0.75,
+			   0.75,  0.75, -0.25,
+		  },
+		  .desc = "Check the color transformation for correct signed handling",
+		},
 	};
 	int i;
 
-- 
2.39.2



More information about the igt-dev mailing list