mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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>
This commit is contained in:
parent
ebde441177
commit
0ca1071f7d
1 changed files with 10 additions and 25 deletions
|
@ -55,6 +55,7 @@ static u16 maxvf __devinitdata; /* maximum vertical frequency */
|
||||||
static u16 maxhf __devinitdata; /* maximum horizontal frequency */
|
static u16 maxhf __devinitdata; /* maximum horizontal frequency */
|
||||||
static u16 vbemode __devinitdata; /* force use of a specific VBE mode */
|
static u16 vbemode __devinitdata; /* force use of a specific VBE mode */
|
||||||
static char *mode_option __devinitdata;
|
static char *mode_option __devinitdata;
|
||||||
|
static u8 dac_width = 6;
|
||||||
|
|
||||||
static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX];
|
static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX];
|
||||||
static DEFINE_MUTEX(uvfb_lock);
|
static DEFINE_MUTEX(uvfb_lock);
|
||||||
|
@ -303,22 +304,10 @@ static void uvesafb_setup_var(struct fb_var_screeninfo *var,
|
||||||
var->blue.offset = 0;
|
var->blue.offset = 0;
|
||||||
var->transp.offset = 0;
|
var->transp.offset = 0;
|
||||||
|
|
||||||
/*
|
var->red.length = 8;
|
||||||
* We're assuming that we can switch the DAC to 8 bits. If
|
var->green.length = 8;
|
||||||
* this proves to be incorrect, we'll update the fields
|
var->blue.length = 8;
|
||||||
* later in set_par().
|
var->transp.length = 0;
|
||||||
*/
|
|
||||||
if (par->vbe_ib.capabilities & VBE_CAP_CAN_SWITCH_DAC) {
|
|
||||||
var->red.length = 8;
|
|
||||||
var->green.length = 8;
|
|
||||||
var->blue.length = 8;
|
|
||||||
var->transp.length = 0;
|
|
||||||
} else {
|
|
||||||
var->red.length = 6;
|
|
||||||
var->green.length = 6;
|
|
||||||
var->blue.length = 6;
|
|
||||||
var->transp.length = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,7 +995,7 @@ static int uvesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||||
struct fb_info *info)
|
struct fb_info *info)
|
||||||
{
|
{
|
||||||
struct uvesafb_pal_entry entry;
|
struct uvesafb_pal_entry entry;
|
||||||
int shift = 16 - info->var.green.length;
|
int shift = 16 - dac_width;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (regno >= info->cmap.len)
|
if (regno >= info->cmap.len)
|
||||||
|
@ -1055,7 +1044,7 @@ static int uvesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||||
static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
|
static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
|
||||||
{
|
{
|
||||||
struct uvesafb_pal_entry *entries;
|
struct uvesafb_pal_entry *entries;
|
||||||
int shift = 16 - info->var.green.length;
|
int shift = 16 - dac_width;
|
||||||
int i, err = 0;
|
int i, err = 0;
|
||||||
|
|
||||||
if (info->var.bits_per_pixel == 8) {
|
if (info->var.bits_per_pixel == 8) {
|
||||||
|
@ -1317,13 +1306,9 @@ setmode:
|
||||||
err = uvesafb_exec(task);
|
err = uvesafb_exec(task);
|
||||||
if (err || (task->t.regs.eax & 0xffff) != 0x004f ||
|
if (err || (task->t.regs.eax & 0xffff) != 0x004f ||
|
||||||
((task->t.regs.ebx & 0xff00) >> 8) != 8) {
|
((task->t.regs.ebx & 0xff00) >> 8) != 8) {
|
||||||
/*
|
dac_width = 6;
|
||||||
* We've failed to set the DAC palette format -
|
} else {
|
||||||
* time to correct var.
|
dac_width = 8;
|
||||||
*/
|
|
||||||
info->var.red.length = 6;
|
|
||||||
info->var.green.length = 6;
|
|
||||||
info->var.blue.length = 6;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue