Commit b8e2e289 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Set color depth to 8 if in pseudocolor in vesafb.

Set color depth to 8 if in pseudocolor in vesafb.  The CLUT size,
previously saved as {red|green|blue}.length, is now private to vesafb.
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 56a2ff06
...@@ -56,6 +56,7 @@ static int ypan = 0; /* 0..nothing, 1..ypan, 2..ywrap */ ...@@ -56,6 +56,7 @@ static int ypan = 0; /* 0..nothing, 1..ypan, 2..ywrap */
static unsigned short *pmi_base = NULL; static unsigned short *pmi_base = NULL;
static void (*pmi_start)(void); static void (*pmi_start)(void);
static void (*pmi_pal)(void); static void (*pmi_pal)(void);
static int depth;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -89,11 +90,11 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var, ...@@ -89,11 +90,11 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var,
} }
static void vesa_setpalette(int regno, unsigned red, unsigned green, static void vesa_setpalette(int regno, unsigned red, unsigned green,
unsigned blue, struct fb_var_screeninfo *var) unsigned blue)
{ {
#ifdef __i386__ #ifdef __i386__
struct { u_char blue, green, red, pad; } entry; struct { u_char blue, green, red, pad; } entry;
int shift = 16 - var->green.length; int shift = 16 - depth;
if (pmi_setpal) { if (pmi_setpal) {
entry.red = red >> shift; entry.red = red >> shift;
...@@ -135,7 +136,7 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -135,7 +136,7 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
switch (info->var.bits_per_pixel) { switch (info->var.bits_per_pixel) {
case 8: case 8:
vesa_setpalette(regno,red,green,blue, &info->var); vesa_setpalette(regno,red,green,blue);
break; break;
case 16: case 16:
if (info->var.red.offset == 10) { if (info->var.red.offset == 10) {
...@@ -358,6 +359,15 @@ static int __init vesafb_probe(struct device *device) ...@@ -358,6 +359,15 @@ static int __init vesafb_probe(struct device *device)
vesafb_defined.blue.length = screen_info.blue_size; vesafb_defined.blue.length = screen_info.blue_size;
vesafb_defined.transp.offset = screen_info.rsvd_pos; vesafb_defined.transp.offset = screen_info.rsvd_pos;
vesafb_defined.transp.length = screen_info.rsvd_size; vesafb_defined.transp.length = screen_info.rsvd_size;
if (vesafb_defined.bits_per_pixel <= 8) {
depth = vesafb_defined.green.length;
vesafb_defined.red.length =
vesafb_defined.green.length =
vesafb_defined.blue.length =
vesafb_defined.bits_per_pixel;
}
printk(KERN_INFO "vesafb: %s: " printk(KERN_INFO "vesafb: %s: "
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n", "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
(vesafb_defined.bits_per_pixel > 8) ? (vesafb_defined.bits_per_pixel > 8) ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment