kernel/interface: 30-bit RGB pixel format support

On Apple ARM platforms, iBoot sets up a 30-bit framebuffer

Change-Id: I6c03937303a3363fde511c8b8b7f8fd66a6a6965
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11128
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Sam Roberts
2026-06-17 18:01:51 +00:00
committed by waddlesplash
parent a309dd6890
commit c216360337
13 changed files with 99 additions and 23 deletions
+3
View File
@@ -175,6 +175,7 @@ typedef enum {
B_RGB48 = 0x0011, // RGB RGB 16:16:16
B_RGB32 = 0x0008, // BGR- -RGB 8:8:8:8
B_RGBA32 = 0x2008, // BGRA ARGB 8:8:8:8
B_RGB30 = 0x0009, // BGR- -RGB 2:10:10:10
B_RGB24 = 0x0003, // BGR RGB 8:8:8
B_RGB16 = 0x0005, // BGR RGB 5:6:5
B_RGB15 = 0x0010, // BGR- -RGB 1:5:5:5
@@ -188,6 +189,7 @@ typedef enum {
B_RGB48_BIG = 0x1011, // RGB RGB 16:16:16
B_RGB32_BIG = 0x1008, // -RGB BGR- 8:8:8:8
B_RGBA32_BIG = 0x3008, // ARGB BGRA 8:8:8:8
B_RGB30_BIG = 0x1009, // -RGB BGR- 10:10:10:2
B_RGB24_BIG = 0x1003, // RGB BGR 8:8:8
B_RGB16_BIG = 0x1005, // RGB BGR 5:6:5
B_RGB15_BIG = 0x1010, // -RGB BGR- 5:5:5:1
@@ -198,6 +200,7 @@ typedef enum {
B_RGB48_LITTLE = B_RGB48,
B_RGB32_LITTLE = B_RGB32,
B_RGBA32_LITTLE = B_RGBA32,
B_RGB30_LITTLE = B_RGB30,
B_RGB24_LITTLE = B_RGB24,
B_RGB16_LITTLE = B_RGB16,
B_RGB15_LITTLE = B_RGB15,
@@ -128,6 +128,32 @@ blit24(const BlitParameters& params)
}
static void
blit30(const BlitParameters& params)
{
const uint8* data = params.from;
data += (params.fromWidth * params.fromTop + params.fromLeft) * 3;
uint32* start = (uint32*)(params.to
+ params.toBytesPerRow * params.toTop
+ 4 * params.toLeft);
for (int32 y = params.fromTop; y < params.fromBottom; y++) {
const uint8* src = data;
uint32* dst = start;
for (int32 x = params.fromLeft; x < params.fromRight; x++) {
dst[0] = (((src[2] * 1023) / 255) << 20)
| (((src[1] * 1023) / 255) << 10)
| ((src[0] * 1023) / 255);
dst++;
src += 3;
}
data += params.fromWidth * 3;
start = (uint32*)((addr_t)start + params.toBytesPerRow);
}
}
static void
blit32(const BlitParameters& params)
{
@@ -168,6 +194,9 @@ blit(const BlitParameters& params, int32 depth)
case 24:
blit24(params);
return;
case 30:
blit30(params);
return;
case 32:
blit32(params);
return;