[PATCH i-g-t 04/14] lib/igt_draw: Support 8bpp int the mmap/pwrite paths

Ville Syrjala ville.syrjala at linux.intel.com
Fri Oct 4 10:41:11 UTC 2024


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

Handle 8bpp pixels formats correcly in the mmap/pwrite
methods.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_draw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index 54c46fe6360c..b39a33dcf2cb 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -365,7 +365,10 @@ static void tile4_pos_to_x_y_linear(int tiled_pos, uint32_t stride,
 
 static void set_pixel(void *_ptr, int index, uint64_t color, int bpp)
 {
-	if (bpp == 16) {
+	if (bpp == 8) {
+		uint8_t *ptr = _ptr;
+		ptr[index] = color;
+	} else if (bpp == 16) {
 		uint16_t *ptr = _ptr;
 		ptr[index] = color;
 	} else if (bpp == 32) {
-- 
2.45.2



More information about the igt-dev mailing list