diff options
author | Michal Januszewski <spock@gentoo.org> | 2009-04-13 17:39:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-13 18:04:29 -0400 |
commit | 0ca1071f7dbd673de826eb3fb01bfdfd1d423433 (patch) | |
tree | bb60620604449f357ae7d099395b20199bc96197 /drivers | |
parent | ebde441177da3bad156701d351509f34295282ab (diff) |
uvesafb: fix color component length for pseudocolor modes
uvesafb incorrectly sets the length of the color fields to 6 bits for
PSEUDOCOLOR modes, even though 8 bits are always used per pixel. Fix this
by setting the length to 8.
The switch of the DAC width from the default 6 bits to 8 bits is retained
and tracked internally in the driver, but never exposed to userspace.
Signed-off-by: Michal Januszewski <spock@gentoo.org>
Acked-by: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: <syrjala@sci.fi>
Cc: Geert Uytterhoeven <geert.uytterhoeven@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/uvesafb.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 0b370aebdbfd..421770b5e6ab 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -55,6 +55,7 @@ static u16 maxvf __devinitdata; /* maximum vertical frequency */ | |||
55 | static u16 maxhf __devinitdata; /* maximum horizontal frequency */ | 55 | static u16 maxhf __devinitdata; /* maximum horizontal frequency */ |
56 | static u16 vbemode __devinitdata; /* force use of a specific VBE mode */ | 56 | static u16 vbemode __devinitdata; /* force use of a specific VBE mode */ |
57 | static char *mode_option __devinitdata; | 57 | static char *mode_option __devinitdata; |
58 | static u8 dac_width = 6; | ||
58 | 59 | ||
59 | static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX]; | 60 | static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX]; |
60 | static DEFINE_MUTEX(uvfb_lock); | 61 | static DEFINE_MUTEX(uvfb_lock); |
@@ -303,22 +304,10 @@ static void uvesafb_setup_var(struct fb_var_screeninfo *var, | |||
303 | var->blue.offset = 0; | 304 | var->blue.offset = 0; |
304 | var->transp.offset = 0; | 305 | var->transp.offset = 0; |
305 | 306 | ||
306 | /* | 307 | var->red.length = 8; |
307 | * We're assuming that we can switch the DAC to 8 bits. If | 308 | var->green.length = 8; |
308 | * this proves to be incorrect, we'll update the fields | 309 | var->blue.length = 8; |
309 | * later in set_par(). | 310 | var->transp.length = 0; |
310 | */ | ||
311 | if (par->vbe_ib.capabilities & VBE_CAP_CAN_SWITCH_DAC) { | ||
312 | var->red.length = 8; | ||
313 | var->green.length = 8; | ||
314 | var->blue.length = 8; | ||
315 | var->transp.length = 0; | ||
316 | } else { | ||
317 | var->red.length = 6; | ||
318 | var->green.length = 6; | ||
319 | var->blue.length = 6; | ||
320 | var->transp.length = 0; | ||
321 | } | ||
322 | } | 311 | } |
323 | } | 312 | } |
324 | 313 | ||
@@ -1006,7 +995,7 @@ static int uvesafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1006 | struct fb_info *info) | 995 | struct fb_info *info) |
1007 | { | 996 | { |
1008 | struct uvesafb_pal_entry entry; | 997 | struct uvesafb_pal_entry entry; |
1009 | int shift = 16 - info->var.green.length; | 998 | int shift = 16 - dac_width; |
1010 | int err = 0; | 999 | int err = 0; |
1011 | 1000 | ||
1012 | if (regno >= info->cmap.len) | 1001 | if (regno >= info->cmap.len) |
@@ -1055,7 +1044,7 @@ static int uvesafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1055 | static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info) | 1044 | static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info) |
1056 | { | 1045 | { |
1057 | struct uvesafb_pal_entry *entries; | 1046 | struct uvesafb_pal_entry *entries; |
1058 | int shift = 16 - info->var.green.length; | 1047 | int shift = 16 - dac_width; |
1059 | int i, err = 0; | 1048 | int i, err = 0; |
1060 | 1049 | ||
1061 | if (info->var.bits_per_pixel == 8) { | 1050 | if (info->var.bits_per_pixel == 8) { |
@@ -1317,13 +1306,9 @@ setmode: | |||
1317 | err = uvesafb_exec(task); | 1306 | err = uvesafb_exec(task); |
1318 | if (err || (task->t.regs.eax & 0xffff) != 0x004f || | 1307 | if (err || (task->t.regs.eax & 0xffff) != 0x004f || |
1319 | ((task->t.regs.ebx & 0xff00) >> 8) != 8) { | 1308 | ((task->t.regs.ebx & 0xff00) >> 8) != 8) { |
1320 | /* | 1309 | dac_width = 6; |
1321 | * We've failed to set the DAC palette format - | 1310 | } else { |
1322 | * time to correct var. | 1311 | dac_width = 8; |
1323 | */ | ||
1324 | info->var.red.length = 6; | ||
1325 | info->var.green.length = 6; | ||
1326 | info->var.blue.length = 6; | ||
1327 | } | 1312 | } |
1328 | } | 1313 | } |
1329 | 1314 | ||