diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-11-06 21:06:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-11-06 21:06:23 +0000 |
commit | 3db638110f445fdee0af026ba42b338baa48ae85 (patch) | |
tree | cdce3c99d6438633abf2f3fb6fda1f5cf804395e /sys/arch | |
parent | 60735805896012b6000a99f7de1678fd7cbfa3b6 (diff) |
- always initialize colormaps, even if the frame buffer is non console; this
helps if the ramdac does not get initialized (idea from jason@)
- only register a shutdown hook for the frame buffers which need it, if this
is the console frame buffer. Otherwise this is just a waste of time.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/dev/bwtwo.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgeight.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgfour.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgfourteen.c | 13 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgsix.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgthree.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgtwelve.c | 7 | ||||
-rw-r--r-- | sys/arch/sparc/dev/cgtwo.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/fb.c | 35 | ||||
-rw-r--r-- | sys/arch/sparc/dev/p9100.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/tcx.c | 8 | ||||
-rw-r--r-- | sys/arch/sparc/dev/vigra.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/include/fbvar.h | 5 |
13 files changed, 63 insertions, 43 deletions
diff --git a/sys/arch/sparc/dev/bwtwo.c b/sys/arch/sparc/dev/bwtwo.c index 8933bba0303..30f1a1331c2 100644 --- a/sys/arch/sparc/dev/bwtwo.c +++ b/sys/arch/sparc/dev/bwtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwtwo.c,v 1.24 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: bwtwo.c,v 1.25 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: bwtwo.c,v 1.33 1997/05/24 20:16:02 pk Exp $ */ /* @@ -319,7 +319,7 @@ obp_name: if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &bwtwo_stdscreen, -1, - NULL, bwtwo_burner); + bwtwo_burner); } #if defined(SUN4C) || defined(SUN4M) diff --git a/sys/arch/sparc/dev/cgeight.c b/sys/arch/sparc/dev/cgeight.c index 3296fb51589..975e71b0db7 100644 --- a/sys/arch/sparc/dev/cgeight.c +++ b/sys/arch/sparc/dev/cgeight.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgeight.c,v 1.16 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: cgeight.c,v 1.17 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: cgeight.c,v 1.13 1997/05/24 20:16:04 pk Exp $ */ /* @@ -244,7 +244,7 @@ cgeightattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &cgeight_stdscreen, -1, - NULL, cgeight_burner); + cgeight_burner); } waa.console = isconsole; diff --git a/sys/arch/sparc/dev/cgfour.c b/sys/arch/sparc/dev/cgfour.c index e38f1947018..4533304c785 100644 --- a/sys/arch/sparc/dev/cgfour.c +++ b/sys/arch/sparc/dev/cgfour.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfour.c,v 1.16 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: cgfour.c,v 1.17 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: cgfour.c,v 1.13 1997/05/24 20:16:06 pk Exp $ */ /* @@ -246,6 +246,7 @@ cgfourattach(parent, self, args) PFOUR_COLOR_OFF_COLOR, round_page(sc->sc_sunfb.sf_fbsize)); sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); + fbwscons_setcolormap(&sc->sc_sunfb, cgfour_setcolor); cgfour_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; cgfour_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows; @@ -256,7 +257,7 @@ cgfourattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &cgfour_stdscreen, -1, - cgfour_setcolor, cgfour_burner); + cgfour_burner); } waa.console = isconsole; diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c index 74c59f8d931..c9ef0b54a85 100644 --- a/sys/arch/sparc/dev/cgfourteen.c +++ b/sys/arch/sparc/dev/cgfourteen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgfourteen.c,v 1.18 2002/10/12 01:09:43 krw Exp $ */ +/* $OpenBSD: cgfourteen.c,v 1.19 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */ /* @@ -245,12 +245,16 @@ cgfourteenattach(parent, self, args) /* * Sanity checks */ - if (ca->ca_ra.ra_len < 0x10000) + if (ca->ca_ra.ra_len < 0x10000) { + printf("\n"); panic("cgfourteen: expected %x bytes of control " "registers, got %x", 0x10000, ca->ca_ra.ra_len); - if (ca->ca_ra.ra_nreg < CG14_NREG) + } + if (ca->ca_ra.ra_nreg < CG14_NREG) { + printf("\n"); panic("cgfourteen: expected %d registers, got %d", CG14_NREG, ca->ca_ra.ra_nreg); + } printf(", %dMB", ca->ca_ra.ra_reg[CG14_REG_VRAM].rr_len >> 20); @@ -337,7 +341,8 @@ cgfourteenattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &cgfourteen_stdscreen, sc->sc_sunfb.sf_depth == 8 ? -1 : 0, - cgfourteen_setcolor, cgfourteen_burner); + cgfourteen_burner); + shutdownhook_establish(cgfourteen_prom, sc); } waa.console = isconsole; diff --git a/sys/arch/sparc/dev/cgsix.c b/sys/arch/sparc/dev/cgsix.c index 667579fa7b4..3269c33aba4 100644 --- a/sys/arch/sparc/dev/cgsix.c +++ b/sys/arch/sparc/dev/cgsix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgsix.c,v 1.21 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: cgsix.c,v 1.22 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: cgsix.c,v 1.33 1997/08/07 19:12:30 pk Exp $ */ /* @@ -346,6 +346,7 @@ cgsixattach(parent, self, args) CGSIX_VID_OFFSET, round_page(sc->sc_sunfb.sf_fbsize)); sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); + fbwscons_setcolormap(&sc->sc_sunfb, cgsix_setcolor); /* * Old rev. cg6 cards do not like the current acceleration code. @@ -372,7 +373,7 @@ cgsixattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &cgsix_stdscreen, -1, - cgsix_setcolor, cgsix_burner); + cgsix_burner); } #if defined(SUN4C) || defined(SUN4M) diff --git a/sys/arch/sparc/dev/cgthree.c b/sys/arch/sparc/dev/cgthree.c index 345565140e5..67fbd046ca1 100644 --- a/sys/arch/sparc/dev/cgthree.c +++ b/sys/arch/sparc/dev/cgthree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgthree.c,v 1.17 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: cgthree.c,v 1.18 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: cgthree.c,v 1.33 1997/05/24 20:16:11 pk Exp $ */ /* @@ -319,6 +319,7 @@ cgthreeattach(parent, self, args) round_page(sc->sc_sunfb.sf_fbsize)); sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); + fbwscons_setcolormap(&sc->sc_sunfb, cgthree_setcolor); cgthree_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; cgthree_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows; @@ -329,7 +330,7 @@ cgthreeattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &cgthree_stdscreen, -1, - cgthree_setcolor, cgthree_burner); + cgthree_burner); } #if defined(SUN4C) || defined(SUN4M) if (sbus) diff --git a/sys/arch/sparc/dev/cgtwelve.c b/sys/arch/sparc/dev/cgtwelve.c index a2e29bbc8bc..af9a07e53fd 100644 --- a/sys/arch/sparc/dev/cgtwelve.c +++ b/sys/arch/sparc/dev/cgtwelve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwelve.c,v 1.4 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: cgtwelve.c,v 1.5 2002/11/06 21:06:20 miod Exp $ */ /* * Copyright (c) 2002 Miodrag Vallat. All rights reserved. @@ -260,15 +260,16 @@ cgtwelveattach(parent, self, args) if (isconsole) { if (sc->sc_sunfb.sf_depth == 1) { fbwscons_console_init(&sc->sc_sunfb, - &cgtwelve_stdscreen, -1, NULL, NULL); + &cgtwelve_stdscreen, -1, NULL); } else { /* * Since the screen has been cleared, restart at the * top of the screen. */ fbwscons_console_init(&sc->sc_sunfb, - &cgtwelve_stdscreen, 0, NULL, cgtwelve_burner); + &cgtwelve_stdscreen, 0, cgtwelve_burner); } + shutdownhook_establish(cgtwelve_prom, sc); } sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev); diff --git a/sys/arch/sparc/dev/cgtwo.c b/sys/arch/sparc/dev/cgtwo.c index 7d891956c48..044b903b44e 100644 --- a/sys/arch/sparc/dev/cgtwo.c +++ b/sys/arch/sparc/dev/cgtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwo.c,v 1.24 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: cgtwo.c,v 1.25 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: cgtwo.c,v 1.22 1997/05/24 20:16:12 pk Exp $ */ /* @@ -264,6 +264,7 @@ cgtwoattach(parent, self, args) round_page(sc->sc_sunfb.sf_fbsize)); sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); + fbwscons_setcolormap(&sc->sc_sunfb, cgtwo_setcolor); cgtwo_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; cgtwo_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows; @@ -274,7 +275,7 @@ cgtwoattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &cgtwo_stdscreen, -1, - cgtwo_setcolor, cgtwo_burner); + cgtwo_burner); } waa.console = isconsole; diff --git a/sys/arch/sparc/dev/fb.c b/sys/arch/sparc/dev/fb.c index ccc6da4839a..e9d8b05315c 100644 --- a/sys/arch/sparc/dev/fb.c +++ b/sys/arch/sparc/dev/fb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fb.c,v 1.21 2002/09/05 09:31:20 miod Exp $ */ +/* $OpenBSD: fb.c,v 1.22 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: fb.c,v 1.23 1997/07/07 23:30:22 pk Exp $ */ /* @@ -350,11 +350,10 @@ fbwscons_init(sf, isconsole) } void -fbwscons_console_init(sf, wsc, row, setcolor, burner) +fbwscons_console_init(sf, wsc, row, burner) struct sunfb *sf; struct wsscreen_descr *wsc; int row; - void (*setcolor)(void *, u_int, u_int8_t, u_int8_t, u_int8_t); void (*burner)(void *, u_int, u_int); { long defattr; @@ -387,17 +386,7 @@ fbwscons_console_init(sf, wsc, row, setcolor, burner) * Select appropriate color settings to mimic a * black on white Sun console. */ - if (sf->sf_depth == 8 && setcolor != NULL) { - setcolor(sf, WSCOL_BLACK, 0, 0, 0); - setcolor(sf, 255, 0, 0, 0); - setcolor(sf, WSCOL_RED, 255, 0, 0); - setcolor(sf, WSCOL_GREEN, 0, 255, 0); - setcolor(sf, WSCOL_BROWN, 154, 85, 46); - setcolor(sf, WSCOL_BLUE, 0, 0, 255); - setcolor(sf, WSCOL_MAGENTA, 255, 255, 0); - setcolor(sf, WSCOL_CYAN, 0, 255, 255); - setcolor(sf, WSCOL_WHITE, 255, 255, 255); - } else if (sf->sf_depth > 8) { + if (sf->sf_depth > 8) { wscol_white = 0; wscol_black = 255; wskernel_bg = 0; @@ -420,6 +409,24 @@ fbwscons_console_init(sf, wsc, row, setcolor, burner) fb_cookie = sf; } +void +fbwscons_setcolormap(sf, setcolor) + struct sunfb *sf; + void (*setcolor)(void *, u_int, u_int8_t, u_int8_t, u_int8_t); +{ + if (sf->sf_depth <= 8 && setcolor != NULL) { + setcolor(sf, WSCOL_BLACK, 0, 0, 0); + setcolor(sf, 255, 0, 0, 0); + setcolor(sf, WSCOL_RED, 255, 0, 0); + setcolor(sf, WSCOL_GREEN, 0, 255, 0); + setcolor(sf, WSCOL_BROWN, 154, 85, 46); + setcolor(sf, WSCOL_BLUE, 0, 0, 255); + setcolor(sf, WSCOL_MAGENTA, 255, 255, 0); + setcolor(sf, WSCOL_CYAN, 0, 255, 255); + setcolor(sf, WSCOL_WHITE, 255, 255, 255); + } +} + #if defined(SUN4) /* * Support routines for pfour framebuffers. diff --git a/sys/arch/sparc/dev/p9100.c b/sys/arch/sparc/dev/p9100.c index b1141c00ef9..b7b43b7453c 100644 --- a/sys/arch/sparc/dev/p9100.c +++ b/sys/arch/sparc/dev/p9100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p9100.c,v 1.10 2002/09/23 18:13:38 miod Exp $ */ +/* $OpenBSD: p9100.c,v 1.11 2002/11/06 21:06:20 miod Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -284,6 +284,7 @@ p9100attach(parent, self, args) round_page(sc->sc_sunfb.sf_fbsize)); sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, isconsole); + fbwscons_setcolormap(&sc->sc_sunfb, p9100_setcolor); p9100_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; p9100_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows; @@ -309,7 +310,7 @@ p9100attach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &p9100_stdscreen, -1, - p9100_setcolor, p9100_burner); + p9100_burner); } waa.console = isconsole; diff --git a/sys/arch/sparc/dev/tcx.c b/sys/arch/sparc/dev/tcx.c index bcf34bfbc12..023ef6b1825 100644 --- a/sys/arch/sparc/dev/tcx.c +++ b/sys/arch/sparc/dev/tcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcx.c,v 1.13 2002/10/12 01:09:43 krw Exp $ */ +/* $OpenBSD: tcx.c,v 1.14 2002/11/06 21:06:20 miod Exp $ */ /* $NetBSD: tcx.c,v 1.8 1997/07/29 09:58:14 fair Exp $ */ /* @@ -291,14 +291,14 @@ tcxattach(parent, self, args) if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, &tcx_stdscreen, -1, - tcx_setcolor, tcx_burner); + tcx_burner); + shutdownhook_establish(tcx_prom, sc); } sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev); - printf("%s: %dx%d, depth %d, id %d, rev %d, sense %d\n", + printf("%s: %dx%d, id %d, rev %d, sense %d\n", self->dv_xname, sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height, - sc->sc_sunfb.sf_depth, (sc->sc_thc->thc_config & THC_CFG_FBID) >> THC_CFG_FBID_SHIFT, (sc->sc_thc->thc_config & THC_CFG_REV) >> THC_CFG_REV_SHIFT, (sc->sc_thc->thc_config & THC_CFG_SENSE) >> THC_CFG_SENSE_SHIFT diff --git a/sys/arch/sparc/dev/vigra.c b/sys/arch/sparc/dev/vigra.c index 631e98eaa64..822113aee22 100644 --- a/sys/arch/sparc/dev/vigra.c +++ b/sys/arch/sparc/dev/vigra.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vigra.c,v 1.4 2002/10/12 01:09:43 krw Exp $ */ +/* $OpenBSD: vigra.c,v 1.5 2002/11/06 21:06:20 miod Exp $ */ /* * Copyright (c) 2002 Miodrag Vallat. All rights reserved. @@ -243,6 +243,7 @@ vigraattach(parent, self, args) */ fbwscons_init(&sc->sc_sunfb, isconsole && (sc->sc_sunfb.sf_width != 800)); + fbwscons_setcolormap(&sc->sc_sunfb, vigra_setcolor); vigra_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; vigra_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows; @@ -263,7 +264,7 @@ vigraattach(parent, self, args) } fbwscons_console_init(&sc->sc_sunfb, &vigra_stdscreen, row, - vigra_setcolor, vigra_burner); + vigra_burner); } sbus_establish(&sc->sc_sd, &sc->sc_sunfb.sf_dev); diff --git a/sys/arch/sparc/include/fbvar.h b/sys/arch/sparc/include/fbvar.h index 27d0b9f3eb1..178cbc5836b 100644 --- a/sys/arch/sparc/include/fbvar.h +++ b/sys/arch/sparc/include/fbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fbvar.h,v 1.7 2002/09/20 11:17:56 fgsch Exp $ */ +/* $OpenBSD: fbvar.h,v 1.8 2002/11/06 21:06:22 miod Exp $ */ /* $NetBSD: fbvar.h,v 1.9 1997/07/07 23:31:30 pk Exp $ */ /* @@ -82,8 +82,9 @@ extern int fbnode; void fb_setsize(struct sunfb*, int, int, int, int, int); void fbwscons_init(struct sunfb *, int); void fbwscons_console_init(struct sunfb *, struct wsscreen_descr *, int, - void (*)(void *, u_int, u_int8_t, u_int8_t, u_int8_t), void (*)(void *, u_int, u_int)); +void fbwscons_setcolormap(struct sunfb *, + void (*)(void *, u_int, u_int8_t, u_int8_t, u_int8_t)); #if defined(SUN4) int fb_pfour_id(void *); |