From 073ea490348952e1152028e8d95966914d863f41 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 27 Dec 2008 17:23:04 +0000 Subject: Sync the sparc64 fb* api with the recent changes done on sparc. --- sys/arch/sparc64/dev/creator.c | 63 ++----------- sys/arch/sparc64/dev/fb.c | 195 +++++++++++++++++++++++++++++++++++---- sys/arch/sparc64/dev/ifb.c | 58 ++---------- sys/arch/sparc64/dev/vgafb.c | 64 ++----------- sys/arch/sparc64/include/fbvar.h | 5 +- sys/dev/sbus/agten.c | 61 ++---------- sys/dev/sbus/bwtwo.c | 64 ++----------- sys/dev/sbus/cgsix.c | 61 +++--------- sys/dev/sbus/cgthree.c | 74 ++------------- sys/dev/sbus/cgtwelve.c | 48 +--------- sys/dev/sbus/mgx.c | 57 ++---------- sys/dev/sbus/rfx.c | 51 ++-------- sys/dev/sbus/tvtwo.c | 59 ++---------- sys/dev/sbus/vigra.c | 84 ++--------------- sys/dev/sbus/zx.c | 47 +--------- 15 files changed, 278 insertions(+), 713 deletions(-) (limited to 'sys') diff --git a/sys/arch/sparc64/dev/creator.c b/sys/arch/sparc64/dev/creator.c index c9de9719a8a..be6ea44fba4 100644 --- a/sys/arch/sparc64/dev/creator.c +++ b/sys/arch/sparc64/dev/creator.c @@ -1,4 +1,4 @@ -/* $OpenBSD: creator.c,v 1.39 2007/03/06 23:10:26 kettenis Exp $ */ +/* $OpenBSD: creator.c,v 1.40 2008/12/27 17:23:01 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -49,11 +49,6 @@ int creator_match(struct device *, void *, void *); void creator_attach(struct device *, struct device *, void *); int creator_ioctl(void *, u_long, caddr_t, int, struct proc *); -int creator_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void creator_free_screen(void *, void *); -int creator_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t creator_mmap(void *, off_t, int); void creator_ras_fifo_wait(struct creator_softc *, int); void creator_ras_wait(struct creator_softc *); @@ -70,10 +65,10 @@ void creator_curs_enable(struct creator_softc *, u_int); struct wsdisplay_accessops creator_accessops = { creator_ioctl, creator_mmap, - creator_alloc_screen, - creator_free_screen, - creator_show_screen, - NULL, /* load font */ + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ + NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ NULL, /* burner */ @@ -187,7 +182,7 @@ creator_attach(parent, self, aux) sc->sc_sunfb.sf_ro.ri_bits = (void *)bus_space_vaddr(sc->sc_bt, sc->sc_pixel_h); sc->sc_sunfb.sf_ro.ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, sc->sc_console ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, sc->sc_console); if ((sc->sc_sunfb.sf_dev.dv_cfdata->cf_flags & CREATOR_CFFLAG_NOACCEL) == 0) { @@ -197,9 +192,8 @@ creator_attach(parent, self, aux) creator_ras_init(sc); } - if (sc->sc_console) { + if (sc->sc_console) fbwscons_console_init(&sc->sc_sunfb, -1); - } fbwscons_attach(&sc->sc_sunfb, &creator_accessops, sc->sc_console); return; @@ -432,49 +426,6 @@ creator_updatecursor(struct creator_softc *sc, u_int which) return (0); } -int -creator_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct creator_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -creator_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct creator_softc *sc = v; - - sc->sc_nscreens--; -} - -int -creator_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - const struct creator_mappings { bus_addr_t uoff; bus_addr_t poff; diff --git a/sys/arch/sparc64/dev/fb.c b/sys/arch/sparc64/dev/fb.c index bb2db23a871..11fd1bd2b2b 100644 --- a/sys/arch/sparc64/dev/fb.c +++ b/sys/arch/sparc64/dev/fb.c @@ -1,8 +1,8 @@ -/* $OpenBSD: fb.c,v 1.17 2007/11/10 15:17:16 jsing Exp $ */ +/* $OpenBSD: fb.c,v 1.18 2008/12/27 17:23:01 miod Exp $ */ /* $NetBSD: fb.c,v 1.23 1997/07/07 23:30:22 pk Exp $ */ /* - * Copyright (c) 2002, 2004 Miodrag Vallat. + * Copyright (c) 2002, 2004, 2008 Miodrag Vallat. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,6 +78,7 @@ #include #include +#include #include #include @@ -112,8 +113,15 @@ fb_unblank() #if NWSDISPLAY > 0 static int a2int(char *, int); -static void fb_initwsd(struct sunfb *); -static void fb_updatecursor(struct rasops_info *); +int fb_get_console_metrics(int *, int *, int *, int *); +void fb_initwsd(struct sunfb *); +void fb_updatecursor(struct rasops_info *); + +int fb_alloc_screen(void *, const struct wsscreen_descr *, void **, + int *, int *, long *); +void fb_free_screen(void *, void *); +int fb_show_screen(void *, void *, int, void (*)(void *, int, int), + void *); void fb_setsize(struct sunfb *sf, int def_depth, int def_width, int def_height, @@ -128,15 +136,15 @@ fb_setsize(struct sunfb *sf, int def_depth, int def_width, int def_height, def_linebytes = roundup(sf->sf_width, sf->sf_depth) * sf->sf_depth / 8; sf->sf_linebytes = getpropint(node, "linebytes", def_linebytes); + /* * XXX If we are configuring a board in a wider depth level * than the mode it is currently operating in, the PROM will * return a linebytes property tied to the current depth value, * which is NOT what we are relying upon! */ - if (sf->sf_linebytes < (sf->sf_width * sf->sf_depth) / 8) { + if (sf->sf_linebytes < (sf->sf_width * sf->sf_depth) / 8) sf->sf_linebytes = def_linebytes; - } sf->sf_fbsize = sf->sf_height * sf->sf_linebytes; } @@ -154,7 +162,7 @@ a2int(char *cp, int deflt) } /* setup the embedded wsscreen_descr structure from rasops settings */ -static void +void fb_initwsd(struct sunfb *sf) { strlcpy(sf->sf_wsd.name, "std", sizeof(sf->sf_wsd.name)); @@ -164,7 +172,7 @@ fb_initwsd(struct sunfb *sf) sf->sf_wsd.textops = &sf->sf_ro.ri_ops; } -static void +void fb_updatecursor(struct rasops_info *ri) { struct sunfb *sf = (struct sunfb *)ri->ri_hw; @@ -176,13 +184,13 @@ fb_updatecursor(struct rasops_info *ri) } void -fbwscons_init(struct sunfb *sf, int flags) +fbwscons_init(struct sunfb *sf, int flags, int isconsole) { struct rasops_info *ri = &sf->sf_ro; - int cols, rows; + int cols, rows, fw, fh, wt, wl; /* ri_hw and ri_bits must have already been setup by caller */ - ri->ri_flg = RI_CENTER | RI_FULLCLEAR | flags; + ri->ri_flg = RI_FULLCLEAR | flags; ri->ri_depth = sf->sf_depth; ri->ri_stride = sf->sf_linebytes; ri->ri_width = sf->sf_width; @@ -191,8 +199,78 @@ fbwscons_init(struct sunfb *sf, int flags) rows = a2int(getpropstring(optionsnode, "screen-#rows"), 34); cols = a2int(getpropstring(optionsnode, "screen-#columns"), 80); + /* + * If the framebuffer width is under 960 pixels, rasops will + * switch from the 12x22 font to the more adequate 8x16 font + * here. + * If we are the console device, we need to adjust two things: + * - the display row should be overrided from the current PROM + * metrics, since it will not match the PROM reality anymore. + * - the screen needs to be cleared. + * + * However, to accomodate laptops with specific small fonts, + * it is necessary to compare the resolution with the actual + * font metrics. + */ + + if (isconsole) { + if (fb_get_console_metrics(&fw, &fh, &wt, &wl) != 0) { + /* + * Assume a 12x22 prom font and a centered + * 80x34 console window. + */ + fw = 12; fh = 22; + ri->ri_flg |= RI_CENTER; + + /* + * Since the console window might not be + * centered (e.g. on a 1280x1024 vigra + * VS-12 frame buffer), have rasops + * clear the margins even if the screen is + * not cleared. + */ + ri->ri_flg |= RI_CLEARMARGINS; + } + + if (ri->ri_wsfcookie != 0) { + /* driver handles font issues. do nothing. */ + } else { + /* + * If the PROM uses a different font than the + * one we are expecting it to use, or if the + * display is shorter than 960 pixels wide, + * we'll force a screen clear. + */ + if (fw != 12 || sf->sf_width < 12 * 80) + ri->ri_flg |= RI_CLEAR | RI_CENTER; + } + } else { + ri->ri_flg |= RI_CLEAR | RI_CENTER; + } + + /* ifb(4) doesn't set ri_bits at the moment */ + if (ri->ri_bits == NULL) + ri->ri_flg &= ~RI_CLEAR; + rasops_init(ri, rows, cols); + /* + * If this is the console display and there is no font change, + * adjust our terminal window to the position of the PROM + * window - in case it is not exactly centered. + */ + if ((ri->ri_flg & RI_CENTER) == 0) { + /* code above made sure wt and wl are initialized */ + ri->ri_bits += wt * ri->ri_stride; + if (ri->ri_depth >= 8) /* for 15bpp to compute ok */ + ri->ri_bits += wl * ri->ri_pelbytes; + else + ri->ri_bits += (wl * ri->ri_depth) >> 3; + + ri->ri_xorigin = wl; + ri->ri_yorigin = wt; + } + if (sf->sf_depth == 8) { /* * If we are running with an indexed palette, compensate @@ -221,21 +299,26 @@ fbwscons_console_init(struct sunfb *sf, int row) if (sf->sf_ccolp != NULL) ri->ri_ccol = *sf->sf_ccolp; - if (row < 0) { - if (sf->sf_crowp != NULL) - ri->ri_crow = *sf->sf_crowp; - else - /* assume last row */ - ri->ri_crow = ri->ri_rows - 1; - } else { + if (ri->ri_flg & RI_CLEAR) { /* - * If we force the display row, this is because the screen - * has been cleared or the font has been changed. + * If we have cleared the screen, this is because either + * we are not the console display, or the font has been + * changed. * In this case, choose not to keep pointers to the PROM * cursor position, as the values are likely to be inaccurate * upon shutdown... */ sf->sf_crowp = sf->sf_ccolp = NULL; + row = 0; + } + + if (row < 0) /* no override */ { + if (sf->sf_crowp != NULL) + ri->ri_crow = *sf->sf_crowp; + else + /* assume last row */ + ri->ri_crow = ri->ri_rows - 1; + } else { ri->ri_crow = row; } @@ -308,6 +391,13 @@ fbwscons_attach(struct sunfb *sf, struct wsdisplay_accessops *op, int isconsole) fb_cookie = sf; } + /* plug common wsdisplay_accessops if necessary */ + if (op->alloc_screen == NULL) { + op->alloc_screen = fb_alloc_screen; + op->free_screen = fb_free_screen; + op->show_screen = fb_show_screen; + } + sf->sf_scrlist[0] = &sf->sf_wsd; sf->sf_wsl.nscreens = 1; sf->sf_wsl.screens = (const struct wsscreen_descr **)sf->sf_scrlist; @@ -320,4 +410,69 @@ fbwscons_attach(struct sunfb *sf, struct wsdisplay_accessops *op, int isconsole) config_found(&sf->sf_dev, &waa, wsemuldisplaydevprint); } +/* + * Common wsdisplay_accessops routines. + */ +int +fb_alloc_screen(void *v, const struct wsscreen_descr *type, + void **cookiep, int *curxp, int *curyp, long *attrp) +{ + struct sunfb *sf = v; + struct rasops_info *ri = &sf->sf_ro; + + if (sf->sf_nscreens > 0) + return (ENOMEM); + + *cookiep = ri; + *curyp = 0; + *curxp = 0; + if (ISSET(ri->ri_caps, WSSCREEN_WSCOLORS)) + ri->ri_ops.alloc_attr(ri, + WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); + else + ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp); + sf->sf_nscreens++; + return (0); +} + +void +fb_free_screen(void *v, void *cookie) +{ + struct sunfb *sf = v; + + sf->sf_nscreens--; +} + +int +fb_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), + void *cbarg) +{ + return (0); +} + +int +fb_get_console_metrics(int *fontwidth, int *fontheight, int *wtop, int *wleft) +{ + cell_t romheight, romwidth, windowtop, windowleft; + + /* + * Get the PROM font metrics and address + */ + OF_interpret("stdout @ is my-self " + "addr char-height addr char-width " + "addr window-top addr window-left", + 4, &windowleft, &windowtop, &romwidth, &romheight); + + if (romheight == NULL || romwidth == NULL || + windowtop == NULL || windowleft == NULL) + return (1); + + *fontwidth = (int)*(uint64_t *)romwidth; + *fontheight = (int)*(uint64_t *)romheight; + *wtop = (int)*(uint64_t *)windowtop; + *wleft = (int)*(uint64_t *)windowleft; + + return (0); +} + #endif /* NWSDISPLAY */ diff --git a/sys/arch/sparc64/dev/ifb.c b/sys/arch/sparc64/dev/ifb.c index 9cc81b0ff53..bdd42275a80 100644 --- a/sys/arch/sparc64/dev/ifb.c +++ b/sys/arch/sparc64/dev/ifb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifb.c,v 1.3 2008/12/27 14:33:55 kettenis Exp $ */ +/* $OpenBSD: ifb.c,v 1.4 2008/12/27 17:23:01 miod Exp $ */ /* * Copyright (c) 2007, 2008 Miodrag Vallat. @@ -210,23 +210,19 @@ struct ifb_softc { int ifb_ioctl(void *, u_long, caddr_t, int, struct proc *); paddr_t ifb_mmap(void *, off_t, int); -int ifb_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void ifb_free_screen(void *, void *); -int ifb_show_screen(void *, void *, int, - void (*cb)(void *, int, int), void *); void ifb_burner(void *, u_int, u_int); struct wsdisplay_accessops ifb_accessops = { ifb_ioctl, ifb_mmap, - ifb_alloc_screen, - ifb_free_screen, - ifb_show_screen, - NULL, - NULL, - NULL, - ifb_burner + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ + NULL, /* load_font */ + NULL, /* scrollback */ + NULL, /* getchar */ + ifb_burner, + NULL /* pollc */ }; int ifbmatch(struct device *, void *, void *); @@ -328,8 +324,7 @@ ifbattach(struct device *parent, struct device *self, void *aux) ri->ri_bits = NULL; ri->ri_hw = sc; - /* do NOT pass RI_CLEAR yet */ - fbwscons_init(&sc->sc_sunfb, RI_BSWAP); + fbwscons_init(&sc->sc_sunfb, RI_BSWAP, sc->sc_console); ri->ri_flg &= ~RI_FULLCLEAR; /* due to the way we handle updates */ if (!sc->sc_console) { @@ -483,39 +478,6 @@ ifb_setcolor(void *v, u_int index, u_int8_t r, u_int8_t g, u_int8_t b) (((u_int)b) << 22) | (((u_int)g) << 12) | (((u_int)r) << 2)); } -int -ifb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct ifb_softc *sc = v; - - if (sc->sc_nscreens > 0) - return ENOMEM; - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return 0; -} - -void -ifb_free_screen(void *v, void *cookie) -{ - struct ifb_softc *sc = v; - - sc->sc_nscreens--; -} - -int -ifb_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return 0; -} - paddr_t ifb_mmap(void *v, off_t off, int prot) { diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c index d0fd962141b..c6943f76d04 100644 --- a/sys/arch/sparc64/dev/vgafb.c +++ b/sys/arch/sparc64/dev/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.54 2008/10/01 21:06:42 kettenis Exp $ */ +/* $OpenBSD: vgafb.c,v 1.55 2008/12/27 17:23:01 miod Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -76,11 +76,6 @@ struct vgafb_softc { int vgafb_mapregs(struct vgafb_softc *, struct pci_attach_args *); int vgafb_rommap(struct vgafb_softc *, struct pci_attach_args *); int vgafb_ioctl(void *, u_long, caddr_t, int, struct proc *); -int vgafb_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void vgafb_free_screen(void *, void *); -int vgafb_show_screen(void *, void *, int, - void (*cb)(void *, int, int), void *); paddr_t vgafb_mmap(void *, off_t, int); int vgafb_is_console(int); int vgafb_getcmap(struct vgafb_softc *, struct wsdisplay_cmap *); @@ -90,10 +85,14 @@ void vgafb_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops vgafb_accessops = { vgafb_ioctl, vgafb_mmap, - vgafb_alloc_screen, - vgafb_free_screen, - vgafb_show_screen, - 0 /* load_font */ + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ + NULL, /* load_font */ + NULL, /* scrollback */ + NULL, /* getchar */ + NULL, /* burner */ + NULL /* pollc */ }; int vgafbmatch(struct device *, void *, void *); @@ -197,7 +196,7 @@ vgafbattach(parent, self, aux) sc->sc_sunfb.sf_ro.ri_hw = sc; fbwscons_init(&sc->sc_sunfb, - RI_BSWAP | (sc->sc_console ? 0 : RI_FORCEMONO | RI_CLEAR)); + RI_BSWAP | (sc->sc_console ? 0 : RI_FORCEMONO), sc->sc_console); if (sc->sc_console) { sc->sc_ofhandle = OF_stdout(); @@ -348,49 +347,6 @@ vgafb_setcolor(v, index, r, g, b) OF_call_method("color!", sc->sc_ofhandle, 4, 0, r, g, b, index); } -int -vgafb_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct vgafb_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -vgafb_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct vgafb_softc *sc = v; - - sc->sc_nscreens--; -} - -int -vgafb_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - paddr_t vgafb_mmap(v, off, prot) void *v; diff --git a/sys/arch/sparc64/include/fbvar.h b/sys/arch/sparc64/include/fbvar.h index 59a1aeb38bd..aadb7339ac3 100644 --- a/sys/arch/sparc64/include/fbvar.h +++ b/sys/arch/sparc64/include/fbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fbvar.h,v 1.6 2006/03/12 22:53:02 miod Exp $ */ +/* $OpenBSD: fbvar.h,v 1.7 2008/12/27 17:23:03 miod Exp $ */ /* $NetBSD: fbvar.h,v 1.9 1997/07/07 23:31:30 pk Exp $ */ /* @@ -62,6 +62,7 @@ struct sunfb { struct wsscreen_descr sf_wsd; struct wsscreen_list sf_wsl; struct wsscreen_descr *sf_scrlist[1]; + int sf_nscreens; }; /* @@ -70,7 +71,7 @@ struct sunfb { extern int fbnode; void fb_setsize(struct sunfb*, int, int, int, int, int); -void fbwscons_init(struct sunfb *, int); +void fbwscons_init(struct sunfb *, int, int); void fbwscons_console_init(struct sunfb *, int); void fbwscons_setcolormap(struct sunfb *, void (*)(void *, u_int, u_int8_t, u_int8_t, u_int8_t)); diff --git a/sys/dev/sbus/agten.c b/sys/dev/sbus/agten.c index 7ba6f51851c..3757f7c14b0 100644 --- a/sys/dev/sbus/agten.c +++ b/sys/dev/sbus/agten.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agten.c,v 1.8 2008/12/25 23:56:31 miod Exp $ */ +/* $OpenBSD: agten.c,v 1.9 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2002, 2003, Miodrag Vallat. * All rights reserved. @@ -105,11 +105,6 @@ struct agten_softc { }; int agten_ioctl(void *, u_long, caddr_t, int, struct proc *); -int agten_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void agten_free_screen(void *, void *); -int agten_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t agten_mmap(void *, off_t, int); void agten_reset(struct agten_softc *); void agten_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); @@ -122,9 +117,9 @@ void agten_loadcmap(struct agten_softc *, u_int, u_int); struct wsdisplay_accessops agten_accessops = { agten_ioctl, agten_mmap, - agten_alloc_screen, - agten_free_screen, - agten_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -223,12 +218,11 @@ agtenattach(struct device *parent, struct device *self, void *args) sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_i128_fb; sc->sc_sunfb.sf_ro.ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, isconsole); fbwscons_setcolormap(&sc->sc_sunfb, agten_setcolor); - if (isconsole) { + if (isconsole) fbwscons_console_init(&sc->sc_sunfb, -1); - } fbwscons_attach(&sc->sc_sunfb, &agten_accessops, isconsole); } @@ -334,49 +328,6 @@ agten_setcolor(v, index, r, g, b) agten_loadcmap(sc, index, 1); } -int -agten_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct agten_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -agten_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct agten_softc *sc = v; - - sc->sc_nscreens--; -} - -int -agten_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - int agten_getcmap(struct agten_cmap *cm, struct wsdisplay_cmap *rcm) { diff --git a/sys/dev/sbus/bwtwo.c b/sys/dev/sbus/bwtwo.c index f8055cb6600..425f67baba4 100644 --- a/sys/dev/sbus/bwtwo.c +++ b/sys/dev/sbus/bwtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwtwo.c,v 1.17 2006/12/17 22:18:16 miod Exp $ */ +/* $OpenBSD: bwtwo.c,v 1.18 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -104,11 +104,6 @@ struct bwtwo_softc { }; int bwtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); -int bwtwo_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void bwtwo_free_screen(void *, void *); -int bwtwo_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t bwtwo_mmap(void *, off_t, int); int bwtwo_is_console(int); void bwtwo_burner(void *, u_int, u_int); @@ -116,9 +111,9 @@ void bwtwo_burner(void *, u_int, u_int); struct wsdisplay_accessops bwtwo_accessops = { bwtwo_ioctl, bwtwo_mmap, - bwtwo_alloc_screen, - bwtwo_free_screen, - bwtwo_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -200,11 +195,10 @@ bwtwoattach(parent, self, aux) sc->sc_sunfb.sf_ro.ri_bits = (void *)bus_space_vaddr(sc->sc_bustag, sc->sc_vid_regs); sc->sc_sunfb.sf_ro.ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, console ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, console); - if (console) { + if (console) fbwscons_console_init(&sc->sc_sunfb, -1); - } fbwscons_attach(&sc->sc_sunfb, &bwtwo_accessops, console); @@ -263,52 +257,6 @@ bwtwo_ioctl(v, cmd, data, flags, p) return (0); } -int -bwtwo_alloc_screen(v, type, cookiep, curxp, curyp, attrp) - void *v; - const struct wsscreen_descr *type; - void **cookiep; - int *curxp, *curyp; - long *attrp; -{ - struct bwtwo_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -bwtwo_free_screen(v, cookie) - void *v; - void *cookie; -{ - struct bwtwo_softc *sc = v; - - sc->sc_nscreens--; -} - -int -bwtwo_show_screen(v, cookie, waitok, cb, cbarg) - void *v; - void *cookie; - int waitok; - void (*cb)(void *, int, int); - void *cbarg; -{ - return (0); -} - -#define START (128 * 1024 + 128 * 1024) -#define NOOVERLAY (0x04000000) - paddr_t bwtwo_mmap(v, offset, prot) void *v; diff --git a/sys/dev/sbus/cgsix.c b/sys/dev/sbus/cgsix.c index cbd5d730f20..6ba19025bc4 100644 --- a/sys/dev/sbus/cgsix.c +++ b/sys/dev/sbus/cgsix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgsix.c,v 1.56 2006/12/17 22:18:16 miod Exp $ */ +/* $OpenBSD: cgsix.c,v 1.57 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -53,11 +53,6 @@ #include int cgsix_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgsix_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgsix_free_screen(void *, void *); -int cgsix_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t cgsix_mmap(void *, off_t, int); int cgsix_is_console(int); int cg6_bt_getcmap(union bt_cmap *, struct wsdisplay_cmap *); @@ -81,9 +76,9 @@ int cgsix_updatecursor(struct cgsix_softc *, u_int); struct wsdisplay_accessops cgsix_accessops = { cgsix_ioctl, cgsix_mmap, - cgsix_alloc_screen, - cgsix_free_screen, - cgsix_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -202,7 +197,12 @@ cgsixattach(struct device *parent, struct device *self, void *aux) sc->sc_sunfb.sf_ro.ri_bits = (void *)bus_space_vaddr(sc->sc_bustag, sc->sc_vid_regs); sc->sc_sunfb.sf_ro.ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, console ? 0 : RI_CLEAR); + + printf(", %dx%d, rev %d\n", sc->sc_sunfb.sf_width, + sc->sc_sunfb.sf_height, rev); + + fbwscons_init(&sc->sc_sunfb, 0, console); + fbwscons_setcolormap(&sc->sc_sunfb, cgsix_setcolor); /* * Old rev. cg6 cards do not like the current acceleration code. @@ -223,14 +223,8 @@ cgsixattach(struct device *parent, struct device *self, void *aux) cgsix_ras_init(sc); } - printf(", %dx%d, rev %d\n", sc->sc_sunfb.sf_width, - sc->sc_sunfb.sf_height, rev); - - fbwscons_setcolormap(&sc->sc_sunfb, cgsix_setcolor); - - if (console) { + if (console) fbwscons_console_init(&sc->sc_sunfb, -1); - } fbwscons_attach(&sc->sc_sunfb, &cgsix_accessops, console); @@ -500,39 +494,6 @@ cgsix_updatecursor(struct cgsix_softc *sc, u_int which) return (0); } -int -cgsix_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct cgsix_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -cgsix_free_screen(void *v, void *cookie) -{ - struct cgsix_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgsix_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - struct mmo { off_t mo_uaddr; bus_size_t mo_size; diff --git a/sys/dev/sbus/cgthree.c b/sys/dev/sbus/cgthree.c index 75634235fc5..cbf5c45e706 100644 --- a/sys/dev/sbus/cgthree.c +++ b/sys/dev/sbus/cgthree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgthree.c,v 1.43 2006/12/17 22:18:16 miod Exp $ */ +/* $OpenBSD: cgthree.c,v 1.44 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -128,11 +128,6 @@ struct cgthree_softc { }; int cgthree_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgthree_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgthree_free_screen(void *, void *); -int cgthree_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t cgthree_mmap(void *, off_t, int); int cgthree_is_console(int); void cgthree_loadcmap(struct cgthree_softc *, u_int, u_int); @@ -145,9 +140,9 @@ void cgthree_reset(struct cgthree_softc *); struct wsdisplay_accessops cgthree_accessops = { cgthree_ioctl, cgthree_mmap, - cgthree_alloc_screen, - cgthree_free_screen, - cgthree_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -175,13 +170,13 @@ struct cg3_videoctrl { u_int8_t ctrl; } cg3_videoctrl[] = { { /* cpd-1790 */ - 0x31, + FBC_STAT_RES_1152 | FBC_STAT_ID_COLOR, { 0xbb, 0x2b, 0x04, 0x14, 0xae, 0x03, 0xa8, 0x24, 0x01, 0x05, 0xff, 0x01 }, FBC_CTRL_XTAL_0 | FBC_CTRL_DIV_1 }, { /* gdm-20e20 */ - 0x41, + FBC_STAT_RES_1152A | FBC_STAT_ID_COLOR, { 0xb7, 0x27, 0x03, 0x0f, 0xae, 0x03, 0xae, 0x2a, 0x01, 0x09, 0xff, 0x01 }, FBC_CTRL_XTAL_1 | FBC_CTRL_DIV_1 @@ -256,27 +251,11 @@ cgthreeattach(struct device *parent, struct device *self, void *aux) printf(", %dx%d\n", sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height); - /* - * If the framebuffer width is under 1024x768, which is the case for - * some clones on laptops, as well as with the VS10-EK, switch from - * the PROM font to the more adequate 8x16 font here. - * However, we need to adjust two things in this case: - * - the display row should be overrided from the current PROM metrics, - * to prevent us from overwriting the last few lines of text. - * - if the 80x34 screen would make a large margin appear around it, - * choose to clear the screen rather than keeping old prom output in - * the margins. - * XXX there should be a rasops "clear margins" feature - */ - fbwscons_init(&sc->sc_sunfb, console && - (sc->sc_sunfb.sf_width >= 1024) ? 0 : RI_CLEAR); - + fbwscons_init(&sc->sc_sunfb, 0, console); fbwscons_setcolormap(&sc->sc_sunfb, cgthree_setcolor); - if (console) { - fbwscons_console_init(&sc->sc_sunfb, - sc->sc_sunfb.sf_width >= 1024 ? -1 : 0); - } + if (console) + fbwscons_console_init(&sc->sc_sunfb, -1); fbwscons_attach(&sc->sc_sunfb, &cgthree_accessops, console); @@ -346,39 +325,6 @@ cgthree_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -cgthree_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct cgthree_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -cgthree_free_screen(void *v, void *cookie) -{ - struct cgthree_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgthree_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - #define START (128 * 1024 + 128 * 1024) #define NOOVERLAY (0x04000000) @@ -505,7 +451,7 @@ cgthree_reset(struct cgthree_softc *sc) return; } - for (i = 0; i < sizeof(cg3_videoctrl)/sizeof(cg3_videoctrl[0]); i++) { + for (i = 0; i < nitems(cg3_videoctrl); i++) { if (cg3_videoctrl[i].sense == 0xff || (cg3_videoctrl[i].sense == (sts & (FBC_STAT_RES | FBC_STAT_ID)))) { diff --git a/sys/dev/sbus/cgtwelve.c b/sys/dev/sbus/cgtwelve.c index 84782e93dc4..b298ef7358a 100644 --- a/sys/dev/sbus/cgtwelve.c +++ b/sys/dev/sbus/cgtwelve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgtwelve.c,v 1.5 2007/03/13 19:40:49 miod Exp $ */ +/* $OpenBSD: cgtwelve.c,v 1.6 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2002, 2003 Miodrag Vallat. All rights reserved. @@ -89,11 +89,6 @@ struct cgtwelve_softc { }; int cgtwelve_ioctl(void *, u_long, caddr_t, int, struct proc *); -int cgtwelve_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void cgtwelve_free_screen(void *, void *); -int cgtwelve_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t cgtwelve_mmap(void *, off_t, int); void cgtwelve_reset(struct cgtwelve_softc *, int); void cgtwelve_prom(void *); @@ -104,9 +99,9 @@ static __inline__ void cgtwelve_ramdac_wraddr(struct cgtwelve_softc *sc, struct wsdisplay_accessops cgtwelve_accessops = { cgtwelve_ioctl, cgtwelve_mmap, - cgtwelve_alloc_screen, - cgtwelve_free_screen, - cgtwelve_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -237,7 +232,7 @@ cgtwelveattach(struct device *parent, struct device *self, void *args) sc->sc_sunfb.sf_ro.ri_bits = (void *)sc->sc_overlay; sc->sc_sunfb.sf_ro.ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, isconsole); if (isconsole) { fbwscons_console_init(&sc->sc_sunfb, -1); @@ -434,39 +429,6 @@ cgtwelve_mmap(void *v, off_t offset, int prot) return (-1); } -int -cgtwelve_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct cgtwelve_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -cgtwelve_free_screen(void *v, void *cookie) -{ - struct cgtwelve_softc *sc = v; - - sc->sc_nscreens--; -} - -int -cgtwelve_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - /* * Simple Bt462 programming routines. */ diff --git a/sys/dev/sbus/mgx.c b/sys/dev/sbus/mgx.c index bad4475b9fa..5b3a7e856a4 100644 --- a/sys/dev/sbus/mgx.c +++ b/sys/dev/sbus/mgx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mgx.c,v 1.10 2008/04/15 20:23:54 miod Exp $ */ +/* $OpenBSD: mgx.c,v 1.11 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -128,21 +128,16 @@ struct mgx_softc { int sc_nscreens; }; -int mgx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); void mgx_burner(void *, u_int ,u_int); -void mgx_free_screen(void *, void *); int mgx_ioctl(void *, u_long, caddr_t, int, struct proc *); paddr_t mgx_mmap(void *, off_t, int); -int mgx_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); struct wsdisplay_accessops mgx_accessops = { mgx_ioctl, mgx_mmap, - mgx_alloc_screen, - mgx_free_screen, - mgx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -285,14 +280,14 @@ mgxattach(struct device *parent, struct device *self, void *args) sc->sc_sunfb.sf_ro.ri_bits = bus_space_vaddr(bt, bh); sc->sc_sunfb.sf_ro.ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR); + printf(", %dx%d\n", + sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height); + + fbwscons_init(&sc->sc_sunfb, 0, isconsole); bzero(sc->sc_cmap, sizeof(sc->sc_cmap)); fbwscons_setcolormap(&sc->sc_sunfb, mgx_setcolor); - printf(", %dx%d\n", - sc->sc_sunfb.sf_width, sc->sc_sunfb.sf_height); - if (chipid != ID_AT24) { printf("%s: unexpected engine id %04x\n", self->dv_xname, chipid); @@ -300,9 +295,8 @@ mgxattach(struct device *parent, struct device *self, void *args) mgx_ras_init(sc, chipid); - if (isconsole) { + if (isconsole) fbwscons_console_init(&sc->sc_sunfb, -1); - } fbwscons_attach(&sc->sc_sunfb, &mgx_accessops, isconsole); } @@ -419,39 +413,6 @@ mgx_mmap(void *v, off_t offset, int prot) return (-1); } -int -mgx_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct mgx_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -mgx_free_screen(void *v, void *cookie) -{ - struct mgx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -mgx_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - void mgx_burner(void *v, u_int on, u_int flags) { diff --git a/sys/dev/sbus/rfx.c b/sys/dev/sbus/rfx.c index 70a658484a3..4f54b2fa3f1 100644 --- a/sys/dev/sbus/rfx.c +++ b/sys/dev/sbus/rfx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfx.c,v 1.8 2007/11/26 09:28:33 martynas Exp $ */ +/* $OpenBSD: rfx.c,v 1.9 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. @@ -120,13 +120,8 @@ struct rfx_softc { int sc_nscreens; }; -int rfx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); void rfx_burner(void *, u_int, u_int); -void rfx_free_screen(void *, void *); int rfx_ioctl(void *, u_long, caddr_t, int, struct proc *); -int rfx_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t rfx_mmap(void *, off_t, int); int rfx_getcmap(struct rfx_cmap *, struct wsdisplay_cmap *); @@ -140,9 +135,9 @@ void rfx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); struct wsdisplay_accessops rfx_accessops = { rfx_ioctl, rfx_mmap, - rfx_alloc_screen, - rfx_free_screen, - rfx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -301,14 +296,13 @@ rfxattach(struct device *parent, struct device *self, void *args) return; } - fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, isconsole); bzero(&sc->sc_cmap, sizeof(sc->sc_cmap)); fbwscons_setcolormap(&sc->sc_sunfb, rfx_setcolor); - if (isconsole) { + if (isconsole) fbwscons_console_init(&sc->sc_sunfb, -1); - } /* enable video */ rfx_burner(sc, 1, 0); @@ -384,39 +378,6 @@ rfx_mmap(void *v, off_t offset, int prot) return (-1); } -int -rfx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct rfx_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -rfx_free_screen(void *v, void *cookie) -{ - struct rfx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -rfx_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - void rfx_burner(void *v, u_int on, u_int flags) { diff --git a/sys/dev/sbus/tvtwo.c b/sys/dev/sbus/tvtwo.c index 81e93fdf5b8..f87d173dfba 100644 --- a/sys/dev/sbus/tvtwo.c +++ b/sys/dev/sbus/tvtwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tvtwo.c,v 1.13 2008/12/25 23:56:31 miod Exp $ */ +/* $OpenBSD: tvtwo.c,v 1.14 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2003, 2006, 2008, Miodrag Vallat. @@ -126,20 +126,15 @@ struct tvtwo_softc { }; int tvtwo_ioctl(void *, u_long, caddr_t, int, struct proc *); -int tvtwo_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void tvtwo_free_screen(void *, void *); -int tvtwo_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t tvtwo_mmap(void *, off_t, int); void tvtwo_burner(void *, u_int, u_int); struct wsdisplay_accessops tvtwo_accessops = { tvtwo_ioctl, tvtwo_mmap, - tvtwo_alloc_screen, - tvtwo_free_screen, - tvtwo_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -296,18 +291,11 @@ tvtwoattach(struct device *parent, struct device *self, void *args) sc->sc_sunfb.sf_ro.ri_hw = sc; sc->sc_sunfb.sf_ro.ri_bits = (u_char *)sc->sc_m8; - /* - * If the framebuffer width is under 1024, we will switch from - * the PROM font to the more adequate 8x16 font here. - */ - fbwscons_init(&sc->sc_sunfb, - isconsole && (width >= 1024) ? RI_CLEARMARGINS : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, isconsole); fbwscons_setcolormap(&sc->sc_sunfb, tvtwo_setcolor); - if (isconsole) { - fbwscons_console_init(&sc->sc_sunfb, - width >= 1024 ? -1 : 0); - } + if (isconsole) + fbwscons_console_init(&sc->sc_sunfb, -1); fbwscons_attach(&sc->sc_sunfb, &tvtwo_accessops, isconsole); } @@ -391,39 +379,6 @@ tvtwo_mmap(void *v, off_t offset, int prot) return (-1); } -int -tvtwo_alloc_screen(void *v, const struct wsscreen_descr *type, - void **cookiep, int *curxp, int *curyp, long *attrp) -{ - struct tvtwo_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - 0, 0, 0, attrp); - sc->sc_nscreens++; - return (0); -} - -void -tvtwo_free_screen(void *v, void *cookie) -{ - struct tvtwo_softc *sc = v; - - sc->sc_nscreens--; -} - -int -tvtwo_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - void tvtwo_burner(void *v, u_int on, u_int flags) { diff --git a/sys/dev/sbus/vigra.c b/sys/dev/sbus/vigra.c index 1a41d0f146b..e789f7d4988 100644 --- a/sys/dev/sbus/vigra.c +++ b/sys/dev/sbus/vigra.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vigra.c,v 1.10 2006/12/17 22:18:16 miod Exp $ */ +/* $OpenBSD: vigra.c,v 1.11 2008/12/27 17:23:03 miod Exp $ */ /* * Copyright (c) 2002, 2003, Miodrag Vallat. @@ -185,11 +185,6 @@ struct vigra_softc { }; int vigra_ioctl(void *, u_long, caddr_t, int, struct proc *); -int vigra_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void vigra_free_screen(void *, void *); -int vigra_show_screen(void *, void *, int, void (*cb)(void *, int, int), - void *); paddr_t vigra_mmap(void *, off_t, int); void vigra_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); int vigra_getcmap(union vigracmap *, struct wsdisplay_cmap *, int); @@ -203,9 +198,9 @@ int vigra_intr(void *); struct wsdisplay_accessops vigra_accessops = { vigra_ioctl, vigra_mmap, - vigra_alloc_screen, - vigra_free_screen, - vigra_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -249,7 +244,7 @@ vigraattach(struct device *parent, struct device *self, void *args) struct sbus_attach_args *sa = args; bus_space_tag_t bt; bus_space_handle_t bh; - int node, row, isconsole = 0; + int node, isconsole = 0; char *nam; bt = sa->sa_bustag; @@ -315,41 +310,11 @@ vigraattach(struct device *parent, struct device *self, void *args) self->dv_xname, INTLEV(sa->sa_pri)); } - /* - * If the framebuffer width is under 1024x768, we will switch from the - * PROM font to the more adequate 8x16 font here. - * However, we need to adjust two things in this case: - * - the display row should be overrided from the current PROM metrics, - * to prevent us from overwriting the last few lines of text. - * - if the 80x34 screen would make a large margin appear around it, - * choose to clear the screen rather than keeping old prom output in - * the margins. - * XXX there should be a rasops "clear margins" feature - * - * Also, in 1280x1024 resolution, the PROM display is not centered - * vertically (why? no other frame buffer does this in such a mode!), - * so be lazy and clear the screen here too anyways... - */ - fbwscons_init(&sc->sc_sunfb, isconsole && (sc->sc_sunfb.sf_width != 800 - && sc->sc_sunfb.sf_width != 1280) ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, isconsole); fbwscons_setcolormap(&sc->sc_sunfb, vigra_setcolor); - if (isconsole) { - switch (sc->sc_sunfb.sf_width) { - case 640: - row = sc->sc_sunfb.sf_ro.ri_rows - 1; - break; - case 800: - case 1280: - row = 0; /* screen has been cleared above */ - break; - default: - row = -1; - break; - } - - fbwscons_console_init(&sc->sc_sunfb, row); - } + if (isconsole) + fbwscons_console_init(&sc->sc_sunfb, -1); fbwscons_attach(&sc->sc_sunfb, &vigra_accessops, isconsole); } @@ -411,39 +376,6 @@ vigra_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -vigra_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct vigra_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -vigra_free_screen(void *v, void *cookie) -{ - struct vigra_softc *sc = v; - - sc->sc_nscreens--; -} - -int -vigra_show_screen(void *v, void *cookie, int waitok, - void (*cb)(void *, int, int), void *cbarg) -{ - return (0); -} - /* * Return the address that would map the given device at the given * offset, allowing for the given protection, or return -1 for error. diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c index eb376d52b86..012ab400701 100644 --- a/sys/dev/sbus/zx.c +++ b/sys/dev/sbus/zx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zx.c,v 1.15 2008/12/25 23:56:31 miod Exp $ */ +/* $OpenBSD: zx.c,v 1.16 2008/12/27 17:23:03 miod Exp $ */ /* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */ /* @@ -121,10 +121,6 @@ struct zx_softc { }; int zx_ioctl(void *, u_long, caddr_t, int, struct proc *); -int zx_alloc_screen(void *, const struct wsscreen_descr *, void **, - int *, int *, long *); -void zx_free_screen(void *, void *); -int zx_show_screen(void *, void *, int, void (*)(void *, int, int), void *); paddr_t zx_mmap(void *, off_t, int); void zx_setcolor(void *, u_int, u_int8_t, u_int8_t, u_int8_t); void zx_reset(struct zx_softc *, u_int); @@ -133,9 +129,9 @@ void zx_burner(void *, u_int, u_int); struct wsdisplay_accessops zx_accessops = { zx_ioctl, zx_mmap, - zx_alloc_screen, - zx_free_screen, - zx_show_screen, + NULL, /* alloc_screen */ + NULL, /* free_screen */ + NULL, /* show_screen */ NULL, /* load_font */ NULL, /* scrollback */ NULL, /* getchar */ @@ -278,7 +274,7 @@ zx_attach(struct device *parent, struct device *self, void *args) ri->ri_bits = bus_space_vaddr(bt, bh); ri->ri_hw = sc; - fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR); + fbwscons_init(&sc->sc_sunfb, 0, isconsole); /* * Watch out! rasops_init() invoked via fbwscons_init() did not @@ -368,39 +364,6 @@ zx_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) return (0); } -int -zx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, - int *curxp, int *curyp, long *attrp) -{ - struct zx_softc *sc = v; - - if (sc->sc_nscreens > 0) - return (ENOMEM); - - *cookiep = &sc->sc_sunfb.sf_ro; - *curyp = 0; - *curxp = 0; - sc->sc_sunfb.sf_ro.ri_ops.alloc_attr(&sc->sc_sunfb.sf_ro, - WSCOL_BLACK, WSCOL_WHITE, WSATTR_WSCOLORS, attrp); - sc->sc_nscreens++; - return (0); -} - -void -zx_free_screen(void *v, void *cookie) -{ - struct zx_softc *sc = v; - - sc->sc_nscreens--; -} - -int -zx_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), - void *cbarg) -{ - return (0); -} - /* * Return the address that would map the given device at the given * offset, allowing for the given protection, or return -1 for error. -- cgit v1.2.3