Commit 9c4f6c7a authored by Adam Jackson's avatar Adam Jackson 🦃

Fall back to VGA if the palette API isn't supported

I ported vesa to use the VBE service back in:

    commit 55f585a1
    Author: Adam Jackson <>
    Date:   Fri Sep 18 17:02:16 2009 -0400

	Use VBE palette load, not VGA banging.

I'm reasonably sure that worked on all the hardware I had handy at the
time. But it doesn't work in seabios, which means 8bpp is broken under

We query this API early in initialization, and if it fails ->savedPal
will be NULL, so use that as the hint to fall back to VGA banging.
Signed-off-by: Adam Jackson's avatarAdam Jackson <>
Reviewed-by: default avatarDave Airlie <>
parent c6fdaad9
......@@ -1356,6 +1356,27 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
int i, idx;
int base;
if (!pVesa->savedPal) {
#define VESADACDelay() \
do { \
(void)inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); \
(void)inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); \
} while (0)
for (i = 0; i < numColors; i++) {
idx = indices[i];
outb(pVesa->ioBase + VGA_DAC_WRITE_ADDR, idx);
outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].red);
outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].green);
outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].blue);
if (pVesa->pal == NULL)
pVesa->pal = calloc(1, sizeof(CARD32) * 256);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment