public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] vgacon: Workaround for resize bug in some chipsets
@ 2005-11-16 17:58 Jason Dravet
  2005-11-16 23:52 ` Samuel Thibault
  0 siblings, 1 reply; 22+ messages in thread
From: Jason Dravet @ 2005-11-16 17:58 UTC (permalink / raw)
  To: samuel.thibault; +Cc: 7eggert, adaplas, torvalds, akpm, davej, linux-kernel

>From: Samuel Thibault <samuel.thibault@ens-lyon.org>
>To: Jason Dravet <dravet@hotmail.com>
>CC: 7eggert@gmx.de, adaplas@gmail.com, torvalds@osdl.org, 
>akpm@osdl.org,davej@redhat.com, linux-kernel@vger.kernel.org
>Subject: Re: [PATCH] vgacon: Workaround for resize bug in some chipsets
>Date: Wed, 16 Nov 2005 03:25:08 +0100
>
>Hi,
>
>Jason Dravet, le Tue 15 Nov 2005 19:50:39 -0600, a écrit :
> > Here are the results:
> > y=25   fonth=16   deffh=16   vidfh=16   scanl=400
> > overflow=ff
> > vsync_end=8f
> > vdisp_end=1f
>
>Ah, this is odd indeed: your hardware uses 800 scanlines
>(overflow:(512+256)+vdisp_end:0x1f), while the actual needed lines
>should be y:25*fonth:16 ... Maybe it is actually using a 32 lines font.
>
>Just to make sure about every VGA bits, could you install the
>svgatextmode package, which holds a getVGAreg command, and run twice
>
>for i in `seq 0 24` ; do getVGAreg CRTC $i ; done
>
>The first time while having a correct full text screen rendering, and
>the second time after vgacon_doresize() has blanked the bottom half of
>the screen.
>
>Regards,
>Samuel

For some reason my custom 2.6.14 kernels no longer boot.  While I look into 
this here are the results when only half the screen works:

VGA 'CRTC' register, index 0 (=0x0) contains 89 (=0x59 =b01011001)
VGA 'CRTC' register, index 1 (=0x1) contains 79 (=0x4f =b01001111)
VGA 'CRTC' register, index 2 (=0x2) contains 79 (=0x4f =b01001111)
VGA 'CRTC' register, index 3 (=0x3) contains 157 (=0x9d =b10011101)
VGA 'CRTC' register, index 4 (=0x4) contains 84 (=0x54 =b01010100)
VGA 'CRTC' register, index 5 (=0x5) contains 27 (=0x1b =b00011011)
VGA 'CRTC' register, index 6 (=0x6) contains 255 (=0xff =b11111111)
VGA 'CRTC' register, index 7 (=0x7) contains 191 (=0xbf =b10111111)
VGA 'CRTC' register, index 8 (=0x8) contains 0 (=0x00 =b00000000)
VGA 'CRTC' register, index 9 (=0x9) contains 239 (=0xef =b11101111)
VGA 'CRTC' register, index 10 (=0xa) contains 13 (=0x0d =b00001101)
VGA 'CRTC' register, index 11 (=0xb) contains 14 (=0x0e =b00001110)
VGA 'CRTC' register, index 12 (=0xc) contains 40 (=0x28 =b00101000)
VGA 'CRTC' register, index 13 (=0xd) contains 240 (=0xf0 =b11110000)
VGA 'CRTC' register, index 14 (=0xe) contains 42 (=0x2a =b00101010)
VGA 'CRTC' register, index 15 (=0xf) contains 32 (=0x20 =b00100000)
VGA 'CRTC' register, index 16 (=0x10) contains 125 (=0x7d =b01111101)
VGA 'CRTC' register, index 17 (=0x11) contains 143 (=0x8f =b10001111)
VGA 'CRTC' register, index 18 (=0x12) contains 143 (=0x8f =b10001111)
VGA 'CRTC' register, index 19 (=0x13) contains 40 (=0x28 =b00101000)
VGA 'CRTC' register, index 20 (=0x14) contains 31 (=0x1f =b00011111)
VGA 'CRTC' register, index 21 (=0x15) contains 30 (=0x1e =b00011110)
VGA 'CRTC' register, index 22 (=0x16) contains 0 (=0x00 =b00000000)
VGA 'CRTC' register, index 23 (=0x17) contains 163 (=0xa3 =b10100011)
VGA 'CRTC' register, index 24 (=0x18) contains 255 (=0xff =b11111111)

I will send the whole screen results when I find and fix the problem.  I am 
running the fedora core development system with all but todays updates.

Thanks,
Jason



^ permalink raw reply	[flat|nested] 22+ messages in thread
[parent not found: <58DvZ-6en-1@gated-at.bofh.it>]
* Re: [PATCH] vgacon: Workaround for resize bug in some chipsets
@ 2005-11-14  3:46 Jason Dravet
  0 siblings, 0 replies; 22+ messages in thread
From: Jason Dravet @ 2005-11-14  3:46 UTC (permalink / raw)
  To: adaplas, samuel.thibault; +Cc: torvalds, akpm, davej, linux-kernel

>From: "Antonino A. Daplas" <adaplas@gmail.com>
>To: Samuel Thibault <samuel.thibault@ens-lyon.org>
>CC: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,  
>Dave Jones <davej@redhat.com>, Jason <dravet@hotmail.com>,  Linux Kernel 
>Development <linux-kernel@vger.kernel.org>
>Subject: Re: [PATCH] vgacon: Workaround for resize bug in some chipsets
>Date: Mon, 14 Nov 2005 07:37:17 +0800
>
>Samuel Thibault wrote:
> > Antonino A. Daplas, le Sun 13 Nov 2005 22:33:18 +0800, a écrit :
> >> Samuel Thibault wrote:
> >>> Antonino A. Daplas, le Sun 13 Nov 2005 06:20:53 +0800, a écrit :
> >>>> "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 asterik area.
> >>>> ---------------------
> >>>> | ****************  |
> >>>> | *              *  |
> >>>> | *              *  |
> >>>> | ****************  |
> >>>> |                   |
> >>>> |                   |
> >>>> |                   |
> >>>> ---------------------
> >>> Are you missing some left and right part too? What are the dimensions 
>of
> >>> the text screen at bootup? What bootloader are you using? (It could be 
>a
> >>> bug in the boot up text screen dimension discovery).
> >> It was just the height.  All numbers (done with printk's) look okay 
>from
> >> bootup. He gets 80 and 25 for ORIG_VIDEO_NUM_COLS and 
>ORIG_VIDEO_NUM_LINES
> >> respectively.
> >
> > And you got less than 25 lines? How many exactly?
>
>If the original size was at 80x25, and vgacon_doresize() was called, the
>the resulting screen is only 80x12.5. The 13th line has its bottom half
>chopped off, and the rest of the lines (14-25) is invisible.
>
>If he sets it at < 25, he gets a window much smaller than 12.5, but he did
>not specify. So my guess is his chipset programs the screen height by 1/2
>of the value of the requested rows.
>
>Tony

When I run stty rows 20 I get a screen of 80x20.  I can see the top 10 rows 
and the bottom 10 rows are invisible.

Thanks,
Jason Dravet



^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH] vgacon: Workaround for resize bug in some chipsets
@ 2005-11-12 22:20 Antonino A. Daplas
  2005-11-13 10:23 ` Martin Mares
  2005-11-13 11:06 ` Samuel Thibault
  0 siblings, 2 replies; 22+ messages in thread
From: Antonino A. Daplas @ 2005-11-12 22:20 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton
  Cc: Dave Jones, Jason, Samuel Thibault, Linux Kernel Development

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 asterik area.
---------------------
| ****************  |
| *              *  |
| *              *  |
| ****************  |
|                   |
|                   |
|                   |
---------------------

I have a Silicon Graphics 1600sw LCD panel with a Number Nine Revolution 4
video card."

This bug seems to be a glitch in the VGA core of this chipset.  Resizing
the screen triggers the mentioned bug.

The workaround is to make vgacon avoid calling vgacon_doresize() if the
display parameters did not change. It also has a nice side effect of faster
console switches, but that will be barely noticeable.

Note that this bug may be triggered if the user changes the screen height
with stty, or using another font with different dimensions.

A definitive fix will need to be provided by someone who knows and has the
hardware.

This patch also converted hard-coded constants to a named constant
(VGACON_FONTWIDTH).

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---
 vgacon.c |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)


diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 274f905..5ce8348 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -56,6 +56,8 @@
 static DEFINE_SPINLOCK(vga_lock);
 static int cursor_size_lastfrom;
 static int cursor_size_lastto;
+static u32 vgacon_xres;
+static u32 vgacon_yres;
 static struct vgastate state;
 
 #define BLANK 0x0020
@@ -69,7 +71,7 @@ static struct vgastate state;
  * appear.
  */
 #undef TRIDENT_GLITCH
-
+#define VGA_FONTWIDTH       8   /* VGA does not support fontwidths != 8 */
 /*
  *  Interface used by the world
  */
@@ -325,6 +327,10 @@ static const char __init *vgacon_startup
 		vga_scan_lines =
 		    vga_video_font_height * vga_video_num_lines;
 	}
+
+	vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH;
+	vgacon_yres = vga_scan_lines;
+
 	return display_desc;
 }
 
@@ -507,6 +513,8 @@ static int vgacon_doresize(struct vc_dat
 
 	spin_lock_irqsave(&vga_lock, flags);
 
+	vgacon_xres = width * VGA_FONTWIDTH;
+	vgacon_yres = height * c->vc_font.height;
 	outb_p(VGA_CRTC_MODE, vga_video_port_reg);
 	mode = inb_p(vga_video_port_val);
 
@@ -551,6 +559,10 @@ static int vgacon_doresize(struct vc_dat
 
 static int vgacon_switch(struct vc_data *c)
 {
+	int x = c->vc_cols * VGA_FONTWIDTH;
+	int y = c->vc_rows * c->vc_font.height;
+	int rows = ORIG_VIDEO_LINES * vga_default_font_height/
+		c->vc_font.height;
 	/*
 	 * We need to save screen size here as it's the only way
 	 * we can spot the screen has been resized and we need to
@@ -566,10 +578,11 @@ static int vgacon_switch(struct vc_data 
 		scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
 			    c->vc_screenbuf_size > vga_vram_size ?
 				vga_vram_size : c->vc_screenbuf_size);
-		if (!(vga_video_num_columns % 2) &&
-		    vga_video_num_columns <= ORIG_VIDEO_COLS &&
-		    vga_video_num_lines <= (ORIG_VIDEO_LINES *
-			vga_default_font_height) / c->vc_font.height)
+
+		if ((vgacon_xres != x || vgacon_yres != y) &&
+		    (!(vga_video_num_columns % 2) &&
+		     vga_video_num_columns <= ORIG_VIDEO_COLS &&
+		     vga_video_num_lines <= rows))
 			vgacon_doresize(c, c->vc_cols, c->vc_rows);
 	}
 
@@ -992,7 +1005,8 @@ static int vgacon_font_set(struct vc_dat
 	if (vga_video_type < VIDEO_TYPE_EGAM)
 		return -EINVAL;
 
-	if (font->width != 8 || (charcount != 256 && charcount != 512))
+	if (font->width != VGA_FONTWIDTH ||
+	    (charcount != 256 && charcount != 512))
 		return -EINVAL;
 
 	rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512);
@@ -1009,7 +1023,7 @@ static int vgacon_font_get(struct vc_dat
 	if (vga_video_type < VIDEO_TYPE_EGAM)
 		return -EINVAL;
 
-	font->width = 8;
+	font->width = VGA_FONTWIDTH;
 	font->height = c->vc_font.height;
 	font->charcount = vga_512_chars ? 512 : 256;
 	if (!font->data)

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2005-11-17  1:37 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <58c2Z-8jG-23@gated-at.bofh.it>
2005-11-13 19:41 ` [PATCH] vgacon: Workaround for resize bug in some chipsets Bodo Eggert
2005-11-13 22:11   ` Antonino A. Daplas
2005-11-13 22:26     ` Mika Penttilä
2005-11-13 23:35       ` Antonino A. Daplas
2005-11-14  3:32         ` H. Peter Anvin
2005-11-13 22:24   ` Samuel Thibault
2005-11-16 17:58 Jason Dravet
2005-11-16 23:52 ` Samuel Thibault
2005-11-17  1:37   ` Jason Dravet
     [not found] <58DvZ-6en-1@gated-at.bofh.it>
2005-11-14  9:24 ` Bodo Eggert
2005-11-14 15:27   ` Jason Dravet
2005-11-14 16:32     ` Bodo Eggert
2005-11-16  0:05     ` Samuel Thibault
2005-11-16  1:50       ` Jason Dravet
2005-11-16  2:25         ` Samuel Thibault
  -- strict thread matches above, loose matches on Subject: below --
2005-11-14  3:46 Jason Dravet
2005-11-12 22:20 Antonino A. Daplas
2005-11-13 10:23 ` Martin Mares
2005-11-13 11:06 ` Samuel Thibault
2005-11-13 14:33   ` Antonino A. Daplas
2005-11-13 22:25     ` Samuel Thibault
2005-11-13 23:37       ` Antonino A. Daplas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox