kern/64114: [PATCH] bad vertical refresh for console using Radeon 9200 VIVO

Eugene Grosbein eugen at grosbein.pp.ru
Thu Mar 11 11:20:15 PST 2004


>Number:         64114
>Category:       kern
>Synopsis:       [PATCH] bad vertical refresh for console using Radeon 9200 VIVO
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 11 11:20:14 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Grosbein
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Svyaz Service JSC
>Environment:
System:     FreeBSD grosbein.pp.ru 4.9-STABLE FreeBSD 4.9-STABLE #6: Fri Mar 12 01:17:55 KRAT 2004 eu at grosbein.pp.ru:/tmp/obj/usr/local/src/sys/DADV i386
Video card: ATI Radeon 9200 VIVO connected to Samsung SyncMaster 510s and TV set.

>Description:

	When ATI Radeon 9200 VIVO discovers at boot time that it is connected
	to a TV set, it switches initial settings for both of monitor and TV
	to 50Hz and decrease a number of scan lines for a monitor too.

	Verbose boot shows that vga(4) at stage 2 (see How-To-Repeat)
	detects similar settings for initial values and BIOS supplied
	(see probe_adapters()/comp_adpregs() in src/sys/dev/fb/vga.c)
	and uses ones supplied by BIOS.

	At stage 3 there are large differences between that pair of
	settings and vga(4) warns:

vga0: vga: WARNING: video mode switching is not fully supported on this adapter

	It throws away old good 70Hz mode supplied by BIOS and stays with
	that horrible 50Hz initial mode.

>How-To-Repeat:
	
	1. Get ATI Radeon 9200 VIVO.
	2. Do not connect it to the TV, connect to the monitor and boot.
	   You will get familiar 70Hz text mode.
	3. Shut down the system, attach TV to the video output and boot.
	   You will observe 50Hz of vertical frequency from the BIOS POST
	   stage to FreeBSD multiuser mode and later. And no standard way
	   to change this (not to mention X Window).
	
	However, Windows 98SE will run DOS Box/fullscreen using standard
	70Hz mode with this hardware.

>Fix:

	The solution is to make it possible to force usage of BIOS values.

	The following patch (for 4.9-STABLE) introduces new kernel option
	VGA_PREFER_BIOSMODE. Patched man page vga(4) says:

This option changes default behaviour of the driver when the settings
of the initial video mode differ from BIOS setting for that mode greatly.
By default the driver will ignore BIOS settings. The option forces
it to ignore initial settings and use ones supplied by BIOS.
Try this option if you experience very low refresh rate using
standard video console.

	Please adjust language as needed, my English is obviosly poor, sorry.

--- sys/conf/options.i386.orig	Sat Mar  6 14:33:55 2004
+++ sys/conf/options.i386	Fri Mar 12 00:48:44 2004
@@ -101,6 +101,7 @@
 VGA_NO_MODE_CHANGE	opt_vga.h
 VGA_SLOW_IOACCESS	opt_vga.h
 VGA_WIDTH90		opt_vga.h
+VGA_PREFER_BIOSMODE	opt_vga.h
 
 VESA			opt_vesa.h
 VESA_DEBUG		opt_vesa.h
--- sys/i386/conf/LINT.orig	Sat Mar  6 14:34:13 2004
+++ sys/i386/conf/LINT	Fri Mar 12 00:54:21 2004
@@ -1141,6 +1141,11 @@
 # The following option probably won't work with the LCD displays.
 options 	VGA_WIDTH90		# support 90 column modes
 
+# Try the following option if an initial video mode does not satisfy you.
+# The vga driver will prefer BIOS mode settings that are better for some
+# VIVO cards (f.e. ATI Radeon)
+options		VGA_PREFER_BIOSMODE
+
 # To include support for VESA video modes
 options 	VESA
 
--- sys/dev/fb/vga.c.orig	Thu Mar 11 23:31:38 2004
+++ sys/dev/fb/vga.c	Fri Mar 12 01:26:28 2004
@@ -1105,6 +1105,13 @@
 		    rows_offset = adpstate.regs[1] + 1 - mp[1];
 		    break;
 
+#ifdef VGA_PREFER_BIOSMODE
+		case COMP_DIFFERENT: /* one may prefer BIOS register values */
+		default:
+		    bcopy(adpstate2.regs, adpstate.regs, sizeof(adpstate.regs));
+		    /* FALL THROUGH */
+#endif
+
 		case COMP_SIMILAR:
 		    /*
 		     * Not exactly the same, but similar enough to be
@@ -1117,6 +1124,7 @@
 		    adpstate.regs[1] -= rows_offset - 1;
 		    break;
 
+#ifndef VGA_PREFER_BIOSMODE 
 		case COMP_DIFFERENT:
 		default:
 		    /*
@@ -1130,6 +1138,7 @@
 		    mode_map[adp->va_initial_mode] = adpstate.regs;
 		    rows_offset = 1;
 		    break;
+#endif
 		}
 	    }
 #endif /* VGA_NO_BIOS || VGA_NO_MODE_CHANGE */
@@ -1379,6 +1388,11 @@
 		return ENXIO;
 	adp->va_flags |= V_ADP_REGISTERED;
     }
+
+#ifdef VGA_PREFER_BIOSMODE
+    vga_set_mode(adp, adp->va_initial_mode);
+#endif
+
     if (vga_sub_configure != NULL)
 	(*vga_sub_configure)(0);
 
--- share/man/man4/vga.4.orig	Fri Mar 12 01:37:08 2004
+++ share/man/man4/vga.4	Fri Mar 12 01:48:52 2004
@@ -38,6 +38,7 @@
 .Cd "options VGA_ALT_SEQACCESS"
 .Cd "options VGA_NO_FONT_LOADING"
 .Cd "options VGA_NO_MODE_CHANGE"
+.Cd "options VGA_PREFER_BIOSMODE"
 .Cd "options VGA_SLOW_IOACCESS"
 .Cd "options VGA_WIDTH90"
 .Cd "device vga0 at isa? port ?
@@ -82,6 +83,13 @@
 You may want to try this option if the mouse pointer is not drawn correctly
 or the font does not seem to be loaded properly on the VGA card.
 However, it may cause flicker on some systems.
+.It Dv VGA_PREFER_BIOSMODE
+This option changes default behaviour of the driver when the settings
+of the initial video mode differ from BIOS setting for that mode greatly.
+By default the driver will ignore BIOS settings. The option forces
+it to ignore initial settings and use ones supplied by BIOS.
+Try this option if you experience very low refresh rate using
+standard video console.
 .It Dv VGA_SLOW_IOACCESS
 Older VGA cards may require this option for proper operation.
 It makes the driver perform byte-wide I/O to VGA registers and
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list