[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: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Antonino A. Daplas and committed by Linus Torvalds 49d5c7b0 fe655d3a

+9 -6
+9 -6
drivers/video/cirrusfb.c
··· 404 404 struct cirrusfb_regs currentmode; 405 405 int blank_mode; 406 406 407 - u32 pseudo_palette[17]; 407 + u32 pseudo_palette[16]; 408 408 struct { u8 red, green, blue, pad; } palette[256]; 409 409 410 410 #ifdef CONFIG_ZORRO ··· 1603 1603 1604 1604 switch (info->var.bits_per_pixel) { 1605 1605 case 8: 1606 - ((u8*)(info->pseudo_palette))[regno] = v; 1606 + cinfo->pseudo_palette[regno] = v; 1607 1607 break; 1608 1608 case 16: 1609 - ((u16*)(info->pseudo_palette))[regno] = v; 1609 + cinfo->pseudo_palette[regno] = v; 1610 1610 break; 1611 1611 case 24: 1612 1612 case 32: 1613 - ((u32*)(info->pseudo_palette))[regno] = v; 1613 + cinfo->pseudo_palette[regno] = v; 1614 1614 break; 1615 1615 } 1616 1616 return 0; ··· 2020 2020 const struct fb_fillrect *region) 2021 2021 { 2022 2022 int m; /* bytes per pixel */ 2023 + u32 color = (cinfo->info->fix.visual == FB_VISUAL_TRUECOLOR) ? 2024 + cinfo->pseudo_palette[region->color] : region->color; 2025 + 2023 2026 if(cinfo->info->var.bits_per_pixel == 1) { 2024 2027 cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, 2025 2028 region->dx / 8, region->dy, 2026 2029 region->width / 8, region->height, 2027 - region->color, 2030 + color, 2028 2031 cinfo->currentmode.line_length); 2029 2032 } else { 2030 2033 m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; 2031 2034 cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, 2032 2035 region->dx * m, region->dy, 2033 2036 region->width * m, region->height, 2034 - region->color, 2037 + color, 2035 2038 cinfo->currentmode.line_length); 2036 2039 } 2037 2040 return;