summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hp300/dev/diofb.c6
-rw-r--r--sys/arch/luna88k/dev/omrasops.c4
-rw-r--r--sys/arch/sparc/dev/p9000.c6
-rw-r--r--sys/arch/sparc/dev/p9100.c6
-rw-r--r--sys/arch/sparc/dev/zx.c8
-rw-r--r--sys/arch/vax/vsa/gpx.c7
-rw-r--r--sys/arch/vax/vsa/smg.c4
-rw-r--r--sys/dev/ic/sti.c19
-rw-r--r--sys/dev/ic/vga.c46
-rw-r--r--sys/dev/isa/ega.c44
-rw-r--r--sys/dev/isa/pcdisplay.c23
-rw-r--r--sys/dev/pci/tga.c9
-rw-r--r--sys/dev/pcmcia/cfxga.c13
-rw-r--r--sys/dev/rasops/rasops.c8
-rw-r--r--sys/dev/rasops/rasops.h3
-rw-r--r--sys/dev/sbus/zx.c8
-rw-r--r--sys/dev/wscons/wsdisplayvar.h16
17 files changed, 170 insertions, 60 deletions
diff --git a/sys/arch/hp300/dev/diofb.c b/sys/arch/hp300/dev/diofb.c
index 2716ff48d48..908e1771c28 100644
--- a/sys/arch/hp300/dev/diofb.c
+++ b/sys/arch/hp300/dev/diofb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diofb.c,v 1.15 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: diofb.c,v 1.16 2006/11/29 19:08:19 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -377,7 +377,7 @@ diofb_erasecols(void *cookie, int row, int col, int num, long attr)
int fg, bg;
int snum, scol, srow;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
snum = num * ri->ri_font->fontwidth;
scol = col * ri->ri_font->fontwidth + ri->ri_xorigin;
@@ -401,7 +401,7 @@ diofb_eraserows(void *cookie, int row, int num, long attr)
int srow, snum;
int rc;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
bg ^= 0xff;
if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR)) {
diff --git a/sys/arch/luna88k/dev/omrasops.c b/sys/arch/luna88k/dev/omrasops.c
index 9a71a3c3013..8aeea17eb50 100644
--- a/sys/arch/luna88k/dev/omrasops.c
+++ b/sys/arch/luna88k/dev/omrasops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omrasops.c,v 1.3 2006/08/06 13:04:33 miod Exp $ */
+/* $OpenBSD: omrasops.c,v 1.4 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: omrasops.c,v 1.1 2000/01/05 08:48:56 nisimura Exp $ */
/*-
@@ -94,7 +94,7 @@ om_putchar(cookie, row, startcol, uc, attr)
height = ri->ri_font->fontheight;
fb = ri->ri_font->data +
(uc - ri->ri_font->firstchar) * ri->ri_fontscale;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
inverse = (bg != 0) ? ALL1BITS : ALL0BITS;
p = (caddr_t)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
diff --git a/sys/arch/sparc/dev/p9000.c b/sys/arch/sparc/dev/p9000.c
index 4dcf1581044..add708c2e8f 100644
--- a/sys/arch/sparc/dev/p9000.c
+++ b/sys/arch/sparc/dev/p9000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p9000.c,v 1.16 2006/06/02 20:00:54 miod Exp $ */
+/* $OpenBSD: p9000.c,v 1.17 2006/11/29 19:08:22 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -610,7 +610,7 @@ p9000_ras_erasecols(void *v, int row, int col, int n, long int attr)
struct p9000_softc *sc = ri->ri_hw;
int fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(v, attr, &fg, &bg, NULL);
n *= ri->ri_font->fontwidth;
col *= ri->ri_font->fontwidth;
@@ -642,7 +642,7 @@ p9000_ras_eraserows(void *v, int row, int n, long int attr)
struct p9000_softc *sc = ri->ri_hw;
int fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(v, attr, &fg, &bg, NULL);
p9000_drain(sc);
P9000_SELECT_DE_LOW(sc);
diff --git a/sys/arch/sparc/dev/p9100.c b/sys/arch/sparc/dev/p9100.c
index 46de9ea3865..793e4d3e08d 100644
--- a/sys/arch/sparc/dev/p9100.c
+++ b/sys/arch/sparc/dev/p9100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p9100.c,v 1.39 2006/06/02 20:00:54 miod Exp $ */
+/* $OpenBSD: p9100.c,v 1.40 2006/11/29 19:08:22 miod Exp $ */
/*
* Copyright (c) 2003, 2005, Miodrag Vallat.
@@ -714,7 +714,7 @@ p9100_ras_erasecols(void *v, int row, int col, int n, long int attr)
struct p9100_softc *sc = ri->ri_hw;
int fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(v, attr, &fg, &bg, NULL);
n *= ri->ri_font->fontwidth;
col *= ri->ri_font->fontwidth;
@@ -746,7 +746,7 @@ p9100_ras_eraserows(void *v, int row, int n, long int attr)
struct p9100_softc *sc = ri->ri_hw;
int fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(v, attr, &fg, &bg, NULL);
p9100_drain(sc);
P9100_SELECT_DE_LOW(sc);
diff --git a/sys/arch/sparc/dev/zx.c b/sys/arch/sparc/dev/zx.c
index 8dbf65485ce..d792a6aa3a3 100644
--- a/sys/arch/sparc/dev/zx.c
+++ b/sys/arch/sparc/dev/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.15 2006/06/02 20:00:54 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.16 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -556,7 +556,7 @@ zx_fillrect(struct rasops_info *ri, int x, int y, int w, int h, long attr,
zc = sc->sc_zc;
zd = sc->sc_zd_ss0;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, NULL);
x = x * ri->ri_font->fontwidth + ri->ri_xorigin;
y = y * ri->ri_font->fontheight + ri->ri_yorigin;
w = ri->ri_font->fontwidth * w - 1;
@@ -644,7 +644,7 @@ zx_eraserows(void *cookie, int row, int num, long attr)
zc = sc->sc_zc;
zd = sc->sc_zd_ss0;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
while ((zc->zc_csr & ZX_CSR_BLT_BUSY) != 0)
;
@@ -692,7 +692,7 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
ri = (struct rasops_info *)cookie;
font = ri->ri_font;
- rasops_unpack_attr(attr, &fg, &bg, &ul);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, &ul);
dp = (volatile u_int32_t *)ri->ri_bits +
ZX_COORDS(col * font->fontwidth, row * font->fontheight);
diff --git a/sys/arch/vax/vsa/gpx.c b/sys/arch/vax/vsa/gpx.c
index 7e8bc47b617..b39e1f6c652 100644
--- a/sys/arch/vax/vsa/gpx.c
+++ b/sys/arch/vax/vsa/gpx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gpx.c,v 1.15 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: gpx.c,v 1.16 2006/11/29 19:08:22 miod Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
@@ -503,7 +503,7 @@ gpx_putchar(void *v, int row, int col, u_int uc, long attr)
struct wsdisplay_font *font = ri->ri_font;
int dx, dy, sx, sy, fg, bg, ul;
- rasops_unpack_attr(attr, &fg, &bg, &ul);
+ ri->ri_ops.unpack_attr(v, attr, &fg, &bg, &ul);
/* find where to output the glyph... */
dx = col * font->fontwidth + ri->ri_xorigin;
@@ -1063,9 +1063,10 @@ void
gpx_fillrect(struct gpx_screen *ss, int x, int y, int dx, int dy, long attr,
u_int function)
{
+ struct rasops_info *ri = &ss->ss_ri;
int fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, NULL);
while (gpx_viper_write(ss, CS_UPDATE_MASK, 0x00ff));
gpx_viper_write(ss, MASK_1, 0xffff);
diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c
index 2c7a288b627..67c66093edb 100644
--- a/sys/arch/vax/vsa/smg.c
+++ b/sys/arch/vax/vsa/smg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smg.c,v 1.18 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: smg.c,v 1.19 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */
/*
* Copyright (c) 2006, Miodrag Vallat
@@ -796,7 +796,7 @@ smg_erasecols(void *cookie, int row, int col, int num, long attr)
struct rasops_info *ri = cookie;
int fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
num *= ri->ri_font->fontwidth;
col *= ri->ri_font->fontwidth;
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
index 3e93b4821cb..baa164462ff 100644
--- a/sys/dev/ic/sti.c
+++ b/sys/dev/ic/sti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti.c,v 1.46 2006/11/29 12:15:27 miod Exp $ */
+/* $OpenBSD: sti.c,v 1.47 2006/11/29 19:08:22 miod Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -60,7 +60,8 @@ void sti_copycols(void *v, int row, int srccol, int dstcol, int ncols);
void sti_erasecols(void *v, int row, int startcol, int ncols, long attr);
void sti_copyrows(void *v, int srcrow, int dstrow, int nrows);
void sti_eraserows(void *v, int row, int nrows, long attr);
-int sti_alloc_attr(void *v, int fg, int bg, int flags, long *);
+int sti_alloc_attr(void *v, int fg, int bg, int flags, long *pattr);
+void sti_unpack_attr(void *v, long attr, int *fg, int *bg, int *ul);
struct wsdisplay_emulops sti_emulops = {
sti_cursor,
@@ -70,7 +71,8 @@ struct wsdisplay_emulops sti_emulops = {
sti_erasecols,
sti_copyrows,
sti_eraserows,
- sti_alloc_attr
+ sti_alloc_attr,
+ sti_unpack_attr
};
int sti_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p);
@@ -95,7 +97,7 @@ struct wsscreen_descr sti_default_screen = {
"default", 0, 0,
&sti_emulops,
0, 0,
- WSSCREEN_REVERSE | WSSCREEN_UNDERLINE
+ 0
};
const struct wsscreen_descr *sti_default_scrlist[] = {
@@ -1035,6 +1037,15 @@ sti_alloc_attr(v, fg, bg, flags, pattr)
return 0;
}
+void
+sti_unpack_attr(void *v, long attr, int *fg, int *bg, int *ul)
+{
+ *fg = WSCOL_WHITE;
+ *bg = WSCOL_BLACK;
+ if (ul != NULL)
+ *ul = 0;
+}
+
/*
* Console support
*/
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c
index c5489d3df46..d6a58b4b81d 100644
--- a/sys/dev/ic/vga.c
+++ b/sys/dev/ic/vga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga.c,v 1.40 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: vga.c,v 1.41 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */
/*
@@ -102,6 +102,7 @@ int vga_mapchar(void *, int, unsigned int *);
void vga_putchar(void *, int, int, u_int, long);
int vga_alloc_attr(void *, int, int, int, long *);
void vga_copyrows(void *, int, int, int);
+void vga_unpack_attr(void *, long, int *, int *, int *);
static const struct wsdisplay_emulops vga_emulops = {
pcdisplay_cursor,
@@ -111,13 +112,14 @@ static const struct wsdisplay_emulops vga_emulops = {
pcdisplay_erasecols,
vga_copyrows,
pcdisplay_eraserows,
- vga_alloc_attr
+ vga_alloc_attr,
+ vga_unpack_attr
};
/*
* translate WS(=ANSI) color codes to standard pc ones
*/
-static unsigned char fgansitopc[] = {
+static const unsigned char fgansitopc[] = {
#ifdef __alpha__
/*
* XXX DEC HAS SWITCHED THE CODES FOR BLUE AND RED!!!
@@ -140,6 +142,20 @@ static unsigned char fgansitopc[] = {
#endif
};
+/*
+ * translate standard pc color codes to WS(=ANSI) ones
+ */
+static const u_int8_t pctoansi[] = {
+#ifdef __alpha__
+ WSCOL_BLACK, WSCOL_RED, WSCOL_GREEN, WSCOL_BROWN,
+ WSCOL_BLUE, WSCOL_MAGENTA, WSCOL_CYAN, WSCOL_WHITE
+#else
+ WSCOL_BLACK, WSCOL_BLUE, WSCOL_GREEN, WSCOL_CYAN,
+ WSCOL_RED, WSCOL_MAGENTA, WSCOL_BROWN, WSCOL_WHITE
+#endif
+};
+
+
const struct wsscreen_descr vga_stdscreen = {
"80x25", 80, 25,
&vga_emulops,
@@ -980,6 +996,30 @@ vga_alloc_attr(id, fg, bg, flags, attrp)
}
void
+vga_unpack_attr(id, attr, fg, bg, ul)
+ void *id;
+ long attr;
+ int *fg, *bg, *ul;
+{
+ struct vgascreen *scr = id;
+ struct vga_config *vc = scr->cfg;
+
+ if (vc->hdl.vh_mono) {
+ *fg = (attr & 0x07) == 0x07 ? WSCOL_WHITE : WSCOL_BLACK;
+ *bg = attr & 0x70 ? WSCOL_WHITE : WSCOL_BLACK;
+ if (ul != NULL)
+ *ul = *fg != WSCOL_WHITE && (attr & 0x01) ? 1 : 0;
+ } else {
+ *fg = pctoansi[attr & 0x07];
+ *bg = pctoansi[(attr & 0x70) >> 4];
+ if (*ul != NULL)
+ *ul = 0;
+ }
+ if (attr & FG_INTENSE)
+ *fg += 8;
+}
+
+void
vga_copyrows(id, srcrow, dstrow, nrows)
void *id;
int srcrow, dstrow, nrows;
diff --git a/sys/dev/isa/ega.c b/sys/dev/isa/ega.c
index 4be901605cb..3777e5a3f51 100644
--- a/sys/dev/isa/ega.c
+++ b/sys/dev/isa/ega.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ega.c,v 1.9 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: ega.c,v 1.10 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: ega.c,v 1.4.4.1 2000/06/30 16:27:47 simonb Exp $ */
/*
@@ -112,6 +112,7 @@ static void ega_init(struct ega_config *,
bus_space_tag_t, bus_space_tag_t, int);
static void ega_setfont(struct ega_config *, struct egascreen *);
static int ega_alloc_attr(void *, int, int, int, long *);
+static void ega_unpack_attr(void *, long, int *, int *, int *);
void ega_copyrows(void *, int, int, int);
struct cfattach ega_ca = {
@@ -130,13 +131,14 @@ const struct wsdisplay_emulops ega_emulops = {
pcdisplay_erasecols,
ega_copyrows,
pcdisplay_eraserows,
- ega_alloc_attr
+ ega_alloc_attr,
+ ega_unpack_attr
};
/*
* translate WS(=ANSI) color codes to standard pc ones
*/
-static unsigned char fgansitopc[] = {
+static const unsigned char fgansitopc[] = {
FG_BLACK, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE,
FG_MAGENTA, FG_CYAN, FG_LIGHTGREY
}, bgansitopc[] = {
@@ -144,6 +146,18 @@ static unsigned char fgansitopc[] = {
BG_MAGENTA, BG_CYAN, BG_LIGHTGREY
};
+/*
+ * translate standard pc color codes to WS(=ANSI) ones
+ */
+static const u_int8_t pctoansi[] = {
+#ifdef __alpha__
+ WSCOL_BLACK, WSCOL_RED, WSCOL_GREEN, WSCOL_BROWN,
+ WSCOL_BLUE, WSCOL_MAGENTA, WSCOL_CYAN, WSCOL_WHITE
+#else
+ WSCOL_BLACK, WSCOL_BLUE, WSCOL_GREEN, WSCOL_CYAN,
+ WSCOL_RED, WSCOL_MAGENTA, WSCOL_BROWN, WSCOL_WHITE
+#endif
+};
const struct wsscreen_descr ega_stdscreen = {
"80x25", 80, 25,
&ega_emulops,
@@ -886,6 +900,30 @@ ega_alloc_attr(id, fg, bg, flags, attrp)
}
void
+ega_unpack_attr(id, attr, fg, bg, ul)
+ void *id;
+ long attr;
+ int *fg, *bg, *ul;
+{
+ struct egascreen *scr = id;
+ struct ega_config *vc = scr->cfg;
+
+ if (vc->hdl.vh_mono) {
+ *fg = (attr & 0x07) == 0x07 ? WSCOL_WHITE : WSCOL_BLACK;
+ *bg = attr & 0x70 ? WSCOL_WHITE : WSCOL_BLACK;
+ if (ul != NULL)
+ *ul = *fg != WSCOL_WHITE && (attr & 0x01) ? 1 : 0;
+ } else {
+ *fg = pctoansi[attr & 0x07];
+ *bg = pctoansi[(attr & 0x70) >> 4];
+ if (*ul != NULL)
+ *ul = 0;
+ }
+ if (attr & FG_INTENSE)
+ *fg += 8;
+}
+
+void
ega_copyrows(id, srcrow, dstrow, nrows)
void *id;
int srcrow, dstrow, nrows;
diff --git a/sys/dev/isa/pcdisplay.c b/sys/dev/isa/pcdisplay.c
index d39d4316ada..3a35f1fe1b7 100644
--- a/sys/dev/isa/pcdisplay.c
+++ b/sys/dev/isa/pcdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcdisplay.c,v 1.8 2006/11/29 12:13:54 miod Exp $ */
+/* $OpenBSD: pcdisplay.c,v 1.9 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: pcdisplay.c,v 1.9.4.1 2000/06/30 16:27:48 simonb Exp $ */
/*
@@ -71,6 +71,7 @@ static void pcdisplay_init(struct pcdisplay_config *,
bus_space_tag_t, bus_space_tag_t,
int);
static int pcdisplay_alloc_attr(void *, int, int, int, long *);
+static void pcdisplay_unpack_attr(void *, long, int *, int *, int *);
struct cfattach pcdisplay_ca = {
sizeof(struct pcdisplay_softc), pcdisplay_match, pcdisplay_attach,
@@ -84,7 +85,8 @@ const struct wsdisplay_emulops pcdisplay_emulops = {
pcdisplay_erasecols,
pcdisplay_copyrows,
pcdisplay_eraserows,
- pcdisplay_alloc_attr
+ pcdisplay_alloc_attr,
+ pcdisplay_unpack_attr
};
const struct wsscreen_descr pcdisplay_scr = {
@@ -416,6 +418,23 @@ pcdisplay_alloc_attr(id, fg, bg, flags, attrp)
return (0);
}
+static void
+pcdisplay_unpack_attr(id, attr, fg, bg, ul)
+ void *id;
+ long attr;
+ int *fg, *bg, *ul;
+{
+ if (attr == (FG_BLACK | BG_LIGHTGREY)) {
+ *fg = WSCOL_BLACK;
+ *bg = WSCOL_WHITE;
+ } else {
+ *fg = WSCOL_WHITE;
+ *bg = WSCOL_BLACK;
+ }
+ if (ul != NULL)
+ *ul = 0;
+}
+
struct cfdriver pcdisplay_cd = {
NULL, "pcdisplay", DV_DULL
};
diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c
index 80d6ed8b7c5..53ae8af10c4 100644
--- a/sys/dev/pci/tga.c
+++ b/sys/dev/pci/tga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tga.c,v 1.27 2006/11/29 12:13:55 miod Exp $ */
+/* $OpenBSD: tga.c,v 1.28 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */
/*
@@ -132,6 +132,7 @@ struct wsdisplay_emulops tga_emulops = {
tga_copyrows,
tga_eraserows,
NULL,
+ NULL
};
struct wsscreen_descr tga_stdscreen = {
@@ -1277,7 +1278,7 @@ tga_putchar(c, row, col, uc, attr)
* The rasops code has already expanded the color entry to 32 bits
* for us, even for 8-bit displays, so we don't have to do anything.
*/
- rasops_unpack_attr(attr, &fg, &bg, &ul);
+ ri->ri_ops.unpack_attr(c, attr, &fg, &bg, &ul);
TGAWREG(dc, TGA_REG_GFGR, ri->ri_devcmap[fg]);
TGAWREG(dc, TGA_REG_GBGR, ri->ri_devcmap[bg]);
@@ -1328,7 +1329,7 @@ tga_eraserows(c, row, num, attr)
int fg, bg;
int32_t *rp;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(c, attr, &fg, &bg, NULL);
color = ri->ri_devcmap[bg];
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale);
lines = num * ri->ri_font->fontheight;
@@ -1384,7 +1385,7 @@ tga_erasecols (c, row, col, num, attr)
int fg, bg;
int32_t *rp;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(c, attr, &fg, &bg, NULL);
color = ri->ri_devcmap[bg];
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
lines = ri->ri_font->fontheight;
diff --git a/sys/dev/pcmcia/cfxga.c b/sys/dev/pcmcia/cfxga.c
index 4424a96f46d..66f20ef08bd 100644
--- a/sys/dev/pcmcia/cfxga.c
+++ b/sys/dev/pcmcia/cfxga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfxga.c,v 1.12 2006/11/29 12:13:55 miod Exp $ */
+/* $OpenBSD: cfxga.c,v 1.13 2006/11/29 19:08:22 miod Exp $ */
/*
* Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat
@@ -865,7 +865,7 @@ cfxga_expand_char(struct cfxga_screen *scr, u_int uc, int x, int y, long attr)
pos = (y * ri->ri_width + x) * ri->ri_depth / 8;
fontbits = (u_int8_t *)(font->data + (uc - font->firstchar) *
ri->ri_fontscale);
- rasops_unpack_attr(attr, &fg, &bg, &ul);
+ ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, &ul);
/* Wait for previous operations to complete */
if ((rc = cfxga_synchronize(sc)) != 0)
@@ -959,7 +959,8 @@ cfxga_repaint_screen(struct cfxga_screen *scr)
for (lx = 0, x = ri->ri_xorigin; lx < ri->ri_cols;
lx++, x += cx) {
if (cell->uc == 0 || cell->uc == ' ') {
- rasops_unpack_attr(cell->attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(ri, cell->attr,
+ &fg, &bg, NULL);
rc = cfxga_solid_fill(scr, x, y, cx, cy,
ri->ri_devcmap[bg]);
} else {
@@ -1137,7 +1138,7 @@ cfxga_erasecols(void *cookie, int row, int col, int num, long attr)
if (scr != scr->scr_sc->sc_active)
return;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
x = col * ri->ri_font->fontwidth + ri->ri_xorigin;
y = row * ri->ri_font->fontheight + ri->ri_yorigin;
cx = num * ri->ri_font->fontwidth;
@@ -1166,7 +1167,7 @@ cfxga_eraserows(void *cookie, int row, int num, long attr)
if (scr != scr->scr_sc->sc_active)
return;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
x = ri->ri_xorigin;
y = row * ri->ri_font->fontheight + ri->ri_yorigin;
cx = ri->ri_emuwidth;
@@ -1193,7 +1194,7 @@ cfxga_putchar(void *cookie, int row, int col, u_int uc, long attr)
if (uc == ' ') {
int cx, cy, fg, bg;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
cx = ri->ri_font->fontwidth;
cy = ri->ri_font->fontheight;
cfxga_solid_fill(scr, x, y, cx, cy, ri->ri_devcmap[bg]);
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c
index 4f73593796c..7e2ca53c5ac 100644
--- a/sys/dev/rasops/rasops.c
+++ b/sys/dev/rasops/rasops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rasops.c,v 1.14 2006/03/10 20:03:38 miod Exp $ */
+/* $OpenBSD: rasops.c,v 1.15 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $ */
/*-
@@ -146,6 +146,7 @@ int rasops_alloc_cattr(void *, int, int, int, long *);
int rasops_alloc_mattr(void *, int, int, int, long *);
void rasops_do_cursor(struct rasops_info *);
void rasops_init_devcmap(struct rasops_info *);
+void rasops_unpack_attr(void *, long, int *, int *, int *);
#if NRASOPS_ROTATION > 0
void rasops_copychar(void *, int, int, int, int);
@@ -347,6 +348,7 @@ rasops_reconfig(ri, wantrows, wantcols)
ri->ri_ops.erasecols = rasops_erasecols;
ri->ri_ops.eraserows = rasops_eraserows;
ri->ri_ops.cursor = rasops_cursor;
+ ri->ri_ops.unpack_attr = rasops_unpack_attr;
ri->ri_do_cursor = rasops_do_cursor;
ri->ri_updatecursor = NULL;
@@ -808,11 +810,11 @@ rasops_init_devcmap(ri)
* Unpack a rasops attribute
*/
void
-rasops_unpack_attr(attr, fg, bg, underline)
+rasops_unpack_attr(cookie, attr, fg, bg, underline)
+ void *cookie;
long attr;
int *fg, *bg, *underline;
{
-
*fg = ((u_int)attr >> 24) & 0xf;
*bg = ((u_int)attr >> 16) & 0xf;
if (underline != NULL)
diff --git a/sys/dev/rasops/rasops.h b/sys/dev/rasops/rasops.h
index a26db058326..35fc997b44c 100644
--- a/sys/dev/rasops/rasops.h
+++ b/sys/dev/rasops/rasops.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rasops.h,v 1.7 2005/09/15 20:23:10 miod Exp $ */
+/* $OpenBSD: rasops.h,v 1.8 2006/11/29 19:08:22 miod Exp $ */
/* $NetBSD: rasops.h,v 1.13 2000/06/13 13:36:54 ad Exp $ */
/*-
@@ -152,7 +152,6 @@ void rasops32_init(struct rasops_info *);
/* rasops.c */
int rasops_init(struct rasops_info *, int, int);
int rasops_reconfig(struct rasops_info *, int, int);
-void rasops_unpack_attr(long, int *, int *, int *);
void rasops_eraserows(void *, int, int, long);
void rasops_erasecols(void *, int, int, int, long);
diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c
index bc8c19e5749..73776e4c8c8 100644
--- a/sys/dev/sbus/zx.c
+++ b/sys/dev/sbus/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.8 2006/06/02 20:00:56 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.9 2006/11/29 19:08:23 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -615,7 +615,7 @@ zx_fillrect(struct rasops_info *ri, int x, int y, int w, int h, long attr,
zc = sc->sc_zc;
zd = sc->sc_zd_ss0;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(ri, attr, &fg, &bg, NULL);
x = x * ri->ri_font->fontwidth + ri->ri_xorigin;
y = y * ri->ri_font->fontheight + ri->ri_yorigin;
w = ri->ri_font->fontwidth * w - 1;
@@ -703,7 +703,7 @@ zx_eraserows(void *cookie, int row, int num, long attr)
zc = sc->sc_zc;
zd = sc->sc_zd_ss0;
- rasops_unpack_attr(attr, &fg, &bg, NULL);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
while ((zc->zc_csr & ZX_CSR_BLT_BUSY) != 0)
;
@@ -751,7 +751,7 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
ri = (struct rasops_info *)cookie;
font = ri->ri_font;
- rasops_unpack_attr(attr, &fg, &bg, &ul);
+ ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, &ul);
dp = (volatile u_int32_t *)ri->ri_bits +
ZX_COORDS(col * font->fontwidth, row * font->fontheight);
diff --git a/sys/dev/wscons/wsdisplayvar.h b/sys/dev/wscons/wsdisplayvar.h
index 09357bc337d..c514e942638 100644
--- a/sys/dev/wscons/wsdisplayvar.h
+++ b/sys/dev/wscons/wsdisplayvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplayvar.h,v 1.19 2006/11/29 12:13:55 miod Exp $ */
+/* $OpenBSD: wsdisplayvar.h,v 1.20 2006/11/29 19:08:23 miod Exp $ */
/* $NetBSD: wsdisplayvar.h,v 1.30 2005/02/04 02:10:49 perry Exp $ */
/*
@@ -55,16 +55,14 @@ struct device;
struct wsdisplay_emulops {
void (*cursor)(void *c, int on, int row, int col);
int (*mapchar)(void *, int, unsigned int *);
- void (*putchar)(void *c, int row, int col,
- u_int uc, long attr);
+ void (*putchar)(void *c, int row, int col, u_int uc, long attr);
void (*copycols)(void *c, int row, int srccol, int dstcol,
int ncols);
- void (*erasecols)(void *c, int row, int startcol,
- int ncols, long);
- void (*copyrows)(void *c, int srcrow, int dstrow,
- int nrows);
- void (*eraserows)(void *c, int row, int nrows, long);
- int (*alloc_attr)(void *c, int fg, int bg, int flags, long *);
+ void (*erasecols)(void *c, int row, int startcol, int ncols, long);
+ void (*copyrows)(void *c, int srcrow, int dstrow, int nrows);
+ void (*eraserows)(void *c, int row, int nrows, long attr);
+ int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
+ void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
/* fg / bg values. Made identical to ANSI terminal color codes. */
/* XXX should be #if NWSEMUL_SUN > 1 */
#if defined(__sparc__) || defined(__sparc64__)