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; ...@@ -38,7 +38,7 @@ static struct tridentfb_par default_par;
/* FIXME:kmalloc these 3 instead */ /* FIXME:kmalloc these 3 instead */
static struct fb_info fb_info; static struct fb_info fb_info;
static int pseudo_pal[16]; static u32 pseudo_pal[16];
static struct fb_var_screeninfo default_var; static struct fb_var_screeninfo default_var;
...@@ -460,7 +460,7 @@ static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect * ...@@ -460,7 +460,7 @@ static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *
default: default:
case 8: col = fr->color; case 8: col = fr->color;
break; break;
case 16: col = ((u16 *)(info->pseudo_palette))[fr->color]; case 16: col = ((u32 *)(info->pseudo_palette))[fr->color];
break; break;
case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; case 32: col = ((u32 *)(info->pseudo_palette))[fr->color];
break; break;
...@@ -990,7 +990,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -990,7 +990,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
} else } else
if (bpp == 16) /* RGB 565 */ 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); ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11);
else else
if (bpp == 32) /* ARGB 8888 */ 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