diff mbox series

[libdrm,v3,1/9] util: Improve SMPTE color LUT accuracy

Message ID ac877d9ac9c5b98d476ef1cec216a99a12903e73.1690537375.git.geert@linux-m68k.org (mailing list archive)
State New, archived
Headers show
Series util, modetest: Add support for low-color frame buffer formats | expand

Commit Message

Geert Uytterhoeven July 28, 2023, 9:52 a.m. UTC
Fill in the LSB when converting color components from 8-bit to 16-bit.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---
v3:
  - Add Acked-by,

v2:
  - New.
---
 tests/util/pattern.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/tests/util/pattern.c b/tests/util/pattern.c
index 158c0b160a2ee870..e85efdc893891bf7 100644
--- a/tests/util/pattern.c
+++ b/tests/util/pattern.c
@@ -646,9 +646,9 @@  void util_smpte_c8_gamma(unsigned size, struct drm_color_lut *lut)
 	memset(lut, 0, size * sizeof(struct drm_color_lut));
 
 #define FILL_COLOR(idx, r, g, b) \
-	lut[idx].red = (r) << 8; \
-	lut[idx].green = (g) << 8; \
-	lut[idx].blue = (b) << 8
+	lut[idx].red = (r) * 0x101; \
+	lut[idx].green = (g) * 0x101; \
+	lut[idx].blue = (b) * 0x101
 
 	FILL_COLOR( 0, 192, 192, 192);	/* grey */
 	FILL_COLOR( 1, 192, 192, 0  );	/* yellow */