diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-08-05 09:58:58 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-08-05 09:58:58 +0000 |
commit | 2fb74d6b81e739f3c46908c5322a3b7c6bb4c964 (patch) | |
tree | df6806e40cdcc6da46f7d64c91d97dc6f15ae4d4 /sys/arch/hp300/dev/diofb_mono.c | |
parent | 8a82d4c8e145fb0d9eded17d545af66b4c6bcfc3 (diff) |
Since the maskbits code only gets invoked with RR_COPY or RR_CLEAR those
days, simplify and inline more of it, to avoid doing unnecessary dest and/or
source loads. A copy of the old maskbits.h is moved to stand/ as the ite code
there needs the complete RR_ code.
Diffstat (limited to 'sys/arch/hp300/dev/diofb_mono.c')
-rw-r--r-- | sys/arch/hp300/dev/diofb_mono.c | 108 |
1 files changed, 19 insertions, 89 deletions
diff --git a/sys/arch/hp300/dev/diofb_mono.c b/sys/arch/hp300/dev/diofb_mono.c index 50630815c9a..81e36986ca9 100644 --- a/sys/arch/hp300/dev/diofb_mono.c +++ b/sys/arch/hp300/dev/diofb_mono.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diofb_mono.c,v 1.1 2006/04/14 21:05:43 miod Exp $ */ +/* $OpenBSD: diofb_mono.c,v 1.2 2006/08/05 09:58:56 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -81,84 +81,9 @@ #include <hp300/dev/diofbreg.h> #include <hp300/dev/diofbvar.h> +#include <dev/rasops/rasops_masks.h> #include <hp300/dev/maskbits.h> -/* NOTE: - * the first element in starttab could be 0xffffffff. making it 0 - * lets us deal with a full first word in the middle loop, rather - * than having to do the multiple reads and masks that we'd - * have to do if we thought it was partial. - */ -const int starttab[32] = { - 0x00000000, - 0x7FFFFFFF, - 0x3FFFFFFF, - 0x1FFFFFFF, - 0x0FFFFFFF, - 0x07FFFFFF, - 0x03FFFFFF, - 0x01FFFFFF, - 0x00FFFFFF, - 0x007FFFFF, - 0x003FFFFF, - 0x001FFFFF, - 0x000FFFFF, - 0x0007FFFF, - 0x0003FFFF, - 0x0001FFFF, - 0x0000FFFF, - 0x00007FFF, - 0x00003FFF, - 0x00001FFF, - 0x00000FFF, - 0x000007FF, - 0x000003FF, - 0x000001FF, - 0x000000FF, - 0x0000007F, - 0x0000003F, - 0x0000001F, - 0x0000000F, - 0x00000007, - 0x00000003, - 0x00000001 -}; - -const int endtab[32] = { - 0x00000000, - 0x80000000, - 0xC0000000, - 0xE0000000, - 0xF0000000, - 0xF8000000, - 0xFC000000, - 0xFE000000, - 0xFF000000, - 0xFF800000, - 0xFFC00000, - 0xFFE00000, - 0xFFF00000, - 0xFFF80000, - 0xFFFC0000, - 0xFFFE0000, - 0xFFFF0000, - 0xFFFF8000, - 0xFFFFC000, - 0xFFFFE000, - 0xFFFFF000, - 0xFFFFF800, - 0xFFFFFC00, - 0xFFFFFE00, - 0xFFFFFF00, - 0xFFFFFF80, - 0xFFFFFFC0, - 0xFFFFFFE0, - 0xFFFFFFF0, - 0xFFFFFFF8, - 0xFFFFFFFC, - 0xFFFFFFFE -}; - void diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop) @@ -174,8 +99,6 @@ diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, unsigned int startmask, endmask; /* masks for writing ends of dst */ int nlMiddle; /* whole longwords in dst */ int nl; /* temp copy of nlMiddle */ - unsigned int tmpSrc; - /* place to store full source word */ int xoffSrc; /* offset (>= 0, < 32) from which to fetch whole longwords fetched in src */ int nstart; /* number of ragged bits at start of dst */ @@ -245,24 +168,28 @@ diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, if (xoffSrc == 0) { nl = nlMiddle; while (nl--) { - DoRop(*pdst, rop, *psrc++, - *pdst); + if (rop == RR_CLEAR) + *pdst = 0; + else + *pdst = *psrc; + psrc++; pdst++; } } else { nl = nlMiddle + 1; while (--nl) { - getunalignedword(psrc, xoffSrc, - tmpSrc); - DoRop(*pdst, rop, tmpSrc, - *pdst); + if (rop == RR_CLEAR) + *pdst = 0; + else + getunalignedword(psrc, + xoffSrc, *pdst); pdst++; psrc++; } } if (endmask) { - getandputrop0(psrc, xoffSrc, nend, + getandputrop(psrc, xoffSrc, 0, nend, pdst, rop); } @@ -284,7 +211,7 @@ diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, pdst = pdstLine; if (endmask) { - getandputrop0(psrc, xoffSrc, nend, + getandputrop(psrc, xoffSrc, 0, nend, pdst, rop); } @@ -292,8 +219,11 @@ diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, while (--nl) { --psrc; --pdst; - getunalignedword(psrc, xoffSrc, tmpSrc); - DoRop(*pdst, rop, tmpSrc, *pdst); + if (rop == RR_CLEAR) + *pdst = 0; + else + getunalignedword(psrc, xoffSrc, + *pdst); } if (startmask) { |