Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/rasops add support for shadow framebuffers
details: https://anonhg.NetBSD.org/src/rev/e36193190095
branches: trunk
changeset: 753738:e36193190095
user: macallan <macallan%NetBSD.org@localhost>
date: Thu Apr 08 16:45:53 2010 +0000
description:
add support for shadow framebuffers
tested on sparc with a cg12
diffstat:
sys/dev/rasops/rasops1.c | 132 +++++++++++++++++++++++++++++++++-------
sys/dev/rasops/rasops_bitops.h | 114 +++++++++++++++++++++++++++++++----
2 files changed, 209 insertions(+), 37 deletions(-)
diffs (truncated from 587 to 300 lines):
diff -r ca89878bfbb8 -r e36193190095 sys/dev/rasops/rasops1.c
--- a/sys/dev/rasops/rasops1.c Thu Apr 08 16:04:35 2010 +0000
+++ b/sys/dev/rasops/rasops1.c Thu Apr 08 16:45:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1.c,v 1.20 2009/03/14 21:04:22 dsl Exp $ */
+/* $NetBSD: rasops1.c,v 1.21 2010/04/08 16:45:53 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.20 2009/03/14 21:04:22 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.21 2010/04/08 16:45:53 macallan Exp $");
#include "opt_rasops.h"
@@ -90,7 +90,7 @@
u_int fs, rs, fb, bg, fg, lmask, rmask;
u_int32_t height, width;
struct rasops_info *ri;
- int32_t *rp;
+ int32_t *rp, *hrp = NULL, tmp, tmp2;
u_char *fr;
ri = (struct rasops_info *)cookie;
@@ -106,6 +106,9 @@
col *= ri->ri_font->fontwidth;
rp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
+ if (ri->ri_hwbits)
+ hrp = (int32_t *)(ri->ri_hwbits + row * ri->ri_yscale +
+ ((col >> 3) & ~3));
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
col = col & 31;
@@ -134,8 +137,13 @@
bg &= rmask;
while (height--) {
- *rp = (*rp & lmask) | bg;
+ tmp = (*rp & lmask) | bg;
+ *rp = tmp;
DELTA(rp, rs, int32_t *);
+ if (ri->ri_hwbits) {
+ *hrp = tmp;
+ DELTA(hrp, rs, int32_t *);
+ }
}
} else {
/* NOT fontbits if bg is white */
@@ -143,21 +151,31 @@
while (height--) {
fb = ~(fr[3] | (fr[2] << 8) |
(fr[1] << 16) | (fr[0] << 24));
- *rp = (*rp & lmask)
+ tmp = (*rp & lmask)
| (MBE(fb >> col) & rmask);
+ *rp = tmp;
fr += fs;
DELTA(rp, rs, int32_t *);
+ if (ri->ri_hwbits) {
+ *hrp = tmp;
+ DELTA(hrp, rs, int32_t *);
+ }
}
} else {
while (height--) {
fb = (fr[3] | (fr[2] << 8) |
(fr[1] << 16) | (fr[0] << 24));
- *rp = (*rp & lmask)
+ tmp = (*rp & lmask)
| (MBE(fb >> col) & rmask);
+ *rp = tmp;
fr += fs;
DELTA(rp, rs, int32_t *);
+ if (ri->ri_hwbits) {
+ *hrp = tmp;
+ DELTA(hrp, rs, int32_t *);
+ }
}
}
}
@@ -165,7 +183,12 @@
/* Do underline */
if ((attr & 1) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
- *rp = (*rp & lmask) | (fg & rmask);
+ tmp = (*rp & lmask) | (fg & rmask);
+ *rp = tmp;
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ *hrp = tmp;
+ }
}
} else {
lmask = ~rasops_lmask[col];
@@ -176,9 +199,16 @@
bg = bg & ~lmask;
while (height--) {
- rp[0] = (rp[0] & lmask) | bg;
- rp[1] = (rp[1] & rmask) | width;
+ tmp = (rp[0] & lmask) | bg;
+ tmp2 = (rp[1] & rmask) | width;
+ rp[0] = tmp;
+ rp[1] = tmp2;
DELTA(rp, rs, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = tmp;
+ hrp[1] = tmp2;
+ DELTA(hrp, rs, int32_t *);
+ }
}
} else {
width = 32 - col;
@@ -189,28 +219,40 @@
fb = ~(fr[3] | (fr[2] << 8) |
(fr[1] << 16) | (fr[0] << 24));
- rp[0] = (rp[0] & lmask)
+ tmp = (rp[0] & lmask)
| MBE((u_int)fb >> col);
- rp[1] = (rp[1] & rmask)
+ tmp2 = (rp[1] & rmask)
| (MBE((u_int)fb << width) & ~rmask);
-
+ rp[0] = tmp;
+ rp[1] = tmp2;
fr += fs;
DELTA(rp, rs, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = tmp;
+ hrp[1] = tmp2;
+ DELTA(hrp, rs, int32_t *);
+ }
}
} else {
while (height--) {
fb = (fr[3] | (fr[2] << 8) |
(fr[1] << 16) | (fr[0] << 24));
- rp[0] = (rp[0] & lmask)
+ tmp = (rp[0] & lmask)
| MBE(fb >> col);
- rp[1] = (rp[1] & rmask)
+ tmp2 = (rp[1] & rmask)
| (MBE(fb << width) & ~rmask);
-
+ rp[0] = tmp;
+ rp[1] = tmp2;
fr += fs;
DELTA(rp, rs, int32_t *);
+ if (ri->ri_hwbits) {
+ hrp[0] = tmp;
+ hrp[1] = tmp2;
+ DELTA(hrp, rs, int32_t *);
+ }
}
}
}
@@ -218,8 +260,15 @@
/* Do underline */
if ((attr & 1) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
- rp[0] = (rp[0] & lmask) | (fg & ~lmask);
- rp[1] = (rp[1] & rmask) | (fg & ~rmask);
+ tmp = (rp[0] & lmask) | (fg & ~lmask);
+ tmp2 = (rp[1] & rmask) | (fg & ~rmask);
+ rp[0] = tmp;
+ rp[1] = tmp2;
+ if (ri->ri_hwbits) {
+ DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
+ hrp[0] = tmp;
+ hrp[1] = tmp2;
+ }
}
}
}
@@ -233,7 +282,7 @@
{
int height, fs, rs, bg, fg;
struct rasops_info *ri;
- u_char *fr, *rp;
+ u_char *fr, *rp, *hrp = NULL;
ri = (struct rasops_info *)cookie;
@@ -247,6 +296,8 @@
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
+ if (ri->ri_hwbits)
+ hrp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
rs = ri->ri_stride;
@@ -258,6 +309,10 @@
while (height--) {
*rp = bg;
rp += rs;
+ if (ri->ri_hwbits) {
+ *hrp = bg;
+ hrp += rs;
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -268,14 +323,23 @@
if (bg) {
while (height--) {
*rp = ~*fr;
+ rp += rs;
+ if (ri->ri_hwbits) {
+ *hrp = ~*fr;
+ hrp += rs;
+ }
fr += fs;
- rp += rs;
+
}
} else {
while (height--) {
*rp = *fr;
+ rp += rs;
+ if (ri->ri_hwbits) {
+ *hrp = *fr;
+ hrp += rs;
+ }
fr += fs;
- rp += rs;
}
}
@@ -284,6 +348,8 @@
/* Do underline */
if ((attr & 1) != 0)
rp[-(ri->ri_stride << 1)] = fg;
+ if (ri->ri_hwbits)
+ hrp[-(ri->ri_stride << 1)] = fg;
}
/*
@@ -294,7 +360,7 @@
{
int height, fs, rs, bg, fg;
struct rasops_info *ri;
- u_char *fr, *rp;
+ u_char *fr, *rp, *hrp = NULL;
ri = (struct rasops_info *)cookie;
@@ -308,6 +374,8 @@
#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;
rs = ri->ri_stride;
@@ -317,8 +385,13 @@
/* If fg and bg match this becomes a space character */
if (fg == bg || uc == ' ') {
while (height--) {
+ /* XXX alignment?! */
*(int16_t *)rp = bg;
rp += rs;
+ if (ri->ri_hwbits) {
+ *(int16_t *)hrp = bg;
+ hrp += rs;
+ }
}
} else {
uc -= ri->ri_font->firstchar;
@@ -330,22 +403,35 @@
while (height--) {
rp[0] = ~fr[0];
rp[1] = ~fr[1];
+ rp += rs;
+ if (ri->ri_hwbits) {
+ hrp[0] = ~fr[0];
+ hrp[1] = ~fr[1];
+ hrp += rs;
+ }
fr += fs;
- rp += rs;
}
} else {
while (height--) {
rp[0] = fr[0];
rp[1] = fr[1];
+ rp += rs;
+ if (ri->ri_hwbits) {
+ hrp[0] = fr[0];
Home |
Main Index |
Thread Index |
Old Index