aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console/fbcon.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/console/fbcon.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/console/fbcon.c')
-rw-r--r--drivers/video/console/fbcon.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 751890a5f5f3..88bd8ef56fde 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -214,7 +214,7 @@ static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
214static inline int get_color(struct vc_data *vc, struct fb_info *info, 214static inline int get_color(struct vc_data *vc, struct fb_info *info,
215 u16 c, int is_fg) 215 u16 c, int is_fg)
216{ 216{
217 int depth = fb_get_color_depth(&info->var); 217 int depth = fb_get_color_depth(&info->var, &info->fix);
218 int color = 0; 218 int color = 0;
219 219
220 if (console_blanked) { 220 if (console_blanked) {
@@ -230,9 +230,13 @@ static inline int get_color(struct vc_data *vc, struct fb_info *info,
230 switch (depth) { 230 switch (depth) {
231 case 1: 231 case 1:
232 { 232 {
233 int col = ~(0xfff << (max(info->var.green.length,
234 max(info->var.red.length,
235 info->var.blue.length)))) & 0xff;
236
233 /* 0 or 1 */ 237 /* 0 or 1 */
234 int fg = (info->fix.visual != FB_VISUAL_MONO01) ? 1 : 0; 238 int fg = (info->fix.visual != FB_VISUAL_MONO01) ? col : 0;
235 int bg = (info->fix.visual != FB_VISUAL_MONO01) ? 0 : 1; 239 int bg = (info->fix.visual != FB_VISUAL_MONO01) ? 0 : col;
236 240
237 if (console_blanked) 241 if (console_blanked)
238 fg = bg; 242 fg = bg;
@@ -246,7 +250,6 @@ static inline int get_color(struct vc_data *vc, struct fb_info *info,
246 * is grayscale. 250 * is grayscale.
247 */ 251 */
248 color /= 4; 252 color /= 4;
249 break;
250 case 3: 253 case 3:
251 /* 254 /*
252 * Last 8 entries of default 16-color palette is a more intense 255 * Last 8 entries of default 16-color palette is a more intense
@@ -426,7 +429,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
426 * remove underline attribute from erase character 429 * remove underline attribute from erase character
427 * if black and white framebuffer. 430 * if black and white framebuffer.
428 */ 431 */
429 if (fb_get_color_depth(&info->var) == 1) 432 if (fb_get_color_depth(&info->var, &info->fix) == 1)
430 erase &= ~0x400; 433 erase &= ~0x400;
431 logo_height = fb_prepare_logo(info); 434 logo_height = fb_prepare_logo(info);
432 logo_lines = (logo_height + vc->vc_font.height - 1) / 435 logo_lines = (logo_height + vc->vc_font.height - 1) /
@@ -930,7 +933,7 @@ static void fbcon_init(struct vc_data *vc, int init)
930 } 933 }
931 if (p->userfont) 934 if (p->userfont)
932 charcnt = FNTCHARCNT(p->fontdata); 935 charcnt = FNTCHARCNT(p->fontdata);
933 vc->vc_can_do_color = (fb_get_color_depth(&info->var) != 1); 936 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
934 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; 937 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
935 if (charcnt == 256) { 938 if (charcnt == 256) {
936 vc->vc_hi_font_mask = 0; 939 vc->vc_hi_font_mask = 0;
@@ -1178,7 +1181,12 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
1178 if (p->userfont) 1181 if (p->userfont)
1179 charcnt = FNTCHARCNT(p->fontdata); 1182 charcnt = FNTCHARCNT(p->fontdata);
1180 1183
1181 vc->vc_can_do_color = (fb_get_color_depth(var) != 1); 1184 var->activate = FB_ACTIVATE_NOW;
1185 info->var.activate = var->activate;
1186 info->var.yoffset = info->var.xoffset = 0;
1187 fb_set_var(info, var);
1188
1189 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
1182 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; 1190 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
1183 if (charcnt == 256) { 1191 if (charcnt == 256) {
1184 vc->vc_hi_font_mask = 0; 1192 vc->vc_hi_font_mask = 0;
@@ -1967,7 +1975,7 @@ static int fbcon_switch(struct vc_data *vc)
1967 set_blitting_type(vc, info, p); 1975 set_blitting_type(vc, info, p);
1968 ((struct fbcon_ops *)info->fbcon_par)->cursor_reset = 1; 1976 ((struct fbcon_ops *)info->fbcon_par)->cursor_reset = 1;
1969 1977
1970 vc->vc_can_do_color = (fb_get_color_depth(&info->var) != 1); 1978 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1);
1971 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; 1979 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
1972 updatescrollmode(p, info, vc); 1980 updatescrollmode(p, info, vc);
1973 1981
@@ -2332,7 +2340,7 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
2332 if (!CON_IS_VISIBLE(vc)) 2340 if (!CON_IS_VISIBLE(vc))
2333 return 0; 2341 return 0;
2334 2342
2335 depth = fb_get_color_depth(&info->var); 2343 depth = fb_get_color_depth(&info->var, &info->fix);
2336 if (depth > 3) { 2344 if (depth > 3) {
2337 for (i = j = 0; i < 16; i++) { 2345 for (i = j = 0; i < 16; i++) {
2338 k = table[i]; 2346 k = table[i];