Subject: Blanking the screen on a G4 DP
To: None <port-macppc@netbsd.org>
From: Dave Huang <khym@bga.com>
List: port-macppc
Date: 01/06/2001 14:35:25
I didn't want the black on white console text to burn in my monitor, so
I tried to run screenblank, only to find that it didn't work on macppc
(ofb driver doesn't support the ioctls to turn the screen off and on).
So I did a bit of poking around and found some OpenFirmware methods
that'll turn the monitor off and on, at least on my G4 Dual Proc with
Radeon card... I have no idea if they're available on other machines, or
even on the G4 DP with Rage128 card.
However, if anyone's interested, they're named ddc2ci-monitor-off and
ddc2ci-monitor-on. Here's a patch that adds support for 'em to the ofb
driver:
Index: ofb.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/macppc/dev/ofb.c,v
retrieving revision 1.17
diff -u -r1.17 ofb.c
--- ofb.c 2000/11/02 14:25:51 1.17
+++ ofb.c 2001/01/06 20:33:28
@@ -102,6 +102,8 @@
static void ofb_common_init __P((int, struct ofb_devconfig *));
static int ofb_getcmap __P((struct ofb_softc *, struct wsdisplay_cmap *));
static int ofb_putcmap __P((struct ofb_softc *, struct wsdisplay_cmap *));
+static void ofb_blank __P((struct ofb_devconfig *));
+static void ofb_unblank __P((struct ofb_devconfig *));
int
ofbmatch(parent, match, aux)
@@ -322,6 +324,18 @@
case WSDISPLAYIO_PUTCMAP:
return ofb_putcmap(sc, (struct wsdisplay_cmap *)data);
+ case WSDISPLAYIO_SVIDEO:
+ if (*(u_int *)data == WSDISPLAYIO_VIDEO_OFF)
+ ofb_blank(dc);
+ else
+ ofb_unblank(dc);
+ return 0;
+
+ case WSDISPLAYIO_GVIDEO:
+ *(u_int *)data = dc->dc_blanked ?
+ WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON;
+ return 0;
+
/* XXX There are no way to know framebuffer pa from a user program. */
case GRFIOCGINFO:
gm = (void *)data;
@@ -544,4 +558,24 @@
}
return 0;
+}
+
+void
+ofb_blank(dc)
+ struct ofb_devconfig *dc;
+{
+ if (!dc->dc_blanked) {
+ dc->dc_blanked = 1;
+ OF_call_method_1("ddc2ci-monitor-off", dc->dc_ih, 0);
+ }
+}
+
+void
+ofb_unblank(dc)
+ struct ofb_devconfig *dc;
+{
+ if (dc->dc_blanked) {
+ dc->dc_blanked = 0;
+ OF_call_method_1("ddc2ci-monitor-on", dc->dc_ih, 0);
+ }
}
Index: ofbvar.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/macppc/dev/ofbvar.h,v
retrieving revision 1.3
diff -u -r1.3 ofbvar.h
--- ofbvar.h 2000/06/19 19:35:21 1.3
+++ ofbvar.h 2001/01/06 20:27:22
@@ -31,6 +31,7 @@
paddr_t dc_paddr; /* physcal address */
int dc_node; /* phandle of this node */
int dc_ih; /* ihandle of this node */
+ int dc_blanked; /* currently has video disabled */
struct rasops_info dc_ri;
};
--
Name: Dave Huang | Mammal, mammal / their names are called /
INet: khym@bga.com | they raise a paw / the bat, the cat /
FurryMUCK: Dahan | dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 25 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++