summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-06-26 00:26:41 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 09:58:30 -0700
commit6dbde380ca525bbfedd65e11402f345e1d64cba9 (patch)
tree4782592646559a4bef308ec1d055bb9a09bd72cf
parent313ca22f0bfab792adeb447146d9cb86536c64d3 (diff)
[PATCH] vesafb: Prefer VGA registers over PMI
- As per VESA specs, use the VGA registers to set the palette if the mode is VGA compatible. Otherwise, use the protected mode interface. - Make pmi_setpal default to 1 Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/vesafb.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index eff2ebcf1f7..5718924b677 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -51,7 +51,7 @@ static int inverse = 0;
static int mtrr = 0; /* disable mtrr */
static int vram_remap __initdata = 0; /* Set amount of memory to be used */
static int vram_total __initdata = 0; /* Set total amount of memory */
-static int pmi_setpal = 0; /* pmi for palette changes ??? */
+static int pmi_setpal = 1; /* pmi for palette changes ??? */
static int ypan = 0; /* 0..nothing, 1..ypan, 2..ywrap */
static unsigned short *pmi_base = NULL;
static void (*pmi_start)(void);
@@ -86,10 +86,24 @@ static int vesa_setpalette(int regno, unsigned red, unsigned green,
int shift = 16 - depth;
int err = -EINVAL;
+/*
+ * Try VGA registers first...
+ */
+ if (vga_compat) {
+ outb_p(regno, dac_reg);
+ outb_p(red >> shift, dac_val);
+ outb_p(green >> shift, dac_val);
+ outb_p(blue >> shift, dac_val);
+ err = 0;
+ }
+
#ifdef __i386__
- struct { u_char blue, green, red, pad; } entry;
+/*
+ * Fallback to the PMI....
+ */
+ if (err && pmi_setpal) {
+ struct { u_char blue, green, red, pad; } entry;
- if (pmi_setpal) {
entry.red = red >> shift;
entry.green = green >> shift;
entry.blue = blue >> shift;
@@ -107,18 +121,6 @@ static int vesa_setpalette(int regno, unsigned red, unsigned green,
}
#endif
-/*
- * without protected mode interface and if VGA compatible,
- * try VGA registers...
- */
- if (err && vga_compat) {
- outb_p(regno, dac_reg);
- outb_p(red >> shift, dac_val);
- outb_p(green >> shift, dac_val);
- outb_p(blue >> shift, dac_val);
- err = 0;
- }
-
return err;
}