From 8757d29f82fbb4edfbfe2010e34a0d3b198edf9f Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 13 Feb 2008 16:06:29 -0800 Subject: [PATCH] VESA: Support 15-bit RGB modes. If there are manufacturers which don't support linear framebuffers out there, then there is probably someone who want a 15-bit mode, too. --- com32/lib/sys/vesa/fmtpixel.h | 12 ++++++++++++ com32/lib/sys/vesa/initvesa.c | 5 +++++ com32/lib/sys/vesa/video.h | 1 + 3 files changed, 18 insertions(+) diff --git a/com32/lib/sys/vesa/fmtpixel.h b/com32/lib/sys/vesa/fmtpixel.h index 6221c0e..dcde010 100644 --- a/com32/lib/sys/vesa/fmtpixel.h +++ b/com32/lib/sys/vesa/fmtpixel.h @@ -66,6 +66,18 @@ static inline __attribute__((always_inline)) } break; + case PXF_LE_RGB15_555: + { + uint16_t pxv = + ((bgra >> 3) & 0x1f) + + ((bgra >> (2+8-5)) & (0x1f << 5)) + + ((bgra >> (3+16-10)) & (0x1f << 10)); + + *(uint16_t *)ptr = pxv; + ptr = (uint16_t *)ptr + 1; + } + break; + case PXF_NONE: /* Shuts up gcc */ break; } diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c index d8fb85d..abea95a 100644 --- a/com32/lib/sys/vesa/initvesa.c +++ b/com32/lib/sys/vesa/initvesa.c @@ -212,6 +212,11 @@ static int vesacon_set_mode(void) (mi->memory_layout == 6 && mi->rpos == 11 && mi->gpos == 5 && mi->bpos == 0))) pxf = PXF_LE_RGB16_565; + else if (mi->bpp == 15 && + (mi->memory_layout == 4 || + (mi->memory_layout == 6 && mi->rpos == 10 && mi->gpos == 5 && + mi->bpos == 0))) + pxf = PXF_LE_RGB15_555; if (pxf < bestpxf) { debug("Best mode so far, pxf = %d\n", pxf); diff --git a/com32/lib/sys/vesa/video.h b/com32/lib/sys/vesa/video.h index f9b3e5d..699d4e9 100644 --- a/com32/lib/sys/vesa/video.h +++ b/com32/lib/sys/vesa/video.h @@ -55,6 +55,7 @@ enum vesa_pixel_format { PXF_BGR24, /* 24-bit BGR */ PXF_BGRA32, /* 32-bit BGRA */ PXF_LE_RGB16_565, /* 16-bit littleendian 5:6:5 RGB */ + PXF_LE_RGB15_555, /* 15-bit littleendian 5:5:5 RGB */ PXF_NONE }; -- 2.7.4