summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/conf/files.sparc6410
-rw-r--r--sys/arch/sparc64/dev/vgafb.c114
2 files changed, 61 insertions, 63 deletions
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64
index f01cb1e6783..5f8ca3830ea 100644
--- a/sys/arch/sparc64/conf/files.sparc64
+++ b/sys/arch/sparc64/conf/files.sparc64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.sparc64,v 1.34 2002/06/03 16:35:55 fgsch Exp $
+# $OpenBSD: files.sparc64,v 1.35 2002/06/04 21:50:07 jason Exp $
# $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $
# maxpartitions must be first item in files.${ARCH}
@@ -23,6 +23,8 @@ file arch/sparc64/dev/uperf.c uperf needs-flag
include "dev/sun/files.sun"
include "dev/wscons/files.wscons"
+include "dev/rasops/files.rasops"
+include "dev/wsfont/files.wsfont"
include "dev/sbus/files.sbus"
include "dev/i2o/files.i2o"
include "dev/mii/files.mii"
@@ -37,10 +39,6 @@ file arch/sparc64/sparc64/netbsd_machdep.c compat_netbsd
attach sbus at mainbus
file arch/sparc64/dev/sbus.c sbus
-# Raster operations
-include "dev/rasops/files.rasops"
-include "dev/wsfont/files.wsfont"
-
device creator: wsemuldisplaydev, rasops8, rasops16, rasops24, rasops32
attach creator at mainbus
file arch/sparc64/dev/creator.c creator
@@ -54,7 +52,7 @@ file arch/sparc64/dev/pci_machdep.c psycho
attach hme at pci with hme_pci
file dev/pci/if_hme_pci.c hme_pci
-device vgafb: wsemuldisplaydev, wsrasteremulops, wsemul_sun
+device vgafb: wsemuldisplaydev, rasops8, rasops16, rasops24, rasops32, wsemul_sun
attach vgafb at pci
file arch/sparc64/dev/vgafb.c vgafb
diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c
index 7a149be7188..29f58dadeee 100644
--- a/sys/arch/sparc64/dev/vgafb.c
+++ b/sys/arch/sparc64/dev/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.17 2002/04/15 17:43:30 jason Exp $ */
+/* $OpenBSD: vgafb.c,v 1.18 2002/06/04 21:50:07 jason Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -56,11 +56,10 @@
#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>
struct vgafb_softc {
struct device sc_dev;
- struct sbusdev sc_sd;
int sc_nscreens;
int sc_width, sc_height, sc_depth, sc_linebytes;
int sc_node, sc_ofhandle;
@@ -72,24 +71,12 @@ struct vgafb_softc {
pci_chipset_tag_t sc_pci_chip;
u_int8_t *sc_rom_ptr;
int sc_has_rom;
- struct rcons sc_rcons;
- struct raster sc_raster;
int sc_console;
u_int sc_mode;
u_int8_t sc_cmap_red[256];
u_int8_t sc_cmap_green[256];
u_int8_t sc_cmap_blue[256];
-};
-
-struct wsdisplay_emulops vgafb_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 vgafb_stdscreen = {
@@ -203,48 +190,61 @@ vgafbattach(parent, self, aux)
if (vgafb_mapregs(sc, pa))
return;
- 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_mem_t, sc->sc_mem_h);
-
- if (sc->sc_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;
+ if (sc->sc_depth == 24) {
+ /* Depth is 24, but rasops really wants bpp */
+ sc->sc_rasops.ri_depth = 32;
+ /* PROM gets linebytes wrong, ignore it. */
+ sc->sc_rasops.ri_stride =
+ (sc->sc_rasops.ri_depth / 8) * sc->sc_width;
+ } else {
+ sc->sc_rasops.ri_depth = sc->sc_depth;
+ sc->sc_rasops.ri_stride = sc->sc_linebytes;
}
- sc->sc_rcons.rc_maxcol =
- a2int(getpropstring(optionsnode, "screen-#columns"), 80);
- sc->sc_rcons.rc_maxrow =
- a2int(getpropstring(optionsnode, "screen-#rows"), 34);
+ sc->sc_rasops.ri_flg = RI_CENTER;
+ sc->sc_rasops.ri_bits = (void *)bus_space_vaddr(sc->sc_mem_t,
+ sc->sc_mem_h);
+ sc->sc_rasops.ri_width = sc->sc_width;
+ sc->sc_rasops.ri_height = sc->sc_height;
+ sc->sc_rasops.ri_hw = sc;
- rcons_init(&sc->sc_rcons,
- sc->sc_rcons.rc_maxrow, sc->sc_rcons.rc_maxcol);
+ rasops_init(&sc->sc_rasops,
+ a2int(getpropstring(optionsnode, "screen-#rows"), 34),
+ a2int(getpropstring(optionsnode, "screen-#columns"), 80));
- vgafb_stdscreen.nrows = sc->sc_rcons.rc_maxrow;
- vgafb_stdscreen.ncols = sc->sc_rcons.rc_maxcol;
- vgafb_stdscreen.textops = &vgafb_emulops;
- rcons_alloc_attr(&sc->sc_rcons, 0, 0, 0, &defattr);
+ vgafb_stdscreen.nrows = sc->sc_rasops.ri_rows;
+ vgafb_stdscreen.ncols = sc->sc_rasops.ri_cols;
+ vgafb_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 (sc->sc_console) {
+ int *ccolp, *crowp;
+
sc->sc_ofhandle = OF_stdout();
- vgafb_setcolor(sc, WSCOL_BLACK, 0, 0, 0);
- vgafb_setcolor(sc, 255, 255, 255, 255);
- vgafb_setcolor(sc, WSCOL_RED, 255, 0, 0);
- vgafb_setcolor(sc, WSCOL_GREEN, 0, 255, 0);
- vgafb_setcolor(sc, WSCOL_BROWN, 154, 85, 46);
- vgafb_setcolor(sc, WSCOL_BLUE, 0, 0, 255);
- vgafb_setcolor(sc, WSCOL_MAGENTA, 255, 255, 0);
- vgafb_setcolor(sc, WSCOL_CYAN, 0, 255, 255);
- vgafb_setcolor(sc, WSCOL_WHITE, 255, 255, 255);
- wsdisplay_cnattach(&vgafb_stdscreen, &sc->sc_rcons,
- *sc->sc_rcons.rc_ccolp, *sc->sc_rcons.rc_crowp, defattr);
+
+ if (sc->sc_depth == 8) {
+ vgafb_setcolor(sc, WSCOL_BLACK, 0, 0, 0);
+ vgafb_setcolor(sc, 255, 255, 255, 255);
+ vgafb_setcolor(sc, WSCOL_RED, 255, 0, 0);
+ vgafb_setcolor(sc, WSCOL_GREEN, 0, 255, 0);
+ vgafb_setcolor(sc, WSCOL_BROWN, 154, 85, 46);
+ vgafb_setcolor(sc, WSCOL_BLUE, 0, 0, 255);
+ vgafb_setcolor(sc, WSCOL_MAGENTA, 255, 255, 0);
+ vgafb_setcolor(sc, WSCOL_CYAN, 0, 255, 255);
+ vgafb_setcolor(sc, WSCOL_WHITE, 255, 255, 255);
+ }
+
+ 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(&vgafb_stdscreen, &sc->sc_rasops,
+ sc->sc_rasops.ri_ccol, sc->sc_rasops.ri_crow, defattr);
}
waa.console = sc->sc_console;
@@ -278,11 +278,11 @@ vgafb_ioctl(v, cmd, data, flags, p)
wdf = (void *)data;
wdf->height = sc->sc_height;
wdf->width = sc->sc_width;
- wdf->depth = sc->sc_depth;
+ wdf->depth = sc->sc_rasops.ri_depth;
wdf->cmsize = 256;
break;
case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = sc->sc_linebytes;
+ *(u_int *)data = sc->sc_rasops.ri_stride;
break;
case WSDISPLAYIO_GETCMAP:
@@ -386,10 +386,11 @@ vgafb_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);
}
@@ -619,8 +620,7 @@ vgafb_mapregs(sc, pa)
if (hasmem)
continue;
if (bus_space_map2(pa->pa_memt, SBUS_BUS_SPACE,
- ba, bs, 0, NULL,
- &sc->sc_mem_h)) {
+ ba, bs, 0, NULL, &sc->sc_mem_h)) {
printf(": can't map mem space\n");
continue;
}