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

[PATCH] fbdev: fix wrong colors at 16 bpp in tridentfb

Timothy Lee reports:

Hardware: CyberBlade/i1 on VIA Epia-800

Problem Description:  When the framebuffer is set to 16 bpp, console's text
colours are incorrect.  For example, white becomes yellow, black becomes blue, etc.

Steps to reproduce:
1. Load tridentfb
2. Use "setterm -n -depth 16" to request 16 bpp framebuffer

The problem arose from the fact that each psuedo palette entry should be
32-bit in size, even under 16-bit display mode.
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 b148c74d
......@@ -38,7 +38,7 @@ static struct tridentfb_par default_par;
/* FIXME:kmalloc these 3 instead */
static struct fb_info fb_info;
static int pseudo_pal[16];
static u32 pseudo_pal[16];
static struct fb_var_screeninfo default_var;
......@@ -460,7 +460,7 @@ static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *
default:
case 8: col = fr->color;
break;
case 16: col = ((u16 *)(info->pseudo_palette))[fr->color];
case 16: col = ((u32 *)(info->pseudo_palette))[fr->color];
break;
case 32: col = ((u32 *)(info->pseudo_palette))[fr->color];
break;
......@@ -990,7 +990,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
} else
if (bpp == 16) /* RGB 565 */
((u16*)info->pseudo_palette)[regno] = (red & 0xF800) |
((u32*)info->pseudo_palette)[regno] = (red & 0xF800) |
((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11);
else
if (bpp == 32) /* ARGB 8888 */
......
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