aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-02-07 21:13:43 -0500
committerDave Airlie <airlied@redhat.com>2013-02-07 21:13:43 -0500
commit62cd2fa82a38cb3d653517822c62a39cdbb5f365 (patch)
treeb5d2f198c14455822c8b03abde2c8d8080cda24a /drivers/video
parent6dc1c49da6dd3bf020a66b2a135b9625ac01c2c7 (diff)
parentae1287865f5361fa138d4d3b1b6277908b54eac9 (diff)
Merge branch 'console-fixes' into drm-next
(not the fbcon maintainer pull 2) fix bug in vgacon on bootup and fbcon losing fonts on startup. * console-fixes: (50 commits) fbcon: don't lose the console font across generic->chip driver switch vgacon/vt: clear buffer attributes when we load a 512 character font (v2)
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console/fbcon.c14
-rw-r--r--drivers/video/console/vgacon.c22
2 files changed, 25 insertions, 11 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 2e2d959acae6..501c599e7549 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -1017,7 +1017,7 @@ static const char *fbcon_startup(void)
1017 } 1017 }
1018 1018
1019 /* Setup default font */ 1019 /* Setup default font */
1020 if (!p->fontdata) { 1020 if (!p->fontdata && !vc->vc_font.data) {
1021 if (!fontname[0] || !(font = find_font(fontname))) 1021 if (!fontname[0] || !(font = find_font(fontname)))
1022 font = get_default_font(info->var.xres, 1022 font = get_default_font(info->var.xres,
1023 info->var.yres, 1023 info->var.yres,
@@ -1027,6 +1027,8 @@ static const char *fbcon_startup(void)
1027 vc->vc_font.height = font->height; 1027 vc->vc_font.height = font->height;
1028 vc->vc_font.data = (void *)(p->fontdata = font->data); 1028 vc->vc_font.data = (void *)(p->fontdata = font->data);
1029 vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */ 1029 vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */
1030 } else {
1031 p->fontdata = vc->vc_font.data;
1030 } 1032 }
1031 1033
1032 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); 1034 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
@@ -1186,9 +1188,9 @@ static void fbcon_init(struct vc_data *vc, int init)
1186 ops->p = &fb_display[fg_console]; 1188 ops->p = &fb_display[fg_console];
1187} 1189}
1188 1190
1189static void fbcon_free_font(struct display *p) 1191static void fbcon_free_font(struct display *p, bool freefont)
1190{ 1192{
1191 if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) 1193 if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
1192 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int)); 1194 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int));
1193 p->fontdata = NULL; 1195 p->fontdata = NULL;
1194 p->userfont = 0; 1196 p->userfont = 0;
@@ -1200,8 +1202,8 @@ static void fbcon_deinit(struct vc_data *vc)
1200 struct fb_info *info; 1202 struct fb_info *info;
1201 struct fbcon_ops *ops; 1203 struct fbcon_ops *ops;
1202 int idx; 1204 int idx;
1205 bool free_font = true;
1203 1206
1204 fbcon_free_font(p);
1205 idx = con2fb_map[vc->vc_num]; 1207 idx = con2fb_map[vc->vc_num];
1206 1208
1207 if (idx == -1) 1209 if (idx == -1)
@@ -1212,6 +1214,8 @@ static void fbcon_deinit(struct vc_data *vc)
1212 if (!info) 1214 if (!info)
1213 goto finished; 1215 goto finished;
1214 1216
1217 if (info->flags & FBINFO_MISC_FIRMWARE)
1218 free_font = false;
1215 ops = info->fbcon_par; 1219 ops = info->fbcon_par;
1216 1220
1217 if (!ops) 1221 if (!ops)
@@ -1223,6 +1227,8 @@ static void fbcon_deinit(struct vc_data *vc)
1223 ops->flags &= ~FBCON_FLAGS_INIT; 1227 ops->flags &= ~FBCON_FLAGS_INIT;
1224finished: 1228finished:
1225 1229
1230 fbcon_free_font(p, free_font);
1231
1226 if (!con_is_bound(&fb_con)) 1232 if (!con_is_bound(&fb_con))
1227 fbcon_exit(); 1233 fbcon_exit();
1228 1234
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index d449a74d4a31..5855d17d19ac 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -1064,7 +1064,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
1064 unsigned short video_port_status = vga_video_port_reg + 6; 1064 unsigned short video_port_status = vga_video_port_reg + 6;
1065 int font_select = 0x00, beg, i; 1065 int font_select = 0x00, beg, i;
1066 char *charmap; 1066 char *charmap;
1067 1067 bool clear_attribs = false;
1068 if (vga_video_type != VIDEO_TYPE_EGAM) { 1068 if (vga_video_type != VIDEO_TYPE_EGAM) {
1069 charmap = (char *) VGA_MAP_MEM(colourmap, 0); 1069 charmap = (char *) VGA_MAP_MEM(colourmap, 0);
1070 beg = 0x0e; 1070 beg = 0x0e;
@@ -1169,12 +1169,6 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
1169 1169
1170 /* if 512 char mode is already enabled don't re-enable it. */ 1170 /* if 512 char mode is already enabled don't re-enable it. */
1171 if ((set) && (ch512 != vga_512_chars)) { 1171 if ((set) && (ch512 != vga_512_chars)) {
1172 /* attribute controller */
1173 for (i = 0; i < MAX_NR_CONSOLES; i++) {
1174 struct vc_data *c = vc_cons[i].d;
1175 if (c && c->vc_sw == &vga_con)
1176 c->vc_hi_font_mask = ch512 ? 0x0800 : 0;
1177 }
1178 vga_512_chars = ch512; 1172 vga_512_chars = ch512;
1179 /* 256-char: enable intensity bit 1173 /* 256-char: enable intensity bit
1180 512-char: disable intensity bit */ 1174 512-char: disable intensity bit */
@@ -1185,8 +1179,22 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
1185 it means, but it works, and it appears necessary */ 1179 it means, but it works, and it appears necessary */
1186 inb_p(video_port_status); 1180 inb_p(video_port_status);
1187 vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0); 1181 vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0);
1182 clear_attribs = true;
1188 } 1183 }
1189 raw_spin_unlock_irq(&vga_lock); 1184 raw_spin_unlock_irq(&vga_lock);
1185
1186 if (clear_attribs) {
1187 for (i = 0; i < MAX_NR_CONSOLES; i++) {
1188 struct vc_data *c = vc_cons[i].d;
1189 if (c && c->vc_sw == &vga_con) {
1190 /* force hi font mask to 0, so we always clear
1191 the bit on either transition */
1192 c->vc_hi_font_mask = 0x00;
1193 clear_buffer_attributes(c);
1194 c->vc_hi_font_mask = ch512 ? 0x0800 : 0;
1195 }
1196 }
1197 }
1190 return 0; 1198 return 0;
1191} 1199}
1192 1200