Commit 7fa82794 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbcon unimap fix

fbcon doesn't set a unimap at boot time, so special characters come out
wrongly.

This is the code sequence in take_over_console().

newcon->startup()
oldcon->deinit()
newcon->init()

The previous console driver (ie, vgacon), via its deinit method, may release
the unimap allocated by fbcon in fbcon_startup. This is the reason why
calling con_set_default_unimap() in fbcon_init() works, but not in
fbcon_startup().


Check if the default display has an allocated unimap, and if it has none,
call con_set_default_unimap().  And if the target display has no allocated
unimap, then call con_copy_unimap(), where the source unimap is from the
default display.
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 b05647a7
...@@ -740,7 +740,6 @@ static const char *fbcon_startup(void) ...@@ -740,7 +740,6 @@ static const char *fbcon_startup(void)
DPRINTK("res: %dx%d-%d\n", info->var.xres, DPRINTK("res: %dx%d-%d\n", info->var.xres,
info->var.yres, info->var.yres,
info->var.bits_per_pixel); info->var.bits_per_pixel);
con_set_default_unimap(vc->vc_num);
#ifdef CONFIG_ATARI #ifdef CONFIG_ATARI
if (MACH_IS_ATARI) { if (MACH_IS_ATARI) {
...@@ -820,6 +819,7 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -820,6 +819,7 @@ static void fbcon_init(struct vc_data *vc, int init)
{ {
struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]]; struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
struct vc_data **default_mode = vc->vc_display_fg; struct vc_data **default_mode = vc->vc_display_fg;
struct vc_data *svc = *default_mode;
struct display *t, *p = &fb_display[vc->vc_num]; struct display *t, *p = &fb_display[vc->vc_num];
int display_fg = (*default_mode)->vc_num; int display_fg = (*default_mode)->vc_num;
int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
...@@ -846,7 +846,6 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -846,7 +846,6 @@ static void fbcon_init(struct vc_data *vc, int init)
p->userfont = t->userfont; p->userfont = t->userfont;
if (p->userfont) if (p->userfont)
REFCOUNT(p->fontdata)++; REFCOUNT(p->fontdata)++;
con_copy_unimap(vc->vc_num, display_fg);
} }
if (p->userfont) if (p->userfont)
charcnt = FNTCHARCNT(p->fontdata); charcnt = FNTCHARCNT(p->fontdata);
...@@ -860,6 +859,11 @@ static void fbcon_init(struct vc_data *vc, int init) ...@@ -860,6 +859,11 @@ static void fbcon_init(struct vc_data *vc, int init)
vc->vc_complement_mask <<= 1; vc->vc_complement_mask <<= 1;
} }
if (!*svc->vc_uni_pagedir_loc)
con_set_default_unimap(display_fg);
if (!*vc->vc_uni_pagedir_loc)
con_copy_unimap(vc->vc_num, display_fg);
cols = vc->vc_cols; cols = vc->vc_cols;
rows = vc->vc_rows; rows = vc->vc_rows;
new_cols = info->var.xres / vc->vc_font.width; new_cols = info->var.xres / vc->vc_font.width;
...@@ -1072,6 +1076,7 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc) ...@@ -1072,6 +1076,7 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc)
{ {
struct display *p = &fb_display[vc->vc_num], *t; struct display *p = &fb_display[vc->vc_num], *t;
struct vc_data **default_mode = vc->vc_display_fg; struct vc_data **default_mode = vc->vc_display_fg;
struct vc_data *svc = *default_mode;
int display_fg = (*default_mode)->vc_num; int display_fg = (*default_mode)->vc_num;
int rows, cols, charcnt = 256; int rows, cols, charcnt = 256;
...@@ -1086,7 +1091,6 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc) ...@@ -1086,7 +1091,6 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc)
p->userfont = t->userfont; p->userfont = t->userfont;
if (p->userfont) if (p->userfont)
REFCOUNT(p->fontdata)++; REFCOUNT(p->fontdata)++;
con_copy_unimap(vc->vc_num, display_fg);
} }
if (p->userfont) if (p->userfont)
charcnt = FNTCHARCNT(p->fontdata); charcnt = FNTCHARCNT(p->fontdata);
...@@ -1100,6 +1104,12 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc) ...@@ -1100,6 +1104,12 @@ static void fbcon_set_disp(struct fb_info *info, struct vc_data *vc)
if (vc->vc_can_do_color) if (vc->vc_can_do_color)
vc->vc_complement_mask <<= 1; vc->vc_complement_mask <<= 1;
} }
if (!*svc->vc_uni_pagedir_loc)
con_set_default_unimap(display_fg);
if (!*vc->vc_uni_pagedir_loc)
con_copy_unimap(vc->vc_num, display_fg);
cols = info->var.xres / vc->vc_font.width; cols = info->var.xres / vc->vc_font.width;
rows = info->var.yres / vc->vc_font.height; rows = info->var.yres / vc->vc_font.height;
vc_resize(vc->vc_num, cols, rows); vc_resize(vc->vc_num, cols, rows);
......
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