summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc64/dev/creator.c106
-rw-r--r--sys/arch/sparc64/dev/creatorreg.h49
2 files changed, 149 insertions, 6 deletions
diff --git a/sys/arch/sparc64/dev/creator.c b/sys/arch/sparc64/dev/creator.c
index c4e4f51d4eb..f942f7a20ad 100644
--- a/sys/arch/sparc64/dev/creator.c
+++ b/sys/arch/sparc64/dev/creator.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: creator.c,v 1.14 2002/07/26 16:57:16 jason Exp $ */
+/* $OpenBSD: creator.c,v 1.15 2002/07/26 18:00:08 jason Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -79,6 +79,13 @@ paddr_t creator_mmap(void *, off_t, int);
static int a2int(char *, int);
void creator_ras_fifo_wait(struct creator_softc *, int);
void creator_ras_wait(struct creator_softc *);
+void creator_ras_init(struct creator_softc *);
+void creator_ras_copyrows(void *, int, int, int);
+void creator_ras_copycols(void *, int, int, int, int);
+void creator_ras_erasecols(void *, int, int, int, long int);
+void creator_ras_eraserows(void *, int, int, long int);
+void creator_ras_do_cursor(struct rasops_info *);
+void creator_ras_fill(struct creator_softc *);
struct wsdisplay_accessops creator_accessops = {
creator_ioctl,
@@ -138,6 +145,10 @@ creator_attach(struct creator_softc *sc)
rasops_init(&sc->sc_rasops,
a2int(getpropstring(optionsnode, "screen-#rows"), 34),
a2int(getpropstring(optionsnode, "screen-#columns"), 80));
+ sc->sc_rasops.ri_hw = sc;
+ sc->sc_rasops.ri_ops.eraserows = creator_ras_eraserows;
+ sc->sc_rasops.ri_ops.erasecols = creator_ras_erasecols;
+ creator_ras_init(sc);
creator_stdscreen.nrows = sc->sc_rasops.ri_rows;
creator_stdscreen.ncols = sc->sc_rasops.ri_cols;
@@ -338,8 +349,99 @@ creator_ras_wait(sc)
ucsr = FBC_READ(sc, FFB_FBC_UCSR);
if ((ucsr & (FBC_UCSR_FB_BUSY|FBC_UCSR_RP_BUSY)) == 0)
break;
- r = ucsr & (FFB_UCSR_READ_ERR | FFB_UCSR_FIFO_OVFL);
+ r = ucsr & (FBC_UCSR_READ_ERR | FBC_UCSR_FIFO_OVFL);
if (r != 0)
FBC_WRITE(sc, FFB_FBC_UCSR, r);
}
}
+
+void
+creator_ras_init(sc)
+ struct creator_softc *sc;
+{
+}
+
+void
+creator_ras_eraserows(cookie, row, n, attr)
+ void *cookie;
+ int row, n;
+ long int attr;
+{
+ struct rasops_info *ri = cookie;
+ struct creator_softc *sc = ri->ri_hw;
+
+ if (row < 0) {
+ n += row;
+ row = 0;
+ }
+ if (row + n > ri->ri_rows)
+ n = ri->ri_rows - row;
+ if (n <= 0)
+ return;
+
+ creator_ras_fill(sc);
+ creator_ras_fifo_wait(sc, 5);
+ FBC_WRITE(sc, FFB_FBC_FG, ri->ri_devcmap[(attr >> 16) & 0xf]);
+ if ((n == ri->ri_rows) && (ri->ri_flg & RI_FULLCLEAR)) {
+ FBC_WRITE(sc, FFB_FBC_BY, 0);
+ FBC_WRITE(sc, FFB_FBC_BX, 0);
+ FBC_WRITE(sc, FFB_FBC_BH, ri->ri_height);
+ FBC_WRITE(sc, FFB_FBC_BW, ri->ri_width);
+ } else {
+ row *= ri->ri_font->fontheight;
+ FBC_WRITE(sc, FFB_FBC_BY, ri->ri_yorigin + row);
+ FBC_WRITE(sc, FFB_FBC_BX, ri->ri_xorigin);
+ FBC_WRITE(sc, FFB_FBC_BH, n * ri->ri_font->fontheight);
+ FBC_WRITE(sc, FFB_FBC_BW, ri->ri_emuwidth);
+ }
+ creator_ras_wait(sc);
+}
+
+void
+creator_ras_erasecols(cookie, row, col, n, attr)
+ void *cookie;
+ int row, col, n;
+ long int attr;
+{
+ struct rasops_info *ri = cookie;
+ struct creator_softc *sc = ri->ri_hw;
+
+ if ((row < 0) || (row >= ri->ri_rows))
+ return;
+ if (col < 0) {
+ n += col;
+ col = 0;
+ }
+ if (col + n > ri->ri_cols)
+ n = ri->ri_cols - col;
+ if (n <= 0)
+ return;
+ n *= ri->ri_font->fontwidth;
+ col *= ri->ri_font->fontwidth;
+ row *= ri->ri_font->fontheight;
+
+ creator_ras_fill(sc);
+ creator_ras_fifo_wait(sc, 5);
+ FBC_WRITE(sc, FFB_FBC_FG, ri->ri_devcmap[(attr >> 16) & 0xf]);
+ FBC_WRITE(sc, FFB_FBC_BY, ri->ri_yorigin + row);
+ FBC_WRITE(sc, FFB_FBC_BX, ri->ri_xorigin + col);
+ FBC_WRITE(sc, FFB_FBC_BH, ri->ri_font->fontheight);
+ FBC_WRITE(sc, FFB_FBC_BW, n - 1);
+ creator_ras_wait(sc);
+}
+
+void
+creator_ras_fill(sc)
+ struct creator_softc *sc;
+{
+ creator_ras_fifo_wait(sc, 5);
+ FBC_WRITE(sc, FFB_FBC_PPC,
+ FBC_PPC_VCE_DIS | FBC_PPC_TBE_OPAQUE |
+ FBC_PPC_APE_DIS | FBC_PPC_CS_CONST);
+ FBC_WRITE(sc, FFB_FBC_FBC, 0x2000707f);
+ FBC_WRITE(sc, FFB_FBC_ROP, FBC_ROP_NEW);
+ FBC_WRITE(sc, FFB_FBC_DRAWOP, FBC_DRAWOP_RECTANGLE);
+ FBC_WRITE(sc, FFB_FBC_PMASK, 0xffffffff);
+ FBC_WRITE(sc, FFB_FBC_FONTINC, 0x10000);
+ creator_ras_wait(sc);
+}
diff --git a/sys/arch/sparc64/dev/creatorreg.h b/sys/arch/sparc64/dev/creatorreg.h
index 2d174108b81..4163575659b 100644
--- a/sys/arch/sparc64/dev/creatorreg.h
+++ b/sys/arch/sparc64/dev/creatorreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: creatorreg.h,v 1.1 2002/07/26 16:39:04 jason Exp $ */
+/* $OpenBSD: creatorreg.h,v 1.2 2002/07/26 18:00:08 jason Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -72,7 +72,7 @@
#define FFB_FBC_BH 0x070
#define FFB_FBC_BW 0x074
#define FFB_FBC_SUVTX 0x100
-#define FFB_FBC_PPC 0x200
+#define FFB_FBC_PPC 0x200 /* pixel processor control */
#define FFB_FBC_WID 0x204
#define FFB_FBC_FG 0x208
#define FFB_FBC_BG 0x20c
@@ -160,8 +160,49 @@
#define FFB_FBC_UCSR 0x900
#define FFB_FBC_MER 0x980
+#define FBC_PPC_FW_DIS 0x00800000 /* force wid disable */
+#define FBC_PPC_FW_ENA 0x00c00000 /* force wid enable */
+#define FBC_PPC_ACE_DIS 0x00040000 /* aux clip disable */
+#define FBC_PPC_ACE_AUXSUB 0x00080000 /* aux clip add */
+#define FBC_PPC_ACE_AUXADD 0x000c0000 /* aux clip subtract */
+#define FBC_PPC_DCE_DIS 0x00020000 /* depth cue disable */
+#define FBC_PPC_DCE_ENA 0x00020000 /* depth cue enable */
+#define FBC_PPC_ABE_DIS 0x00008000 /* alpha blend disable */
+#define FBC_PPC_ABE_ENA 0x0000c000 /* alpha blend enable */
+#define FBC_PPC_VCE_DIS 0x00001000 /* view clip disable */
+#define FBC_PPC_VCE_2D 0x00002000 /* view clip 2d */
+#define FBC_PPC_VCE_3D 0x00003000 /* view clip 3d */
+#define FBC_PPC_APE_DIS 0x00000800 /* area pattern disable */
+#define FBC_PPC_APE_ENA 0x00000c00 /* area pattern enable */
+#define FBC_PPC_TBE_OPAQUE 0x00000200 /* opaque background */
+#define FBC_PPC_TBE_TRANSPAR 0x00000300 /* transparent background */
+#define FBC_PPC_ZS_VAR 0x00000080 /* z source ??? */
+#define FBC_PPC_ZS_CONST 0x000000c0 /* z source ??? */
+#define FBC_PPC_YS_VAR 0x00000020 /* y source ??? */
+#define FBC_PPC_YS_CONST 0x00000030 /* y source ??? */
+#define FBC_PPC_XS_WID 0x00000004 /* x source ??? */
+#define FBC_PPC_XS_VAR 0x00000008 /* x source ??? */
+#define FBC_PPC_XS_CONST 0x0000000c /* x source ??? */
+#define FBC_PPC_CS_VAR 0x00000002 /* color source ??? */
+#define FBC_PPC_CS_CONST 0x00000003 /* color source ??? */
+
+#define FBC_ROP_NEW 0x83
+
#define FBC_UCSR_FIFO_MASK 0x00000fff
#define FBC_UCSR_FB_BUSY 0x01000000
#define FBC_UCSR_RP_BUSY 0x02000000
-#define FFB_UCSR_READ_ERR 0x40000000
-#define FFB_UCSR_FIFO_OVFL 0x80000000
+#define FBC_UCSR_READ_ERR 0x40000000
+#define FBC_UCSR_FIFO_OVFL 0x80000000
+
+#define FBC_DRAWOP_DOT 0x00
+#define FBC_DRAWOP_AADOT 0x01
+#define FBC_DRAWOP_BRLINECAP 0x02
+#define FBC_DRAWOP_BRLINEOPEN 0x03
+#define FBC_DRAWOP_DDLINE 0x04
+#define FBC_DRAWOP_AALINE 0x05
+#define FBC_DRAWOP_TRIANGLE 0x06
+#define FBC_DRAWOP_POLYGON 0x07
+#define FBC_DRAWOP_RECTANGLE 0x08
+#define FBC_DRAWOP_FASTFILL 0x09
+#define FBC_DRAWOP_BCOPY 0x0a
+#define FBC_DRAWOP_VSCROLL 0x0b