aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbmem.c
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2005-09-09 16:04:37 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:58:00 -0400
commitb8c909454f046b59065c6997b651fe20cd90c0f4 (patch)
tree2a8e03fe69c1b02dc610f57208d693e05b95969c /drivers/video/fbmem.c
parent094bb659f53b6d90aab6067268d6d14f1f352d30 (diff)
[PATCH] fbdev: Fix greater than 1 bit monochrome color handling
Currently, fbcon assumes that the visual FB_VISUAL_MONO* is always 1 bit. According to Geert, there are old hardware where it's possible to have monochrome at 8-bit, but has only 2 colors, black - 0x00 and white - 0xff. Fix color handlers (fb_get_color_depth, and get_color) for this special case. 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/fbmem.c')
-rw-r--r--drivers/video/fbmem.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index a8eee79e117d..a815f5e2fcb5 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -62,16 +62,26 @@ int num_registered_fb;
62 * Helpers 62 * Helpers
63 */ 63 */
64 64
65int fb_get_color_depth(struct fb_var_screeninfo *var) 65int fb_get_color_depth(struct fb_var_screeninfo *var,
66 struct fb_fix_screeninfo *fix)
66{ 67{
67 if (var->green.length == var->blue.length && 68 int depth = 0;
68 var->green.length == var->red.length && 69
69 !var->green.offset && !var->blue.offset && 70 if (fix->visual == FB_VISUAL_MONO01 ||
70 !var->red.offset) 71 fix->visual == FB_VISUAL_MONO10)
71 return var->green.length; 72 depth = 1;
72 else 73 else {
73 return (var->green.length + var->red.length + 74 if (var->green.length == var->blue.length &&
74 var->blue.length); 75 var->green.length == var->red.length &&
76 var->green.offset == var->blue.offset &&
77 var->green.offset == var->red.offset)
78 depth = var->green.length;
79 else
80 depth = var->green.length + var->red.length +
81 var->blue.length;
82 }
83
84 return depth;
75} 85}
76EXPORT_SYMBOL(fb_get_color_depth); 86EXPORT_SYMBOL(fb_get_color_depth);
77 87
@@ -249,13 +259,18 @@ static void fb_set_logo(struct fb_info *info,
249 const struct linux_logo *logo, u8 *dst, 259 const struct linux_logo *logo, u8 *dst,
250 int depth) 260 int depth)
251{ 261{
252 int i, j, k, fg = 1; 262 int i, j, k;
253 const u8 *src = logo->data; 263 const u8 *src = logo->data;
254 u8 d, xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0; 264 u8 xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0;
265 u8 fg = 1, d;
255 266
256 if (fb_get_color_depth(&info->var) == 3) 267 if (fb_get_color_depth(&info->var, &info->fix) == 3)
257 fg = 7; 268 fg = 7;
258 269
270 if (info->fix.visual == FB_VISUAL_MONO01 ||
271 info->fix.visual == FB_VISUAL_MONO10)
272 fg = ~((u8) (0xfff << info->var.green.length));
273
259 switch (depth) { 274 switch (depth) {
260 case 4: 275 case 4:
261 for (i = 0; i < logo->height; i++) 276 for (i = 0; i < logo->height; i++)
@@ -318,7 +333,7 @@ static struct logo_data {
318 333
319int fb_prepare_logo(struct fb_info *info) 334int fb_prepare_logo(struct fb_info *info)
320{ 335{
321 int depth = fb_get_color_depth(&info->var); 336 int depth = fb_get_color_depth(&info->var, &info->fix);
322 337
323 memset(&fb_logo, 0, sizeof(struct logo_data)); 338 memset(&fb_logo, 0, sizeof(struct logo_data));
324 339