Subject: kern/15213: add support for wscons/vga screenblank ioctl's
To: None <gnats-bugs@gnats.netbsd.org>
From: Phil Budne <phil@ultimate.com>
List: netbsd-bugs
Date: 01/12/2002 00:51:31
>Number: 15213
>Category: kern
>Synopsis: add support for wscons/vga screenblank ioctl's
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 11 21:52:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Phil Budne
>Release: NetBSD 1.5ZA (cvs co 1/2/2002)
>Organization:
Himself
>Environment:
System: NetBSD pc 1.5ZA NetBSD 1.5ZA (PEECEE) #4: Fri Jan 11 15:39:26 EST 2002 phil@pc:/usr/src/sys/arch/i386/compile/PEECEE i386
Architecture: i386
Machine: i386
>Description:
I don't usually use the console on my NetBSD/i386 system (I
prefer typing on the Sun type 3 attached to my IPX) and I got
tired of watching the pc console turn electricity into heat.
>How-To-Repeat:
reboot system with VGA console, leave console alone, nothing happens.
>Fix:
There must be some reason why this hasn't been done before,
but I couldn't find any mention in the mailing list archives,
or the bug database.
The patch implements the WSDISPLAYIO_[GS]VIDEO ioctl's used
by screenblank. It works for me on my pc, and doesn't appear
to interfere with X. Your mileage may vary. Critical section
protection might be a good idea.
Index: vga.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/vga.c,v
retrieving revision 1.45
diff -c -r1.45 vga.c
*** vga.c 2001/12/13 08:31:39 1.45
--- vga.c 2002/01/12 01:36:57
***************
*** 662,667 ****
--- 662,698 ----
return (0);
}
+ static int
+ vga_get_video(struct vga_config *vc)
+ {
+ return (vga_ts_read(&vc->hdl, mode) & 0x20) == 0;
+ }
+
+ static void
+ vga_set_video(struct vga_config *vc, int state)
+ {
+ int val;
+
+ vga_ts_write(&vc->hdl, syncreset, 0x01);
+ if (state) {
+ val = vga_ts_read(&vc->hdl, mode);
+ vga_ts_write(&vc->hdl, mode, val & 0xDF);
+ #ifndef VGA_NO_VBLANK
+ val = vga_6845_read(&vc->hdl, mode);
+ vga_6845_write(&vc->hdl, mode, val | 0x80);
+ #endif
+ }
+ else {
+ val = vga_ts_read(&vc->hdl, mode);
+ vga_ts_write(&vc->hdl, mode, val | 0x20);
+ #ifndef VGA_NO_VBLANK
+ val = vga_6845_read(&vc->hdl, mode);
+ vga_6845_write(&vc->hdl, mode, val & ~0x80);
+ #endif
+ }
+ vga_ts_write(&vc->hdl, syncreset, 0x03);
+ }
+
int
vga_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
{
***************
*** 677,686 ****
/* XXX should get detailed hardware information here */
return ENOTTY;
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
case WSDISPLAYIO_GVIDEO:
case WSDISPLAYIO_SVIDEO:
case WSDISPLAYIO_GCURPOS:
case WSDISPLAYIO_SCURPOS:
case WSDISPLAYIO_GCURMAX:
--- 708,724 ----
/* XXX should get detailed hardware information here */
return ENOTTY;
case WSDISPLAYIO_GVIDEO:
+ *(int *)data = (vga_get_video(vc) ? WSDISPLAYIO_VIDEO_ON :
+ WSDISPLAYIO_VIDEO_OFF);
+ return 0;
+
case WSDISPLAYIO_SVIDEO:
+ vga_set_video(vc, *(int *)data == WSDISPLAYIO_VIDEO_ON);
+ return 0;
+
+ case WSDISPLAYIO_GETCMAP:
+ case WSDISPLAYIO_PUTCMAP:
case WSDISPLAYIO_GCURPOS:
case WSDISPLAYIO_SCURPOS:
case WSDISPLAYIO_GCURMAX:
--g0C0skw00562.1010796886/pc.ultimate.com--
>Release-Note:
>Audit-Trail:
>Unformatted:
X-send-pr-version: 3.95