diff options
Diffstat (limited to 'drivers/video/console')
-rw-r--r-- | drivers/video/console/Kconfig | 2 | ||||
-rw-r--r-- | drivers/video/console/vgacon.c | 36 |
2 files changed, 29 insertions, 9 deletions
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index a5d09e159cd1..6ee449858a5c 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
@@ -6,7 +6,7 @@ menu "Console display driver support" | |||
6 | 6 | ||
7 | config VGA_CONSOLE | 7 | config VGA_CONSOLE |
8 | bool "VGA text console" if EMBEDDED || !X86 | 8 | bool "VGA text console" if EMBEDDED || !X86 |
9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !ARCH_VERSATILE | 9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE |
10 | default y | 10 | default y |
11 | help | 11 | help |
12 | Saying Y here will allow you to use Linux in text mode through a | 12 | Saying Y here will allow you to use Linux in text mode through a |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 167de397e4b4..12d9329d1408 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -56,6 +56,8 @@ | |||
56 | static DEFINE_SPINLOCK(vga_lock); | 56 | static DEFINE_SPINLOCK(vga_lock); |
57 | static int cursor_size_lastfrom; | 57 | static int cursor_size_lastfrom; |
58 | static int cursor_size_lastto; | 58 | static int cursor_size_lastto; |
59 | static u32 vgacon_xres; | ||
60 | static u32 vgacon_yres; | ||
59 | static struct vgastate state; | 61 | static 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 | ||
@@ -503,10 +509,18 @@ static int vgacon_doresize(struct vc_data *c, | |||
503 | { | 509 | { |
504 | unsigned long flags; | 510 | unsigned long flags; |
505 | unsigned int scanlines = height * c->vc_font.height; | 511 | unsigned int scanlines = height * c->vc_font.height; |
506 | u8 scanlines_lo, r7, vsync_end, mode; | 512 | u8 scanlines_lo, r7, vsync_end, mode, max_scan; |
507 | 513 | ||
508 | spin_lock_irqsave(&vga_lock, flags); | 514 | spin_lock_irqsave(&vga_lock, flags); |
509 | 515 | ||
516 | outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); | ||
517 | max_scan = inb_p(vga_video_port_val); | ||
518 | |||
519 | if (max_scan & 0x80) | ||
520 | scanlines <<= 1; | ||
521 | |||
522 | vgacon_xres = width * VGA_FONTWIDTH; | ||
523 | vgacon_yres = height * c->vc_font.height; | ||
510 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); | 524 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); |
511 | mode = inb_p(vga_video_port_val); | 525 | mode = inb_p(vga_video_port_val); |
512 | 526 | ||
@@ -551,6 +565,10 @@ static int vgacon_doresize(struct vc_data *c, | |||
551 | 565 | ||
552 | static int vgacon_switch(struct vc_data *c) | 566 | static int vgacon_switch(struct vc_data *c) |
553 | { | 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; | ||
554 | /* | 572 | /* |
555 | * 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 |
556 | * 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 |
@@ -566,10 +584,11 @@ static int vgacon_switch(struct vc_data *c) | |||
566 | scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, | 584 | scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, |
567 | c->vc_screenbuf_size > vga_vram_size ? | 585 | c->vc_screenbuf_size > vga_vram_size ? |
568 | vga_vram_size : c->vc_screenbuf_size); | 586 | vga_vram_size : c->vc_screenbuf_size); |
569 | if (!(vga_video_num_columns % 2) && | 587 | |
570 | vga_video_num_columns <= ORIG_VIDEO_COLS && | 588 | if ((vgacon_xres != x || vgacon_yres != y) && |
571 | vga_video_num_lines <= (ORIG_VIDEO_LINES * | 589 | (!(vga_video_num_columns % 2) && |
572 | vga_default_font_height) / c->vc_font.height) | 590 | vga_video_num_columns <= ORIG_VIDEO_COLS && |
591 | vga_video_num_lines <= rows)) | ||
573 | vgacon_doresize(c, c->vc_cols, c->vc_rows); | 592 | vgacon_doresize(c, c->vc_cols, c->vc_rows); |
574 | } | 593 | } |
575 | 594 | ||
@@ -993,7 +1012,8 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigne | |||
993 | if (vga_video_type < VIDEO_TYPE_EGAM) | 1012 | if (vga_video_type < VIDEO_TYPE_EGAM) |
994 | return -EINVAL; | 1013 | return -EINVAL; |
995 | 1014 | ||
996 | if (font->width != 8 || (charcount != 256 && charcount != 512)) | 1015 | if (font->width != VGA_FONTWIDTH || |
1016 | (charcount != 256 && charcount != 512)) | ||
997 | return -EINVAL; | 1017 | return -EINVAL; |
998 | 1018 | ||
999 | rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); | 1019 | rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); |
@@ -1010,7 +1030,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font) | |||
1010 | if (vga_video_type < VIDEO_TYPE_EGAM) | 1030 | if (vga_video_type < VIDEO_TYPE_EGAM) |
1011 | return -EINVAL; | 1031 | return -EINVAL; |
1012 | 1032 | ||
1013 | font->width = 8; | 1033 | font->width = VGA_FONTWIDTH; |
1014 | font->height = c->vc_font.height; | 1034 | font->height = c->vc_font.height; |
1015 | font->charcount = vga_512_chars ? 512 : 256; | 1035 | font->charcount = vga_512_chars ? 512 : 256; |
1016 | if (!font->data) | 1036 | if (!font->data) |