I'm playing with barebox on an Apple M1-based MacBook Pro that uses the (new-ish) x2r10g10b10 framebuffer layout. The attached patch is sufficient to get a white-on-black prompt rather than black-on-black text. (I can't actually use the prompt yet, as there's no keyboard driver, but it's a start.) I'm aware that this code isn't as accurate as it could be (the LSBs of the 10-bit color are always 00), but I think it's worth it to keep this code (relatively) simple, and the difference is unlikely to ever be apparent to anyone. Please let me know if you'd prefer a version which does the (r * 0x101) >> (16 - length) thing or any other version. Thanks! Pip
From eac9610833b747aa3d1685dbc665cf13d863eaa6 Mon Sep 17 00:00:00 2001 From: Pip Cet <pipcet@xxxxxxxxx> Date: Sat, 5 Jun 2021 19:59:09 +0000 Subject: [PATCH] graphic_utils.c: handle 10-bpc framebuffer layouts Signed-off-by: Pip Cet <pipcet@xxxxxxxxx> --- lib/gui/graphic_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c index 0bed93221..3cb791050 100644 --- a/lib/gui/graphic_utils.c +++ b/lib/gui/graphic_utils.c @@ -24,10 +24,10 @@ u32 gu_rgb_to_pixel(struct fb_info *info, u8 r, u8 g, u8 b, u8 t) { u32 px; - px = (t >> (8 - info->transp.length)) << info->transp.offset | - (r >> (8 - info->red.length)) << info->red.offset | - (g >> (8 - info->green.length)) << info->green.offset | - (b >> (8 - info->blue.length)) << info->blue.offset; + px = ((t << 2) >> (10 - info->transp.length)) << info->transp.offset | + ((r << 2) >> (10 - info->red.length)) << info->red.offset | + ((g << 2) >> (10 - info->green.length)) << info->green.offset | + ((b << 2) >> (10 - info->blue.length)) << info->blue.offset; return px; } -- 2.30.2
_______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox