summaryrefslogtreecommitdiff
path: root/src/vesa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vesa.c')
-rw-r--r--src/vesa.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vesa.c b/src/vesa.c
index cbf6773..3f5b81c 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -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);
+ VESADACDelay();
+ outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].red);
+ VESADACDelay();
+ outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].green);
+ VESADACDelay();
+ outb(pVesa->ioBase + VGA_DAC_DATA, colors[idx].blue);
+ VESADACDelay();
+ }
+ return;
+ }
+
if (pVesa->pal == NULL)
pVesa->pal = calloc(1, sizeof(CARD32) * 256);