Commit 49d5c7b0 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

[PATCH] fbdev: cirrusfb: Driver cleanup and bug fixes

- pseudo_palette is only 16 entries long

- the pseudo_palette, if using the generic drawing functions, must always be
  u32 regardless of bpp

- the fillrect accelerator is using region->color regardless of the visual.
  region->color is the index to the pseudo_palette if visual is truecolor
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 fe655d3a
...@@ -404,7 +404,7 @@ struct cirrusfb_info { ...@@ -404,7 +404,7 @@ struct cirrusfb_info {
struct cirrusfb_regs currentmode; struct cirrusfb_regs currentmode;
int blank_mode; int blank_mode;
u32 pseudo_palette[17]; u32 pseudo_palette[16];
struct { u8 red, green, blue, pad; } palette[256]; struct { u8 red, green, blue, pad; } palette[256];
#ifdef CONFIG_ZORRO #ifdef CONFIG_ZORRO
...@@ -1603,14 +1603,14 @@ static int cirrusfb_setcolreg (unsigned regno, unsigned red, unsigned green, ...@@ -1603,14 +1603,14 @@ static int cirrusfb_setcolreg (unsigned regno, unsigned red, unsigned green,
switch (info->var.bits_per_pixel) { switch (info->var.bits_per_pixel) {
case 8: case 8:
((u8*)(info->pseudo_palette))[regno] = v; cinfo->pseudo_palette[regno] = v;
break; break;
case 16: case 16:
((u16*)(info->pseudo_palette))[regno] = v; cinfo->pseudo_palette[regno] = v;
break; break;
case 24: case 24:
case 32: case 32:
((u32*)(info->pseudo_palette))[regno] = v; cinfo->pseudo_palette[regno] = v;
break; break;
} }
return 0; return 0;
...@@ -2020,18 +2020,21 @@ static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo, ...@@ -2020,18 +2020,21 @@ static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo,
const struct fb_fillrect *region) const struct fb_fillrect *region)
{ {
int m; /* bytes per pixel */ int m; /* bytes per pixel */
u32 color = (cinfo->info->fix.visual == FB_VISUAL_TRUECOLOR) ?
cinfo->pseudo_palette[region->color] : region->color;
if(cinfo->info->var.bits_per_pixel == 1) { if(cinfo->info->var.bits_per_pixel == 1) {
cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel,
region->dx / 8, region->dy, region->dx / 8, region->dy,
region->width / 8, region->height, region->width / 8, region->height,
region->color, color,
cinfo->currentmode.line_length); cinfo->currentmode.line_length);
} else { } else {
m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8;
cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel,
region->dx * m, region->dy, region->dx * m, region->dy,
region->width * m, region->height, region->width * m, region->height,
region->color, color,
cinfo->currentmode.line_length); cinfo->currentmode.line_length);
} }
return; return;
......
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