summaryrefslogtreecommitdiff
path: root/sys/dev/rasops
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2006-02-18 13:57:33 +0000
committerjmcneill <jmcneill@NetBSD.org>2006-02-18 13:57:33 +0000
commit4f186b3e0d4ebf46c923ac91f8253df6dfd24e9e (patch)
tree33b3f2341e1b9b5b7755101071d41189229b6d32 /sys/dev/rasops
parent2fdbc8bd5fc2351a310e1e0fc9c68a8e60c57e64 (diff)
Add shadow framebuffer support.
Diffstat (limited to 'sys/dev/rasops')
-rw-r--r--sys/dev/rasops/rasops.c194
-rw-r--r--sys/dev/rasops/rasops.h8
-rw-r--r--sys/dev/rasops/rasops15.c122
-rw-r--r--sys/dev/rasops/rasops32.c32
-rw-r--r--sys/dev/rasops/rasops8.c99
5 files changed, 396 insertions, 59 deletions
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c
index c53f38bc6e5..4ba95acb772 100644
--- a/sys/dev/rasops/rasops.c
+++ b/sys/dev/rasops/rasops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.50 2006/01/29 21:42:41 dsl Exp $ */
+/* $NetBSD: rasops.c,v 1.51 2006/02/18 13:57:33 jmcneill Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.50 2006/01/29 21:42:41 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.51 2006/02/18 13:57:33 jmcneill Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@@ -466,11 +466,13 @@ rasops_copyrows(cookie, src, dst, num)
void *cookie;
int src, dst, num;
{
- int32_t *sp, *dp, *srp, *drp;
+ int32_t *sp, *dp, *hp, *srp, *drp, *hrp;
struct rasops_info *ri;
int n8, n1, cnt, delta;
+ int i;
ri = (struct rasops_info *)cookie;
+ hp = hrp = NULL;
#ifdef RASOPS_CLIPPING
if (dst == src)
@@ -503,36 +505,50 @@ rasops_copyrows(cookie, src, dst, num)
if (dst < src) {
srp = (int32_t *)(ri->ri_bits + src * ri->ri_yscale);
drp = (int32_t *)(ri->ri_bits + dst * ri->ri_yscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + dst *
+ ri->ri_yscale);
delta = ri->ri_stride;
} else {
src = ri->ri_font->fontheight * src + num - 1;
dst = ri->ri_font->fontheight * dst + num - 1;
srp = (int32_t *)(ri->ri_bits + src * ri->ri_stride);
drp = (int32_t *)(ri->ri_bits + dst * ri->ri_stride);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + dst *
+ ri->ri_stride);
+
delta = -ri->ri_stride;
}
while (num--) {
dp = drp;
sp = srp;
+ if (ri->ri_hwbits)
+ hp = hrp;
+
DELTA(drp, delta, int32_t *);
DELTA(srp, delta, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, delta, int32_t *);
for (cnt = n8; cnt; cnt--) {
- dp[0] = sp[0];
- dp[1] = sp[1];
- dp[2] = sp[2];
- dp[3] = sp[3];
- dp[4] = sp[4];
- dp[5] = sp[5];
- dp[6] = sp[6];
- dp[7] = sp[7];
+ for (i = 0; i < 8; i++) {
+ dp[i] = sp[i];
+ if (ri->ri_hwbits)
+ hp[i] = sp[i];
+ }
dp += 8;
sp += 8;
+ if (ri->ri_hwbits)
+ hp += 8;
}
- for (cnt = n1; cnt; cnt--)
+ for (cnt = n1; cnt; cnt--) {
*dp++ = *sp++;
+ if (ri->ri_hwbits)
+ *hp++ = *(sp - 1);
+ }
}
}
@@ -548,10 +564,11 @@ rasops_copycols(cookie, row, src, dst, num)
int row, src, dst, num;
{
struct rasops_info *ri;
- u_char *sp, *dp;
+ u_char *sp, *dp, *hp;
int height;
ri = (struct rasops_info *)cookie;
+ hp = NULL;
#ifdef RASOPS_CLIPPING
if (dst == src)
@@ -587,9 +604,15 @@ rasops_copycols(cookie, row, src, dst, num)
sp = ri->ri_bits + row + src * ri->ri_xscale;
dp = ri->ri_bits + row + dst * ri->ri_xscale;
+ if (ri->ri_hwbits)
+ hp = ri->ri_hwbits + row + dst * ri->ri_xscale;
while (height--) {
memmove(dp, sp, num);
+ if (ri->ri_hwbits) {
+ memcpy(hp, sp, num);
+ hp += ri->ri_stride;
+ }
dp += ri->ri_stride;
sp += ri->ri_stride;
}
@@ -733,9 +756,11 @@ rasops_eraserows(cookie, row, num, attr)
{
struct rasops_info *ri;
int np, nw, cnt, delta;
- int32_t *dp, clr;
+ int32_t *dp, *hp, clr;
+ int i;
ri = (struct rasops_info *)cookie;
+ hp = NULL;
#ifdef RASOPS_CLIPPING
if (row < 0) {
@@ -763,34 +788,44 @@ rasops_eraserows(cookie, row, num, attr)
nw = (ri->ri_stride >> 2) & 7;
num = ri->ri_height;
dp = (int32_t *)ri->ri_origbits;
+ if (ri->ri_hwbits)
+ hp = (int32_t *)ri->ri_hwbits;
delta = 0;
} else {
np = ri->ri_emustride >> 5;
nw = (ri->ri_emustride >> 2) & 7;
num *= ri->ri_font->fontheight;
dp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale);
+ if (ri->ri_hwbits)
+ hp = (int32_t *)(ri->ri_hwbits + row *
+ ri->ri_yscale);
delta = ri->ri_delta;
}
while (num--) {
for (cnt = np; cnt; cnt--) {
- dp[0] = clr;
- dp[1] = clr;
- dp[2] = clr;
- dp[3] = clr;
- dp[4] = clr;
- dp[5] = clr;
- dp[6] = clr;
- dp[7] = clr;
+ for (i = 0; i < 8; i++) {
+ dp[i] = clr;
+ if (ri->ri_hwbits)
+ hp[i] = clr;
+ }
dp += 8;
+ if (ri->ri_hwbits)
+ hp += 8;
}
for (cnt = nw; cnt; cnt--) {
*(int32_t *)dp = clr;
DELTA(dp, 4, int32_t *);
+ if (ri->ri_hwbits) {
+ *(int32_t *)hp = clr;
+ DELTA(hp, 4, int32_t *);
+ }
}
DELTA(dp, delta, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hp, delta, int32_t *);
}
}
@@ -803,12 +838,17 @@ rasops_do_cursor(ri)
struct rasops_info *ri;
{
int full1, height, cnt, slop1, slop2, row, col;
- u_char *dp, *rp;
+ u_char *dp, *rp, *hrp, *hp;
+
+ hrp = hp = NULL;
row = ri->ri_crow;
col = ri->ri_ccol;
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
+ if (ri->ri_hwbits)
+ hrp = ri->ri_hwbits + row * ri->ri_yscale + col
+ * ri->ri_xscale;
height = ri->ri_font->fontheight;
slop1 = (4 - ((long)rp & 3)) & 3;
@@ -823,10 +863,18 @@ rasops_do_cursor(ri)
while (height--) {
dp = rp;
rp += ri->ri_stride;
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ hrp += ri->ri_stride;
+ }
for (cnt = full1; cnt; cnt--) {
*(int32_t *)dp ^= ~0;
dp += 4;
+ if (ri->ri_hwbits) {
+ *(int32_t *)hp ^= ~0;
+ hp += 4;
+ }
}
}
} else {
@@ -834,25 +882,46 @@ rasops_do_cursor(ri)
while (height--) {
dp = rp;
rp += ri->ri_stride;
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ hrp += ri->ri_stride;
+ }
- if (slop1 & 1)
+ if (slop1 & 1) {
*dp++ ^= ~0;
+ if (ri->ri_hwbits)
+ *hp++ ^= ~0;
+ }
if (slop1 & 2) {
*(int16_t *)dp ^= ~0;
dp += 2;
+ if (ri->ri_hwbits) {
+ *(int16_t *)hp ^= ~0;
+ hp += 2;
+ }
}
for (cnt = full1; cnt; cnt--) {
*(int32_t *)dp ^= ~0;
dp += 4;
+ if (ri->ri_hwbits) {
+ *(int32_t *)hp ^= ~0;
+ hp += 4;
+ }
}
- if (slop2 & 1)
+ if (slop2 & 1) {
*dp++ ^= ~0;
+ if (ri->ri_hwbits)
+ *hp++ ^= ~0;
+ }
- if (slop2 & 2)
+ if (slop2 & 2) {
*(int16_t *)dp ^= ~0;
+ if (ri->ri_hwbits)
+ *(int16_t *)hp ^= ~0;
+ }
}
}
}
@@ -868,9 +937,11 @@ rasops_erasecols(cookie, row, col, num, attr)
{
int n8, height, cnt, slop1, slop2, clr;
struct rasops_info *ri;
- int32_t *rp, *dp;
+ int32_t *rp, *dp, *hrp, *hp;
+ int i;
ri = (struct rasops_info *)cookie;
+ hrp = hp = NULL;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows)
@@ -890,6 +961,9 @@ rasops_erasecols(cookie, row, col, num, attr)
num = num * ri->ri_xscale;
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
clr = ri->ri_devcmap[(attr >> 16) & 0xf];
@@ -902,9 +976,16 @@ rasops_erasecols(cookie, row, col, num, attr)
while (height--) {
dp = rp;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
- for (cnt = num; cnt; cnt--)
+ for (cnt = num; cnt; cnt--) {
*dp++ = clr;
+ if (ri->ri_hwbits)
+ *hp++ = clr;
+ }
}
} else if (((num | ri->ri_xscale) & 1) == 0) {
/*
@@ -916,20 +997,36 @@ rasops_erasecols(cookie, row, col, num, attr)
while (height--) {
dp = rp;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
for (cnt = num; cnt; cnt--) {
*(int16_t *)dp = clr;
DELTA(dp, 2, int32_t *);
+ if (ri->ri_hwbits) {
+ *(int16_t *)hp = clr;
+ DELTA(hp, 2, int32_t *);
+ }
}
}
} else {
while (height--) {
dp = rp;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
for (cnt = num; cnt; cnt--) {
*(u_char *)dp = clr;
DELTA(dp, 1, int32_t *);
+ if (ri->ri_hwbits) {
+ *(u_char *)hp = clr;
+ DELTA(hp, 1, int32_t *);
+ }
}
}
}
@@ -946,42 +1043,63 @@ rasops_erasecols(cookie, row, col, num, attr)
while (height--) {
dp = rp;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
/* Align span to 4 bytes */
if (slop1 & 1) {
*(u_char *)dp = clr;
DELTA(dp, 1, int32_t *);
+ if (ri->ri_hwbits) {
+ *(u_char *)hp = clr;
+ DELTA(hp, 1, int32_t *);
+ }
}
if (slop1 & 2) {
*(int16_t *)dp = clr;
DELTA(dp, 2, int32_t *);
+ if (ri->ri_hwbits) {
+ *(int16_t *)hp = clr;
+ DELTA(hp, 2, int32_t *);
+ }
}
/* Write 32 bytes per loop */
for (cnt = n8; cnt; cnt--) {
- dp[0] = clr;
- dp[1] = clr;
- dp[2] = clr;
- dp[3] = clr;
- dp[4] = clr;
- dp[5] = clr;
- dp[6] = clr;
- dp[7] = clr;
+ for (i = 0; i < 8; i++) {
+ dp[i] = clr;
+ if (ri->ri_hwbits)
+ hp[i] = clr;
+ }
dp += 8;
+ if (ri->ri_hwbits)
+ hp += 8;
}
/* Write 4 bytes per loop */
- for (cnt = num; cnt; cnt--)
+ for (cnt = num; cnt; cnt--) {
*dp++ = clr;
+ if (ri->ri_hwbits)
+ *hp++ = clr;
+ }
/* Write unaligned trailing slop */
if (slop2 & 1) {
*(u_char *)dp = clr;
DELTA(dp, 1, int32_t *);
+ if (ri->ri_hwbits) {
+ *(u_char *)hp = clr;
+ DELTA(hp, 1, int32_t *);
+ }
}
- if (slop2 & 2)
+ if (slop2 & 2) {
*(int16_t *)dp = clr;
+ if (ri->ri_hwbits)
+ *(int16_t *)hp = clr;
+ }
}
}
diff --git a/sys/dev/rasops/rasops.h b/sys/dev/rasops/rasops.h
index e86c19aff61..9a67a20b08e 100644
--- a/sys/dev/rasops/rasops.h
+++ b/sys/dev/rasops/rasops.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.h,v 1.18 2005/12/11 12:23:43 christos Exp $ */
+/* $NetBSD: rasops.h,v 1.19 2006/02/18 13:57:33 jmcneill Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -60,6 +60,12 @@ struct rasops_info {
int ri_stride; /* stride in bytes */
/*
+ * If you want shadow framebuffer support, point ri_hwbits
+ * to the real framebuffer, and ri_bits to the shadow framebuffer
+ */
+ u_char *ri_hwbits;
+
+ /*
* These can optionally be left zeroed out. If you fill ri_font,
* but aren't using wsfont, set ri_wsfcookie to -1.
*/
diff --git a/sys/dev/rasops/rasops15.c b/sys/dev/rasops/rasops15.c
index e31e5b9e724..8bc26e313b3 100644
--- a/sys/dev/rasops/rasops15.c
+++ b/sys/dev/rasops/rasops15.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops15.c,v 1.13 2005/12/11 12:23:43 christos Exp $ */
+/* $NetBSD: rasops15.c,v 1.14 2006/02/18 13:57:33 jmcneill Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.13 2005/12/11 12:23:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.14 2006/02/18 13:57:33 jmcneill Exp $");
#include "opt_rasops.h"
@@ -57,6 +57,7 @@ static void rasops15_putchar16(void *, int, int, u_int, long attr);
static void rasops15_makestamp(struct rasops_info *, long);
#endif
+#ifndef RASOPS_SMALL
/*
* (2x2)x1 stamp for optimized character blitting
*/
@@ -75,6 +76,7 @@ static int stamp_mutex; /* XXX see note in readme */
#define STAMP_SHIFT(fb,n) ((n*4-3) >= 0 ? (fb)>>(n*4-3):(fb)<<-(n*4-3))
#define STAMP_MASK (15 << 3)
#define STAMP_READ(o) (*(int32_t *)((caddr_t)stamp + (o)))
+#endif
/*
* Initialize rasops_info struct for this colordepth.
@@ -125,9 +127,10 @@ rasops15_putchar(cookie, row, col, uc, attr)
{
int fb, width, height, cnt, clr[2];
struct rasops_info *ri;
- u_char *dp, *rp, *fr;
+ u_char *dp, *rp, *hp, *hrp, *fr;
ri = (struct rasops_info *)cookie;
+ hp = hrp = NULL;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
@@ -139,6 +142,9 @@ rasops15_putchar(cookie, row, col, uc, attr)
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
+ if (ri->ri_hwbits)
+ hrp = ri->ri_hwbits + row * ri->ri_yscale +
+ col * ri->ri_xscale;
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
@@ -150,10 +156,18 @@ rasops15_putchar(cookie, row, col, uc, attr)
while (height--) {
dp = rp;
rp += ri->ri_stride;
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ hrp += ri->ri_stride;
+ }
for (cnt = width; cnt; cnt--) {
*(int16_t *)dp = c;
dp += 2;
+ if (ri->ri_hwbits) {
+ *(int16_t *)hp = c;
+ hp += 2;
+ }
}
}
} else {
@@ -165,11 +179,20 @@ rasops15_putchar(cookie, row, col, uc, attr)
fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
fr += ri->ri_font->stride;
rp += ri->ri_stride;
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ hrp += ri->ri_stride;
+ }
for (cnt = width; cnt; cnt--) {
*(int16_t *)dp = (int16_t)clr[(fb >> 31) & 1];
+ if (ri->ri_hwbits)
+ *(int16_t *)hp =
+ (int16_t)clr[(fb >> 31) & 1];
fb <<= 1;
dp += 2;
+ if (ri->ri_hwbits)
+ hp += 2;
}
}
}
@@ -178,10 +201,16 @@ rasops15_putchar(cookie, row, col, uc, attr)
if ((attr & 1) != 0) {
int16_t c = (int16_t)clr[1];
rp -= ri->ri_stride << 1;
+ if (ri->ri_hwbits)
+ hrp -= ri->ri_stride << 1;
while (width--) {
*(int16_t *)rp = c;
rp += 2;
+ if (ri->ri_hwbits) {
+ *(int16_t *)hrp = c;
+ hrp += 2;
+ }
}
}
}
@@ -229,7 +258,7 @@ rasops15_putchar8(cookie, row, col, uc, attr)
{
struct rasops_info *ri;
int height, so, fs;
- int32_t *rp;
+ int32_t *rp, *hrp;
u_char *fr;
/* Can't risk remaking the stamp if it's already in use */
@@ -240,6 +269,7 @@ rasops15_putchar8(cookie, row, col, uc, attr)
}
ri = (struct rasops_info *)cookie;
+ hrp = NULL;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
@@ -258,6 +288,9 @@ rasops15_putchar8(cookie, row, col, uc, attr)
rasops15_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
if (uc == (u_int)-1) {
@@ -265,6 +298,10 @@ rasops15_putchar8(cookie, row, col, uc, attr)
while (height--) {
rp[0] = rp[1] = rp[2] = rp[3] = c;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = c;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -275,13 +312,23 @@ rasops15_putchar8(cookie, row, col, uc, attr)
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
rp[0] = STAMP_READ(so);
rp[1] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[0] = STAMP_READ(so);
+ hrp[1] = STAMP_READ(so + 4);
+ }
so = STAMP_SHIFT(fr[0], 0) & STAMP_MASK;
rp[2] = STAMP_READ(so);
rp[3] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[2] = STAMP_READ(so);
+ hrp[3] = STAMP_READ(so + 4);
+ }
fr += fs;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, ri->ri_stride, int32_t *);
}
}
@@ -291,6 +338,10 @@ rasops15_putchar8(cookie, row, col, uc, attr)
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = rp[3] = c;
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = c;
+ }
}
stamp_mutex--;
@@ -308,7 +359,7 @@ rasops15_putchar12(cookie, row, col, uc, attr)
{
struct rasops_info *ri;
int height, so, fs;
- int32_t *rp;
+ int32_t *rp, *hrp;
u_char *fr;
/* Can't risk remaking the stamp if it's already in use */
@@ -319,6 +370,7 @@ rasops15_putchar12(cookie, row, col, uc, attr)
}
ri = (struct rasops_info *)cookie;
+ hrp = NULL;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
@@ -337,6 +389,9 @@ rasops15_putchar12(cookie, row, col, uc, attr)
rasops15_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
if (uc == (u_int)-1) {
@@ -344,6 +399,11 @@ rasops15_putchar12(cookie, row, col, uc, attr)
while (height--) {
rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = hrp[4] =
+ hrp[5] = c;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -354,17 +414,31 @@ rasops15_putchar12(cookie, row, col, uc, attr)
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
rp[0] = STAMP_READ(so);
rp[1] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[0] = STAMP_READ(so);
+ hrp[1] = STAMP_READ(so + 4);
+ }
so = STAMP_SHIFT(fr[0], 0) & STAMP_MASK;
rp[2] = STAMP_READ(so);
rp[3] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[2] = STAMP_READ(so);
+ hrp[3] = STAMP_READ(so + 4);
+ }
so = STAMP_SHIFT(fr[1], 1) & STAMP_MASK;
rp[4] = STAMP_READ(so);
rp[5] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[4] = STAMP_READ(so);
+ hrp[5] = STAMP_READ(so + 4);
+ }
fr += fs;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, ri->ri_stride, int32_t *);
}
}
@@ -374,6 +448,10 @@ rasops15_putchar12(cookie, row, col, uc, attr)
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = hrp[4] = hrp[5] = c;
+ }
}
stamp_mutex--;
@@ -391,7 +469,7 @@ rasops15_putchar16(cookie, row, col, uc, attr)
{
struct rasops_info *ri;
int height, so, fs;
- int32_t *rp;
+ int32_t *rp, *hrp;
u_char *fr;
/* Can't risk remaking the stamp if it's already in use */
@@ -402,6 +480,7 @@ rasops15_putchar16(cookie, row, col, uc, attr)
}
ri = (struct rasops_info *)cookie;
+ hrp = NULL;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
@@ -420,6 +499,9 @@ rasops15_putchar16(cookie, row, col, uc, attr)
rasops15_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
if (uc == (u_int)-1) {
@@ -428,6 +510,11 @@ rasops15_putchar16(cookie, row, col, uc, attr)
rp[0] = rp[1] = rp[2] = rp[3] =
rp[4] = rp[5] = rp[6] = rp[7] = c;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] =
+ hrp[4] = hrp[5] = hrp[6] = hrp[7] = c;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -438,20 +525,38 @@ rasops15_putchar16(cookie, row, col, uc, attr)
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
rp[0] = STAMP_READ(so);
rp[1] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[0] = STAMP_READ(so);
+ hrp[1] = STAMP_READ(so + 4);
+ }
so = STAMP_SHIFT(fr[0], 0) & STAMP_MASK;
rp[2] = STAMP_READ(so);
rp[3] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[2] = STAMP_READ(so);
+ hrp[3] = STAMP_READ(so + 4);
+ }
so = STAMP_SHIFT(fr[1], 1) & STAMP_MASK;
rp[4] = STAMP_READ(so);
rp[5] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[4] = STAMP_READ(so);
+ hrp[5] = STAMP_READ(so + 4);
+ }
so = STAMP_SHIFT(fr[1], 0) & STAMP_MASK;
rp[6] = STAMP_READ(so);
rp[7] = STAMP_READ(so + 4);
+ if (ri->ri_hwbits) {
+ hrp[6] = STAMP_READ(so);
+ hrp[7] = STAMP_READ(so + 4);
+ }
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, ri->ri_stride, int32_t *);
fr += fs;
}
}
@@ -463,6 +568,11 @@ rasops15_putchar16(cookie, row, col, uc, attr)
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = rp[3] =
rp[4] = rp[5] = rp[6] = rp[7] = c;
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] =
+ hrp[4] = hrp[5] = hrp[6] = hrp[7] = c;
+ }
}
stamp_mutex--;
diff --git a/sys/dev/rasops/rasops32.c b/sys/dev/rasops/rasops32.c
index 3aa4c14e4b7..f7686dd8159 100644
--- a/sys/dev/rasops/rasops32.c
+++ b/sys/dev/rasops/rasops32.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops32.c,v 1.14 2005/12/11 12:23:44 christos Exp $ */
+/* $NetBSD: rasops32.c,v 1.15 2006/02/18 13:57:33 jmcneill Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.14 2005/12/11 12:23:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.15 2006/02/18 13:57:33 jmcneill Exp $");
#include "opt_rasops.h"
@@ -83,10 +83,11 @@ rasops32_putchar(cookie, row, col, uc, attr)
{
int width, height, cnt, fs, fb, clr[2];
struct rasops_info *ri;
- int32_t *dp, *rp;
+ int32_t *dp, *rp, *hp, *hrp;
u_char *fr;
ri = (struct rasops_info *)cookie;
+ hp = hrp = NULL;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
@@ -103,6 +104,9 @@ rasops32_putchar(cookie, row, col, uc, attr)
return;
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
@@ -114,9 +118,16 @@ rasops32_putchar(cookie, row, col, uc, attr)
while (height--) {
dp = rp;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
- for (cnt = width; cnt; cnt--)
+ for (cnt = width; cnt; cnt--) {
*dp++ = clr[0];
+ if (ri->ri_hwbits)
+ *hp++ = clr[0];
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -129,9 +140,15 @@ rasops32_putchar(cookie, row, col, uc, attr)
(fr[0] << 24);
fr += fs;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
for (cnt = width; cnt; cnt--) {
*dp++ = clr[(fb >> 31) & 1];
+ if (ri->ri_hwbits)
+ *hp++ = clr[(fb >> 31) & 1];
fb <<= 1;
}
}
@@ -140,8 +157,13 @@ rasops32_putchar(cookie, row, col, uc, attr)
/* Do underline */
if ((attr & 1) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
- while (width--)
+ while (width--) {
*rp++ = clr[1];
+ if (ri->ri_hwbits)
+ *hrp++ = clr[1];
+ }
}
}
diff --git a/sys/dev/rasops/rasops8.c b/sys/dev/rasops/rasops8.c
index aa5a770574e..e90fc8575c3 100644
--- a/sys/dev/rasops/rasops8.c
+++ b/sys/dev/rasops/rasops8.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops8.c,v 1.20 2005/12/11 12:23:44 christos Exp $ */
+/* $NetBSD: rasops8.c,v 1.21 2006/02/18 13:57:33 jmcneill Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.20 2005/12/11 12:23:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.21 2006/02/18 13:57:33 jmcneill Exp $");
#include "opt_rasops.h"
@@ -112,10 +112,11 @@ rasops8_putchar(cookie, row, col, uc, attr)
long attr;
{
int width, height, cnt, fs, fb;
- u_char *dp, *rp, *fr, clr[2];
+ u_char *dp, *rp, *hp, *hrp, *fr, clr[2];
struct rasops_info *ri;
ri = (struct rasops_info *)cookie;
+ hp = hrp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
@@ -129,6 +130,9 @@ rasops8_putchar(cookie, row, col, uc, attr)
return;
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
+ if (ri->ri_hwbits)
+ hrp = ri->ri_hwbits + row * ri->ri_yscale + col *
+ ri->ri_xscale;
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
@@ -141,9 +145,16 @@ rasops8_putchar(cookie, row, col, uc, attr)
while (height--) {
dp = rp;
rp += ri->ri_stride;
+ if (ri->ri_hwbits) {
+ hp = hrp;
+ hrp += ri->ri_stride;
+ }
- for (cnt = width; cnt; cnt--)
+ for (cnt = width; cnt; cnt--) {
*dp++ = c;
+ if (ri->ri_hwbits)
+ *hp++ = c;
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -152,12 +163,18 @@ rasops8_putchar(cookie, row, col, uc, attr)
while (height--) {
dp = rp;
+ if (ri->ri_hwbits)
+ hp = hrp;
fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
fr += fs;
rp += ri->ri_stride;
+ if (ri->ri_hwbits)
+ hrp += ri->ri_stride;
for (cnt = width; cnt; cnt--) {
*dp++ = clr[(fb >> 31) & 1];
+ if (ri->ri_hwbits)
+ *hp++ = clr[(fb >> 31) & 1];
fb <<= 1;
}
}
@@ -168,9 +185,14 @@ rasops8_putchar(cookie, row, col, uc, attr)
u_char c = clr[1];
rp -= (ri->ri_stride << 1);
+ if (ri->ri_hwbits)
+ hrp -= (ri->ri_stride << 1);
- while (width--)
+ while (width--) {
*rp++ = c;
+ if (ri->ri_hwbits)
+ *hrp++ = c;
+ }
}
}
@@ -224,7 +246,7 @@ rasops8_putchar8(cookie, row, col, uc, attr)
{
struct rasops_info *ri;
int height, fs;
- int32_t *rp;
+ int32_t *rp, *hp;
u_char *fr;
/* Can't risk remaking the stamp if it's already in use */
@@ -235,6 +257,7 @@ rasops8_putchar8(cookie, row, col, uc, attr)
}
ri = (struct rasops_info *)cookie;
+ hp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
@@ -256,12 +279,19 @@ rasops8_putchar8(cookie, row, col, uc, attr)
rasops8_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
if (uc == ' ') {
while (height--) {
rp[0] = rp[1] = stamp[0];
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hp[0] = hp[1] = stamp[0];
+ DELTA(hp, ri->ri_stride, int32_t *);
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -271,9 +301,17 @@ rasops8_putchar8(cookie, row, col, uc, attr)
while (height--) {
rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
+ if (ri->ri_hwbits) {
+ hp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) &
+ STAMP_MASK);
+ hp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) &
+ STAMP_MASK);
+ }
fr += fs;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hp, ri->ri_stride, int32_t *);
}
}
@@ -281,6 +319,10 @@ rasops8_putchar8(cookie, row, col, uc, attr)
if ((attr & 1) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = stamp[15];
+ if (ri->ri_hwbits) {
+ DELTA(hp, -(ri->ri_stride << 1), int32_t *);
+ hp[0] = hp[1] = stamp[15];
+ }
}
stamp_mutex--;
@@ -298,7 +340,7 @@ rasops8_putchar12(cookie, row, col, uc, attr)
{
struct rasops_info *ri;
int height, fs;
- int32_t *rp;
+ int32_t *rp, *hrp;
u_char *fr;
/* Can't risk remaking the stamp if it's already in use */
@@ -309,6 +351,7 @@ rasops8_putchar12(cookie, row, col, uc, attr)
}
ri = (struct rasops_info *)cookie;
+ hrp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
@@ -330,6 +373,9 @@ rasops8_putchar12(cookie, row, col, uc, attr)
rasops8_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
height = ri->ri_font->fontheight;
if (uc == ' ') {
@@ -338,6 +384,10 @@ rasops8_putchar12(cookie, row, col, uc, attr)
rp[0] = rp[1] = rp[2] = c;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = hrp[1] = hrp[2] = c;
+ DELTA(hrp, ri->ri_stride, int32_t *);
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -348,9 +398,16 @@ rasops8_putchar12(cookie, row, col, uc, attr)
rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
+ if (ri->ri_hwbits) {
+ hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
+ hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
+ hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
+ }
fr += fs;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, ri->ri_stride, int32_t *);
}
}
@@ -358,6 +415,10 @@ rasops8_putchar12(cookie, row, col, uc, attr)
if ((attr & 1) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = stamp[15];
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ hrp[0] = hrp[1] = hrp[2] = stamp[15];
+ }
}
stamp_mutex--;
@@ -375,7 +436,7 @@ rasops8_putchar16(cookie, row, col, uc, attr)
{
struct rasops_info *ri;
int height, fs;
- int32_t *rp;
+ int32_t *rp, *hrp;
u_char *fr;
/* Can't risk remaking the stamp if it's already in use */
@@ -386,6 +447,7 @@ rasops8_putchar16(cookie, row, col, uc, attr)
}
ri = (struct rasops_info *)cookie;
+ hrp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
@@ -407,11 +469,18 @@ rasops8_putchar16(cookie, row, col, uc, attr)
rasops8_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
+ col*ri->ri_xscale);
+
height = ri->ri_font->fontheight;
if (uc == ' ') {
- while (height--)
+ while (height--) {
rp[0] = rp[1] = rp[2] = rp[3] = stamp[0];
+ if (ri->ri_hwbits)
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = stamp[0];
+ }
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
@@ -422,9 +491,17 @@ rasops8_putchar16(cookie, row, col, uc, attr)
rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
rp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
+ if (ri->ri_hwbits) {
+ hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
+ hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
+ hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
+ hrp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
+ }
fr += fs;
DELTA(rp, ri->ri_stride, int32_t *);
+ if (ri->ri_hwbits)
+ DELTA(hrp, ri->ri_stride, int32_t *);
}
}
@@ -432,6 +509,10 @@ rasops8_putchar16(cookie, row, col, uc, attr)
if ((attr & 1) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = rp[3] = stamp[15];
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = stamp[15];
+ }
}
stamp_mutex--;