[igt-dev] [PATCH i-g-t v2 2/3] tests/kms_color: Do not mask LUT for non i915 drivers.

sunpeng.li at amd.com sunpeng.li at amd.com
Thu Apr 12 21:46:41 UTC 2018


From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>

Masking assumes a direct relationship between the software LUT
structure, and hardware LUT. This is not always the case.

On AMD hardware for example, the hardware LUT is composed of
piecewise-linear segments, with end-point spaced exponentially along the
X axis, while software LUT is spaced linearly. Masking the LUT for the
purpose of truncating the resulting colors won't work here.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>

v2: Add commit message and sign off.
---
 tests/kms_color.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index c312697..1e51917 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -165,7 +165,12 @@ static struct _drm_color_lut *coeffs_to_lut(data_t *data,
 	struct _drm_color_lut *lut;
 	uint32_t i;
 	uint32_t max_value = (1 << 16) - 1;
-	uint32_t mask = ((1 << color_depth) - 1) << 8;
+	uint32_t mask;
+
+	if (is_i915_device(data->drm_fd))
+		mask = ((1 << color_depth) - 1) << 8;
+	else
+		mask = max_value;
 
 	lut = malloc(sizeof(struct _drm_color_lut) * lut_size);
 
-- 
2.7.4



More information about the igt-dev mailing list