aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-01-08 04:02:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:13:51 -0500
commit53dbb26dbcf0d844967677633d7587c1d34740d5 (patch)
tree8e0988f3d14758c0f36f1e495f56c79f3f405116 /drivers/video
parent954de9141e75cf2f1ce69ccdbedc83ec827a01ec (diff)
[PATCH] vgacon: Workaround for resize bug in some chipsets
Reported from Redhat Bugzilla Bug 170450 "I updated to the development kernel and now during boot only the top of the text is visable. For example the monitor screen the is the lines and I can only see text in the asterisk area.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console/vgacon.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index f4e1c4b4191e..12d9329d1408 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -56,6 +56,8 @@
56static DEFINE_SPINLOCK(vga_lock); 56static DEFINE_SPINLOCK(vga_lock);
57static int cursor_size_lastfrom; 57static int cursor_size_lastfrom;
58static int cursor_size_lastto; 58static int cursor_size_lastto;
59static u32 vgacon_xres;
60static u32 vgacon_yres;
59static struct vgastate state; 61static struct vgastate state;
60 62
61#define BLANK 0x0020 63#define BLANK 0x0020
@@ -69,7 +71,7 @@ static struct vgastate state;
69 * appear. 71 * appear.
70 */ 72 */
71#undef TRIDENT_GLITCH 73#undef TRIDENT_GLITCH
72 74#define VGA_FONTWIDTH 8 /* VGA does not support fontwidths != 8 */
73/* 75/*
74 * Interface used by the world 76 * Interface used by the world
75 */ 77 */
@@ -325,6 +327,10 @@ static const char __init *vgacon_startup(void)
325 vga_scan_lines = 327 vga_scan_lines =
326 vga_video_font_height * vga_video_num_lines; 328 vga_video_font_height * vga_video_num_lines;
327 } 329 }
330
331 vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH;
332 vgacon_yres = vga_scan_lines;
333
328 return display_desc; 334 return display_desc;
329} 335}
330 336
@@ -513,6 +519,8 @@ static int vgacon_doresize(struct vc_data *c,
513 if (max_scan & 0x80) 519 if (max_scan & 0x80)
514 scanlines <<= 1; 520 scanlines <<= 1;
515 521
522 vgacon_xres = width * VGA_FONTWIDTH;
523 vgacon_yres = height * c->vc_font.height;
516 outb_p(VGA_CRTC_MODE, vga_video_port_reg); 524 outb_p(VGA_CRTC_MODE, vga_video_port_reg);
517 mode = inb_p(vga_video_port_val); 525 mode = inb_p(vga_video_port_val);
518 526
@@ -557,6 +565,10 @@ static int vgacon_doresize(struct vc_data *c,
557 565
558static int vgacon_switch(struct vc_data *c) 566static int vgacon_switch(struct vc_data *c)
559{ 567{
568 int x = c->vc_cols * VGA_FONTWIDTH;
569 int y = c->vc_rows * c->vc_font.height;
570 int rows = ORIG_VIDEO_LINES * vga_default_font_height/
571 c->vc_font.height;
560 /* 572 /*
561 * We need to save screen size here as it's the only way 573 * We need to save screen size here as it's the only way
562 * we can spot the screen has been resized and we need to 574 * we can spot the screen has been resized and we need to
@@ -572,10 +584,11 @@ static int vgacon_switch(struct vc_data *c)
572 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, 584 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
573 c->vc_screenbuf_size > vga_vram_size ? 585 c->vc_screenbuf_size > vga_vram_size ?
574 vga_vram_size : c->vc_screenbuf_size); 586 vga_vram_size : c->vc_screenbuf_size);
575 if (!(vga_video_num_columns % 2) && 587
576 vga_video_num_columns <= ORIG_VIDEO_COLS && 588 if ((vgacon_xres != x || vgacon_yres != y) &&
577 vga_video_num_lines <= (ORIG_VIDEO_LINES * 589 (!(vga_video_num_columns % 2) &&
578 vga_default_font_height) / c->vc_font.height) 590 vga_video_num_columns <= ORIG_VIDEO_COLS &&
591 vga_video_num_lines <= rows))
579 vgacon_doresize(c, c->vc_cols, c->vc_rows); 592 vgacon_doresize(c, c->vc_cols, c->vc_rows);
580 } 593 }
581 594
@@ -999,7 +1012,8 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigne
999 if (vga_video_type < VIDEO_TYPE_EGAM) 1012 if (vga_video_type < VIDEO_TYPE_EGAM)
1000 return -EINVAL; 1013 return -EINVAL;
1001 1014
1002 if (font->width != 8 || (charcount != 256 && charcount != 512)) 1015 if (font->width != VGA_FONTWIDTH ||
1016 (charcount != 256 && charcount != 512))
1003 return -EINVAL; 1017 return -EINVAL;
1004 1018
1005 rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); 1019 rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512);
@@ -1016,7 +1030,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font)
1016 if (vga_video_type < VIDEO_TYPE_EGAM) 1030 if (vga_video_type < VIDEO_TYPE_EGAM)
1017 return -EINVAL; 1031 return -EINVAL;
1018 1032
1019 font->width = 8; 1033 font->width = VGA_FONTWIDTH;
1020 font->height = c->vc_font.height; 1034 font->height = c->vc_font.height;
1021 font->charcount = vga_512_chars ? 512 : 256; 1035 font->charcount = vga_512_chars ? 512 : 256;
1022 if (!font->data) 1036 if (!font->data)