diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-06-03 02:32:07 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-06-03 02:32:07 +0000 |
commit | eeb42c5ab3ea669959a6e9f534930db92dbff850 (patch) | |
tree | 99d7654cb5e2e995d67eb4ccebaed7fd51e6daf7 | |
parent | b19defebe3ea889ca13b8052e2e444c37bd58330 (diff) |
Convert from rcons to rasops
-rw-r--r-- | sys/dev/sbus/cgsix.c | 79 | ||||
-rw-r--r-- | sys/dev/sbus/cgthree.c | 79 | ||||
-rw-r--r-- | sys/dev/sbus/files.sbus | 6 |
3 files changed, 71 insertions, 93 deletions
diff --git a/sys/dev/sbus/cgsix.c b/sys/dev/sbus/cgsix.c index 3c1e2ee940a..31e03b645aa 100644 --- a/sys/dev/sbus/cgsix.c +++ b/sys/dev/sbus/cgsix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgsix.c,v 1.20 2002/05/21 20:25:28 jason Exp $ */ +/* $OpenBSD: cgsix.c,v 1.21 2002/06/03 02:32:06 jason Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -53,7 +53,7 @@ #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/wscons/wscons_raster.h> -#include <dev/rcons/raster.h> +#include <dev/rasops/rasops.h> union bt_cmap { u_int8_t cm_map[256][3]; /* 256 r/b/g entries */ @@ -150,10 +150,9 @@ struct cgsix_softc { bus_space_handle_t sc_thc_regs; bus_space_handle_t sc_tec_regs; bus_space_handle_t sc_vid_regs; + struct rasops_info sc_rasops; int sc_nscreens; int sc_width, sc_height, sc_depth, sc_linebytes; - struct rcons sc_rcons; - struct raster sc_raster; union bt_cmap sc_cmap; void *sc_ih; }; @@ -190,17 +189,6 @@ struct cgsix_softc { bus_space_barrier((sc)->sc_bustag, (sc)->sc_bt_regs, (reg), \ sizeof(u_int32_t), (flags)) -struct wsdisplay_emulops cgsix_emulops = { - rcons_cursor, - rcons_mapchar, - rcons_putchar, - rcons_copycols, - rcons_erasecols, - rcons_copyrows, - rcons_eraserows, - rcons_alloc_attr -}; - struct wsscreen_descr cgsix_stdscreen = { "std", 0, 0, /* will be filled in -- XXX shouldn't, it's global. */ @@ -360,37 +348,30 @@ cgsixattach(parent, self, aux) sbus_establish(&sc->sc_sd, self); - sc->sc_rcons.rc_sp = &sc->sc_raster; - sc->sc_raster.width = sc->sc_width; - sc->sc_raster.height = sc->sc_height; - sc->sc_raster.depth = sc->sc_depth; - sc->sc_raster.linelongs = sc->sc_linebytes / 4; - sc->sc_raster.pixels = (void *)bus_space_vaddr(sc->sc_bustag, + sc->sc_rasops.ri_depth = sc->sc_depth; + sc->sc_rasops.ri_stride = sc->sc_linebytes; + sc->sc_rasops.ri_flg = RI_CENTER; + sc->sc_rasops.ri_bits = (void *)bus_space_vaddr(sc->sc_bustag, sc->sc_vid_regs); + sc->sc_rasops.ri_width = sc->sc_width; + sc->sc_rasops.ri_height = sc->sc_height; + sc->sc_rasops.ri_hw = sc; - if (console == 0 || - romgetcursoraddr(&sc->sc_rcons.rc_crowp, &sc->sc_rcons.rc_ccolp)) { - sc->sc_rcons.rc_crow = sc->sc_rcons.rc_ccol = -1; - sc->sc_rcons.rc_crowp = &sc->sc_rcons.rc_crow; - sc->sc_rcons.rc_ccolp = &sc->sc_rcons.rc_ccol; - } - - sc->sc_rcons.rc_maxcol = - a2int(getpropstring(optionsnode, "screen-#columns"), 80); - sc->sc_rcons.rc_maxrow = - a2int(getpropstring(optionsnode, "screen-#rows"), 34); + rasops_init(&sc->sc_rasops, + a2int(getpropstring(optionsnode, "screen-#rows"), 34), + a2int(getpropstring(optionsnode, "screen-#columns"), 80)); - rcons_init(&sc->sc_rcons, - sc->sc_rcons.rc_maxrow, sc->sc_rcons.rc_maxcol); - - cgsix_stdscreen.nrows = sc->sc_rcons.rc_maxrow; - cgsix_stdscreen.ncols = sc->sc_rcons.rc_maxcol; - cgsix_stdscreen.textops = &cgsix_emulops; - rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, &defattr); + cgsix_stdscreen.nrows = sc->sc_rasops.ri_rows; + cgsix_stdscreen.ncols = sc->sc_rasops.ri_cols; + cgsix_stdscreen.textops = &sc->sc_rasops.ri_ops; + sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops, + WSCOL_WHITE, WSCOL_BLACK, WSATTR_WSCOLORS, &defattr); printf("\n"); if (console) { + int *ccolp, *crowp; + cgsix_setcolor(sc, WSCOL_BLACK, 0, 0, 0); cgsix_setcolor(sc, 255, 255, 255, 255); cgsix_setcolor(sc, WSCOL_RED, 255, 0, 0); @@ -401,8 +382,15 @@ cgsixattach(parent, self, aux) cgsix_setcolor(sc, WSCOL_CYAN, 0, 255, 255); cgsix_setcolor(sc, WSCOL_WHITE, 255, 255, 255); - wsdisplay_cnattach(&cgsix_stdscreen, &sc->sc_rcons, - *sc->sc_rcons.rc_ccolp, *sc->sc_rcons.rc_crowp, defattr); + if (romgetcursoraddr(&crowp, &ccolp)) + ccolp = crowp = NULL; + if (ccolp != NULL) + sc->sc_rasops.ri_ccol = *ccolp; + if (crowp != NULL) + sc->sc_rasops.ri_crow = *crowp; + + wsdisplay_cnattach(&cgsix_stdscreen, &sc->sc_rasops, + sc->sc_rasops.ri_ccol, sc->sc_rasops.ri_crow, defattr); } waa.console = console; @@ -497,10 +485,11 @@ cgsix_alloc_screen(v, type, cookiep, curxp, curyp, attrp) if (sc->sc_nscreens > 0) return (ENOMEM); - *cookiep = &sc->sc_rcons; - *curyp = *sc->sc_rcons.rc_crowp; - *curxp = *sc->sc_rcons.rc_ccolp; - rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, attrp); + *cookiep = &sc->sc_rasops; + *curyp = 0; + *curxp = 0; + sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops, + WSCOL_WHITE, WSCOL_BLACK, WSATTR_WSCOLORS, attrp); sc->sc_nscreens++; return (0); } diff --git a/sys/dev/sbus/cgthree.c b/sys/dev/sbus/cgthree.c index 3add41cdb64..a9c8c9a19c6 100644 --- a/sys/dev/sbus/cgthree.c +++ b/sys/dev/sbus/cgthree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgthree.c,v 1.17 2002/06/02 19:51:03 jason Exp $ */ +/* $OpenBSD: cgthree.c,v 1.18 2002/06/03 02:32:06 jason Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -53,7 +53,7 @@ #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/wscons/wscons_raster.h> -#include <dev/rcons/raster.h> +#include <dev/rasops/rasops.h> #define CGTHREE_CTRL_OFFSET 0x400000 #define CGTHREE_CTRL_SIZE (sizeof(u_int32_t) * 8) @@ -128,20 +128,8 @@ struct cgthree_softc { bus_space_handle_t sc_vid_regs; int sc_nscreens; int sc_width, sc_height, sc_depth, sc_linebytes; - struct rcons sc_rcons; - struct raster sc_raster; union bt_cmap sc_cmap; -}; - -struct wsdisplay_emulops cgthree_emulops = { - rcons_cursor, - rcons_mapchar, - rcons_putchar, - rcons_copycols, - rcons_erasecols, - rcons_copyrows, - rcons_eraserows, - rcons_alloc_attr + struct rasops_info sc_rasops; }; struct wsscreen_descr cgthree_stdscreen = { @@ -296,37 +284,30 @@ cgthreeattach(parent, self, aux) cgthree_burner(sc, 1, 0); - sc->sc_rcons.rc_sp = &sc->sc_raster; - sc->sc_raster.width = sc->sc_width; - sc->sc_raster.height = sc->sc_height; - sc->sc_raster.depth = sc->sc_depth; - sc->sc_raster.linelongs = sc->sc_linebytes / 4; - sc->sc_raster.pixels = (void *)bus_space_vaddr(sc->sc_bustag, + sc->sc_rasops.ri_depth = sc->sc_depth; + sc->sc_rasops.ri_stride = sc->sc_linebytes; + sc->sc_rasops.ri_flg = RI_CENTER; + sc->sc_rasops.ri_bits = (void *)bus_space_vaddr(sc->sc_bustag, sc->sc_vid_regs); + sc->sc_rasops.ri_width = sc->sc_width; + sc->sc_rasops.ri_height = sc->sc_height; + sc->sc_rasops.ri_hw = sc; - if (console == 0 || - romgetcursoraddr(&sc->sc_rcons.rc_crowp, &sc->sc_rcons.rc_ccolp)) { - sc->sc_rcons.rc_crow = sc->sc_rcons.rc_ccol = -1; - sc->sc_rcons.rc_crowp = &sc->sc_rcons.rc_crow; - sc->sc_rcons.rc_ccolp = &sc->sc_rcons.rc_ccol; - } - - sc->sc_rcons.rc_maxcol = - a2int(getpropstring(optionsnode, "screen-#columns"), 80); - sc->sc_rcons.rc_maxrow = - a2int(getpropstring(optionsnode, "screen-#rows"), 34); + rasops_init(&sc->sc_rasops, + a2int(getpropstring(optionsnode, "screen-#rows"), 34), + a2int(getpropstring(optionsnode, "screen-#columns"), 80)); - rcons_init(&sc->sc_rcons, - sc->sc_rcons.rc_maxrow, sc->sc_rcons.rc_maxcol); - - cgthree_stdscreen.nrows = sc->sc_rcons.rc_maxrow; - cgthree_stdscreen.ncols = sc->sc_rcons.rc_maxcol; - cgthree_stdscreen.textops = &cgthree_emulops; - rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, &defattr); + cgthree_stdscreen.nrows = sc->sc_rasops.ri_rows; + cgthree_stdscreen.ncols = sc->sc_rasops.ri_cols; + cgthree_stdscreen.textops = &sc->sc_rasops.ri_ops; + sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops, + WSCOL_WHITE, WSCOL_BLACK, WSATTR_WSCOLORS, &defattr); printf("\n"); if (console) { + int *ccolp, *crowp; + cgthree_setcolor(sc, WSCOL_BLACK, 0, 0, 0); cgthree_setcolor(sc, 255, 255, 255, 255); cgthree_setcolor(sc, WSCOL_RED, 255, 0, 0); @@ -337,8 +318,15 @@ cgthreeattach(parent, self, aux) cgthree_setcolor(sc, WSCOL_CYAN, 0, 255, 255); cgthree_setcolor(sc, WSCOL_WHITE, 255, 255, 255); - wsdisplay_cnattach(&cgthree_stdscreen, &sc->sc_rcons, - *sc->sc_rcons.rc_ccolp, *sc->sc_rcons.rc_crowp, defattr); + if (romgetcursoraddr(&crowp, &ccolp)) + ccolp = crowp = NULL; + if (ccolp != NULL) + sc->sc_rasops.ri_ccol = *ccolp; + if (crowp != NULL) + sc->sc_rasops.ri_crow = *crowp; + + wsdisplay_cnattach(&cgthree_stdscreen, &sc->sc_rasops, + sc->sc_rasops.ri_ccol, sc->sc_rasops.ri_crow, defattr); } waa.console = console; @@ -425,10 +413,11 @@ cgthree_alloc_screen(v, type, cookiep, curxp, curyp, attrp) if (sc->sc_nscreens > 0) return (ENOMEM); - *cookiep = &sc->sc_rcons; - *curyp = *sc->sc_rcons.rc_crowp; - *curxp = *sc->sc_rcons.rc_ccolp; - rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, attrp); + *cookiep = &sc->sc_rasops; + *curyp = 0; + *curxp = 0; + sc->sc_rasops.ri_ops.alloc_attr(&sc->sc_rasops, + WSCOL_WHITE, WSCOL_BLACK, WSATTR_WSCOLORS, attrp); sc->sc_nscreens++; return (0); } diff --git a/sys/dev/sbus/files.sbus b/sys/dev/sbus/files.sbus index 271663c83ed..c96976bd86e 100644 --- a/sys/dev/sbus/files.sbus +++ b/sys/dev/sbus/files.sbus @@ -1,4 +1,4 @@ -# $OpenBSD: files.sbus,v 1.16 2002/03/14 19:18:29 jason Exp $ +# $OpenBSD: files.sbus,v 1.17 2002/06/03 02:32:06 jason Exp $ # $NetBSD: files.sbus,v 1.16 2000/12/08 17:29:12 martin Exp $ # # Config file and device description for machine-independent SBUS code. @@ -52,11 +52,11 @@ file dev/sbus/cs4231.c audiocs attach isp at sbus with isp_sbus file dev/sbus/isp_sbus.c isp_sbus -device cgsix: wsemuldisplaydev, wsrasteremulops, wsemul_sun +device cgsix: wsemuldisplaydev, rasops8, wsemul_sun attach cgsix at sbus file dev/sbus/cgsix.c cgsix -device cgthree: wsemuldisplaydev, wsrasteremulops, wsemul_sun +device cgthree: wsemuldisplaydev, rasops8, wsemul_sun attach cgthree at sbus file dev/sbus/cgthree.c cgthree |