diff options
author | Tobias Heider <tobhe@cvs.openbsd.org> | 2024-11-12 20:49:43 +0000 |
---|---|---|
committer | Tobias Heider <tobhe@cvs.openbsd.org> | 2024-11-12 20:49:43 +0000 |
commit | 88a20f3298fac34170ed21a7d24ad386081050b8 (patch) | |
tree | 221856c9bf382400c8af7d31c2de3dae5779ffea /sys | |
parent | a6c6dbe4d7e62c2bdd1308242aec0d9e11cee5b8 (diff) |
Adds support for BPP16 16-bit color EFI framebuffer format as offered
by u-boot.
From Paul Fertser
ok patrick@ miod@ kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index 385d44b7b67..288a9f1b9c9 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.61 2024/11/05 16:33:18 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.62 2024/11/12 20:49:42 tobhe Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -397,7 +397,7 @@ efi_framebuffer(void) uint32_t acells, scells; uint64_t base, size; uint32_t reg[4]; - uint32_t width, height, stride; + uint32_t width, height, stride, pxsize; char *format; char *prop; @@ -443,15 +443,31 @@ efi_framebuffer(void) if (gop == NULL || gop->Mode == NULL || gop->Mode->Info == NULL) return; - /* We only support 32-bit pixel modes for now. */ switch (gop->Mode->Info->PixelFormat) { case PixelRedGreenBlueReserved8BitPerColor: format = "x8b8g8r8"; + pxsize = 4; break; case PixelBlueGreenRedReserved8BitPerColor: format = "x8r8g8b8"; + pxsize = 4; break; + case PixelBitMask: { + EFI_PIXEL_BITMASK *bm = &gop->Mode->Info->PixelInformation; + if (bm->RedMask == 0xf800 && + bm->GreenMask == 0x07e0 && + bm->BlueMask == 0x001f) { + format = "r5g6b5"; + pxsize = 2; + break; + } + printf("Unsupported PixelInformation bitmasks\n"); + /* FALLTHROUGH */ + } default: + printf("Unsupported PixelFormat %d, not adding " + "\"simple-framebuffer\" DT node\n", + gop->Mode->Info->PixelFormat); return; } @@ -459,7 +475,7 @@ efi_framebuffer(void) size = gop->Mode->FrameBufferSize; width = htobe32(gop->Mode->Info->HorizontalResolution); height = htobe32(gop->Mode->Info->VerticalResolution); - stride = htobe32(gop->Mode->Info->PixelsPerScanLine * 4); + stride = htobe32(gop->Mode->Info->PixelsPerScanLine * pxsize); node = fdt_find_node("/"); if (fdt_node_property_int(node, "#address-cells", &acells) != 1) |