* [PATCH] handle 10-bpc framebuffer layouts
@ 2021-06-05 20:15 Pip Cet
0 siblings, 0 replies; only message in thread
From: Pip Cet @ 2021-06-05 20:15 UTC (permalink / raw)
To: barebox
[-- Attachment #1: Type: text/plain, Size: 662 bytes --]
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
[-- Attachment #2: 0001-graphic_utils.c-handle-10-bpc-framebuffer-layouts.patch --]
[-- Type: text/x-patch, Size: 1137 bytes --]
From eac9610833b747aa3d1685dbc665cf13d863eaa6 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
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@gmail.com>
---
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
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-05 20:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 20:15 [PATCH] handle 10-bpc framebuffer layouts Pip Cet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox