Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Dec 2002 19:19:05 -0800 (PST)
From:      Avleen Vig <lists-freebsd@silverwraith.com>
To:        freebsd-current@freebsd.org
Subject:   Patch to sys/i386/isa/vesa.c (Need check before submit pls)
Message-ID:  <20021219190515.X216-100000@guava.silverwraith.com>

next in thread | raw e-mail | index | archive | help
This is the first patch I've ever submitted.
In fact, I can't even take credit for it - some body submitted it to a
newsgroup last year. But I think it should be integrated into the vesa.c
code.
If anyone has time to read over it, I'd appreciate any suggestions, an
help with the one question below.
Tested on FreeBSD 4.7-STABLE (as of a week or so ago). I would have used a
-CURRENT box but I don't have one any more :-/ Sorry if this causes
problems.

The code is designed to set the default refresh rate for the console to
100Hz, when you set the resolution with vidcontrol to VESA_800x600.
It first flips to 1024x768, and saves some registers, then flips back to
800x600 and applies those to get the 100Hz.

I'm wanting to request this patch be included into FreeBSD, because I've
started using FreeBSD on a daily basis in console-only mode, and at
resolutions about the default 600x400 that is run a 70Hz, the refresh rate
drops to 60Hz which hurts the eyes for a while.
As you have to compile SC_PIXEL_MODE into the kernel, and do 'vidcontrol
VESA_800x600' for this to work, we're not changing any defaults that will
effect everyone.
I would really have loved it if the default driver or vidcontrol could let
you set whatever refresh rate you want, but I have no idea why they do
not. to me it seems like an obvious extension of what is present.

The question is: Does anyone know how this code can be changed to set the
refresh rate to something a little saner like 85Hz, which is a good
standard that most recent made in the last 5 years can support?

Finally, the code diff:


--- src,orig/sys/i386/isa/vesa.c	Sat Jan 29 18:08:40 2000
+++ src/sys/i386/isa/vesa.c	Thu Mar 16 11:44:31 2000
@@ -1019,7 +1016,25 @@
 	if (!(info.vi_flags & V_INFO_GRAPHICS))
 		info.vi_flags &= ~V_INFO_LINEAR;

-	if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0)))
+	if (mode == M_VESA_800x600) { /* XXX ignores V_INFO_LINEAR */
+	  unsigned char	crtc[0x19];
+	  unsigned char	reg;
+	  if (vesa_bios_set_mode(mode))
+	    return 1;
+	  for (reg=0;reg<0x19;++reg) {
+	    outb(0x3d4,reg);
+	    crtc[reg]=inb(0x3d5);
+	  }
+	  if (!vesa_bios_set_mode(M_VESA_1024x768)) {
+	    outb(0x3d4,0x11);
+	    outb(0x3d5,crtc[0x11]&0x7f);
+	    for (reg=0;reg<0x19;++reg) {
+	      outb(0x3d4,reg);
+	      outb(0x3d5,crtc[reg]);
+	    }
+	  }
+	} else
+	  if (vesa_bios_set_mode(mode | ((info.vi_flags & V_INFO_LINEAR) ? 0x4000 : 0)))
 		return 1;

 	if (adp->va_info.vi_flags & V_INFO_LINEAR)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021219190515.X216-100000>