summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2018-01-31 10:48:07 -0500
committerAdam Jackson <ajax@redhat.com>2018-02-15 14:27:24 -0500
commit9c4f6c7ab011435a492dd5cb1847bf00f290c219 (patch)
treea093a50c8862e7eaac5536c16845ec25f38d33c3
parentc6fdaad9649d3fb6a13a8180c17ea8181aabd375 (diff)
downloadxorg-driver-xf86-video-vesa-9c4f6c7ab011435a492dd5cb1847bf00f290c219.tar.gz
Fall back to VGA if the palette API isn't supported
I ported vesa to use the VBE service back in: commit 55f585a15f42ffe028ff37ea1f63543795dbf56e Author: Adam Jackson <ajax@redhat.com> 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 qemu. 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 <ajax@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
-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);