summaryrefslogtreecommitdiff
path: root/sys/dev/sbus/cgsix.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-06-03 02:32:07 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-06-03 02:32:07 +0000
commiteeb42c5ab3ea669959a6e9f534930db92dbff850 (patch)
tree99d7654cb5e2e995d67eb4ccebaed7fd51e6daf7 /sys/dev/sbus/cgsix.c
parentb19defebe3ea889ca13b8052e2e444c37bd58330 (diff)
Convert from rcons to rasops
Diffstat (limited to 'sys/dev/sbus/cgsix.c')
-rw-r--r--sys/dev/sbus/cgsix.c79
1 files changed, 34 insertions, 45 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);
}