summaryrefslogtreecommitdiff
path: root/cfb/cfbrrop.h
diff options
context:
space:
mode:
Diffstat (limited to 'cfb/cfbrrop.h')
-rw-r--r--cfb/cfbrrop.h201
1 files changed, 189 insertions, 12 deletions
diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h
index 4423e040d..d6f095e6b 100644
--- a/cfb/cfbrrop.h
+++ b/cfb/cfbrrop.h
@@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group.
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.h,v 3.10 2001/12/14 19:59:24 dawes Exp $ */
+
#ifndef GXcopy
#include "X.h"
#endif
@@ -38,34 +40,162 @@ in this Software without prior written authorization from The Open Group.
#endif
#if RROP == GXcopy
-#define RROP_DECLARE register unsigned long rrop_xor;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_xor; \
+ CfbBits piQxelXor[3], spiQxelXor[8];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[2] = rrop_xor << 24; \
+ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = rrop_xor << 16; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelXor[6] = rrop_xor << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0; \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
+ if (idx == 2 || idx == 4){ \
+ idx++; \
+ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
+ } \
+ }
+#define RROP_SOLID(dst, idx) \
+ (*(dst) = piQxelXor[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask)))
+#else
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
+#define RROP_DECLARE register CfbBits rrop_xor;
#define RROP_SOLID(dst) (*(dst) = (rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy)
#endif /* GXcopy */
#if RROP == GXxor
-#define RROP_DECLARE register unsigned long rrop_xor;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_xor; \
+ CfbBits piQxelXor[3], spiQxelXor[8];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[2] = rrop_xor << 24; \
+ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[4] = rrop_xor << 16; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelXor[6] = rrop_xor << 8; \
+ spiQxelXor[1] = spiQxelXor[7] = 0; \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ register int idx = ((index) & 3)<< 1; \
+ *(dst) ^= spiQxelXor[idx]; \
+ if (idx == 2 || idx == 4) \
+ *((dst)+1) ^= spiQxelXor[idx+1]; \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) ^= piQxelXor[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) ^= (piQxelXor[(idx)] & (mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_xor;
#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor)
#endif /* GXxor */
#if RROP == GXand
-#define RROP_DECLARE register unsigned long rrop_and;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_and; \
+ CfbBits piQxelAnd[3], spiQxelAnd[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \
+ spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
+ spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \
+ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
+ spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \
+ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
+ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
+ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) &= spiQxelAnd[0]; \
+ break; \
+ case 3: \
+ *(dst) &= spiQxelAnd[1]; \
+ break; \
+ case 1: \
+ *(dst) &= spiQxelAnd[2]; \
+ *((dst)+1) &= spiQxelAnd[3]; \
+ break; \
+ case 2: \
+ *(dst) &= spiQxelAnd[4]; \
+ *((dst)+1) &= spiQxelAnd[5]; \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) &= piQxelAnd[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) &= (piQxelAnd[(idx)] | ~(mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_and;
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and;
#define RROP_SOLID(dst) (*(dst) &= (rrop_and))
#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And)
#endif /* GXand */
#if RROP == GXor
-#define RROP_DECLARE register unsigned long rrop_or;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_or; \
+ CfbBits piQxelOr[3], spiQxelOr[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \
+ spiQxelOr[0] = rrop_or & 0xFFFFFF; \
+ spiQxelOr[1] = rrop_or << 24; \
+ spiQxelOr[2] = rrop_or << 16; \
+ spiQxelOr[3] = rrop_or << 8; \
+ spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \
+ spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \
+ piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \
+ piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \
+ piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) |= spiQxelOr[0]; \
+ break; \
+ case 3: \
+ *(dst) |= spiQxelOr[3]; \
+ break; \
+ case 1: \
+ *(dst) |= spiQxelOr[1]; \
+ *((dst)+1) |= spiQxelOr[4]; \
+ break; \
+ case 2: \
+ *(dst) |= spiQxelOr[2]; \
+ *((dst)+1) |= spiQxelOr[5]; \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) |= piQxelOr[(idx)])
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) |= (piQxelOr[(idx)] & (mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_or;
#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) |= (rrop_or))
#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or)
#endif /* GXor */
@@ -78,11 +208,58 @@ in this Software without prior written authorization from The Open Group.
#endif /* GXnoop */
#if RROP == GXset
-#define RROP_DECLARE register unsigned long rrop_and, rrop_xor;
+#if PSZ == 24
+#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \
+ CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6];
+#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
+ rrop_xor = (devPriv)->xor; \
+ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
+ spiQxelXor[1] = rrop_xor << 24; \
+ spiQxelXor[2] = rrop_xor << 16; \
+ spiQxelXor[3] = rrop_xor << 8; \
+ spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \
+ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
+ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
+ spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \
+ spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \
+ spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \
+ spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
+ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
+ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
+ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
+ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \
+ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
+ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
+ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
+#define RROP_SOLID24(dst,index) {\
+ switch((index) & 3){ \
+ case 0: \
+ *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
+ break; \
+ case 3: \
+ *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
+ break; \
+ case 1: \
+ *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
+ break; \
+ case 2: \
+ *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
+ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
+ break; \
+ } \
+ }
+#define RROP_SOLID(dst,idx) \
+ (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)]))
+#define RROP_SOLID_MASK(dst,mask,idx) \
+ (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask)))
+#else
+#define RROP_DECLARE register CfbBits rrop_and, rrop_xor;
#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
rrop_xor = (devPriv)->xor;
#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor))
#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask)))
+#endif
#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General)
#endif /* GXset */
@@ -126,24 +303,24 @@ in this Software without prior written authorization from The Open Group.
#define RROP_SPAN(pdst,nmiddle) {\
int part = (nmiddle) & RROP_UNROLL_MASK; \
(nmiddle) >>= RROP_UNROLL_SHIFT; \
- (pdst) += part * (sizeof (unsigned long) / sizeof (*pdst)); \
+ (pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \
switch (part) {\
- RROP_UNROLL_CASE((unsigned long *) (pdst)) \
+ RROP_UNROLL_CASE((CfbBits *) (pdst)) \
} \
while (--(nmiddle) >= 0) { \
- (pdst) += RROP_UNROLL * (sizeof (unsigned long) / sizeof (*pdst)); \
- RROP_UNROLL_LOOP((unsigned long *) (pdst)) \
+ (pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \
+ RROP_UNROLL_LOOP((CfbBits *) (pdst)) \
} \
}
#else
#define RROP_SPAN(pdst,nmiddle) \
while (--(nmiddle) >= 0) { \
- RROP_SOLID((unsigned long *) (pdst)); \
- (pdst) += sizeof (unsigned long) / sizeof (*pdst); \
+ RROP_SOLID((CfbBits *) (pdst)); \
+ (pdst) += sizeof (CfbBits) / sizeof (*pdst); \
}
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define RROP_NAME_CAT(prefix,suffix) prefix##suffix
#else
#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix