diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2005-11-29 22:34:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-29 22:47:04 -0500 |
commit | 49d5c7b08713c3a482d62b5a0ad41b4ec32905a5 (patch) | |
tree | 8437a91b94c03979832a8511ce95f542e06be1d7 /drivers/video/cirrusfb.c | |
parent | fe655d3a06488c8a188461bca493e9f23fc8c448 (diff) |
[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>
Diffstat (limited to 'drivers/video/cirrusfb.c')
-rw-r--r-- | drivers/video/cirrusfb.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index 2858c5c8ba3c..e0dbdfc0c8b4 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -404,7 +404,7 @@ struct cirrusfb_info { | |||
404 | struct cirrusfb_regs currentmode; | 404 | struct cirrusfb_regs currentmode; |
405 | int blank_mode; | 405 | int blank_mode; |
406 | 406 | ||
407 | u32 pseudo_palette[17]; | 407 | u32 pseudo_palette[16]; |
408 | struct { u8 red, green, blue, pad; } palette[256]; | 408 | struct { u8 red, green, blue, pad; } palette[256]; |
409 | 409 | ||
410 | #ifdef CONFIG_ZORRO | 410 | #ifdef CONFIG_ZORRO |
@@ -1603,14 +1603,14 @@ static int cirrusfb_setcolreg (unsigned regno, unsigned red, unsigned green, | |||
1603 | 1603 | ||
1604 | switch (info->var.bits_per_pixel) { | 1604 | switch (info->var.bits_per_pixel) { |
1605 | case 8: | 1605 | case 8: |
1606 | ((u8*)(info->pseudo_palette))[regno] = v; | 1606 | cinfo->pseudo_palette[regno] = v; |
1607 | break; | 1607 | break; |
1608 | case 16: | 1608 | case 16: |
1609 | ((u16*)(info->pseudo_palette))[regno] = v; | 1609 | cinfo->pseudo_palette[regno] = v; |
1610 | break; | 1610 | break; |
1611 | case 24: | 1611 | case 24: |
1612 | case 32: | 1612 | case 32: |
1613 | ((u32*)(info->pseudo_palette))[regno] = v; | 1613 | cinfo->pseudo_palette[regno] = v; |
1614 | break; | 1614 | break; |
1615 | } | 1615 | } |
1616 | return 0; | 1616 | return 0; |
@@ -2020,18 +2020,21 @@ static void cirrusfb_prim_fillrect(struct cirrusfb_info *cinfo, | |||
2020 | const struct fb_fillrect *region) | 2020 | const struct fb_fillrect *region) |
2021 | { | 2021 | { |
2022 | int m; /* bytes per pixel */ | 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 | if(cinfo->info->var.bits_per_pixel == 1) { | 2026 | if(cinfo->info->var.bits_per_pixel == 1) { |
2024 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, | 2027 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, |
2025 | region->dx / 8, region->dy, | 2028 | region->dx / 8, region->dy, |
2026 | region->width / 8, region->height, | 2029 | region->width / 8, region->height, |
2027 | region->color, | 2030 | color, |
2028 | cinfo->currentmode.line_length); | 2031 | cinfo->currentmode.line_length); |
2029 | } else { | 2032 | } else { |
2030 | m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; | 2033 | m = ( cinfo->info->var.bits_per_pixel + 7 ) / 8; |
2031 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, | 2034 | cirrusfb_RectFill(cinfo->regbase, cinfo->info->var.bits_per_pixel, |
2032 | region->dx * m, region->dy, | 2035 | region->dx * m, region->dy, |
2033 | region->width * m, region->height, | 2036 | region->width * m, region->height, |
2034 | region->color, | 2037 | color, |
2035 | cinfo->currentmode.line_length); | 2038 | cinfo->currentmode.line_length); |
2036 | } | 2039 | } |
2037 | return; | 2040 | return; |