VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.1.0/cfbrrop.h@ 78293

Last change on this file since 78293 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 13.2 KB
Line 
1/*
2 * $Xorg: cfbrrop.h,v 1.4 2001/02/09 02:04:38 xorgcvs Exp $
3 *
4Copyright 1989, 1998 The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25 *
26 * Author: Keith Packard, MIT X Consortium
27 */
28
29/* $XFree86: xc/programs/Xserver/cfb/cfbrrop.h,v 3.10tsi Exp $ */
30
31#ifdef HAVE_DIX_CONFIG_H
32#include <dix-config.h>
33#endif
34
35#ifndef GXcopy
36#include <X11/X.h>
37#endif
38
39#define RROP_FETCH_GC(gc) \
40 RROP_FETCH_GCPRIV(((cfbPrivGCPtr)(gc)->devPrivates[cfbGCPrivateIndex].ptr))
41
42#ifndef RROP
43#define RROP GXset
44#endif
45
46#if RROP == GXcopy
47#if PSZ == 24
48#define RROP_DECLARE register CfbBits rrop_xor; \
49 CfbBits piQxelXor[3], spiQxelXor[8];
50#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
51 spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
52 spiQxelXor[2] = rrop_xor << 24; \
53 spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
54 spiQxelXor[4] = rrop_xor << 16; \
55 spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
56 spiQxelXor[6] = rrop_xor << 8; \
57 spiQxelXor[1] = spiQxelXor[7] = 0; \
58 piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
59 piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
60 piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
61#define RROP_SOLID24(dst,index) {\
62 register int idx = ((index) & 3)<< 1; \
63 *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
64 if (idx == 2 || idx == 4){ \
65 idx++; \
66 *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
67 } \
68 }
69#define RROP_SOLID(dst, idx) \
70 (*(dst) = piQxelXor[(idx)])
71#define RROP_SOLID_MASK(dst,mask,idx) \
72 (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask)))
73#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor;
74#else
75#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
76#define RROP_DECLARE register CfbBits rrop_xor;
77#define RROP_SOLID(dst) (*(dst) = (rrop_xor))
78#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask)))
79#define RROP_UNDECLARE
80#endif
81#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy)
82#endif /* GXcopy */
83
84#if RROP == GXxor
85#if PSZ == 24
86#define RROP_DECLARE register CfbBits rrop_xor; \
87 CfbBits piQxelXor[3], spiQxelXor[8];
88#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
89 spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
90 spiQxelXor[2] = rrop_xor << 24; \
91 spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
92 spiQxelXor[4] = rrop_xor << 16; \
93 spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
94 spiQxelXor[6] = rrop_xor << 8; \
95 spiQxelXor[1] = spiQxelXor[7] = 0; \
96 piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
97 piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
98 piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
99#define RROP_SOLID24(dst,index) {\
100 register int idx = ((index) & 3)<< 1; \
101 *(dst) ^= spiQxelXor[idx]; \
102 if (idx == 2 || idx == 4) \
103 *((dst)+1) ^= spiQxelXor[idx+1]; \
104 }
105#define RROP_SOLID(dst,idx) \
106 (*(dst) ^= piQxelXor[(idx)])
107#define RROP_SOLID_MASK(dst,mask,idx) \
108 (*(dst) ^= (piQxelXor[(idx)] & (mask)))
109#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor;
110#else
111#define RROP_DECLARE register CfbBits rrop_xor;
112#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
113#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor))
114#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask)))
115#define RROP_UNDECLARE
116#endif
117#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor)
118#endif /* GXxor */
119
120#if RROP == GXand
121#if PSZ == 24
122#define RROP_DECLARE register CfbBits rrop_and; \
123 CfbBits piQxelAnd[3], spiQxelAnd[6];
124#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
125 spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
126 spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \
127 spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
128 spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \
129 spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
130 spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \
131 piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
132 piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
133 piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16);
134#define RROP_SOLID24(dst,index) {\
135 switch((index) & 3){ \
136 case 0: \
137 *(dst) &= spiQxelAnd[0]; \
138 break; \
139 case 3: \
140 *(dst) &= spiQxelAnd[1]; \
141 break; \
142 case 1: \
143 *(dst) &= spiQxelAnd[2]; \
144 *((dst)+1) &= spiQxelAnd[3]; \
145 break; \
146 case 2: \
147 *(dst) &= spiQxelAnd[4]; \
148 *((dst)+1) &= spiQxelAnd[5]; \
149 break; \
150 } \
151 }
152#define RROP_SOLID(dst,idx) \
153 (*(dst) &= piQxelAnd[(idx)])
154#define RROP_SOLID_MASK(dst,mask,idx) \
155 (*(dst) &= (piQxelAnd[(idx)] | ~(mask)))
156#define RROP_UNDECLARE (void)piQxelAnd; (void)spiQxelAnd;
157#else
158#define RROP_DECLARE register CfbBits rrop_and;
159#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and;
160#define RROP_SOLID(dst) (*(dst) &= (rrop_and))
161#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask)))
162#define RROP_UNDECLARE
163#endif
164#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And)
165#endif /* GXand */
166
167#if RROP == GXor
168#if PSZ == 24
169#define RROP_DECLARE register CfbBits rrop_or; \
170 CfbBits piQxelOr[3], spiQxelOr[6];
171#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \
172 spiQxelOr[0] = rrop_or & 0xFFFFFF; \
173 spiQxelOr[1] = rrop_or << 24; \
174 spiQxelOr[2] = rrop_or << 16; \
175 spiQxelOr[3] = rrop_or << 8; \
176 spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \
177 spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \
178 piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \
179 piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \
180 piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16);
181#define RROP_SOLID24(dst,index) {\
182 switch((index) & 3){ \
183 case 0: \
184 *(dst) |= spiQxelOr[0]; \
185 break; \
186 case 3: \
187 *(dst) |= spiQxelOr[3]; \
188 break; \
189 case 1: \
190 *(dst) |= spiQxelOr[1]; \
191 *((dst)+1) |= spiQxelOr[4]; \
192 break; \
193 case 2: \
194 *(dst) |= spiQxelOr[2]; \
195 *((dst)+1) |= spiQxelOr[5]; \
196 break; \
197 } \
198 }
199#define RROP_SOLID(dst,idx) \
200 (*(dst) |= piQxelOr[(idx)])
201#define RROP_SOLID_MASK(dst,mask,idx) \
202 (*(dst) |= (piQxelOr[(idx)] & (mask)))
203#define RROP_UNDECLARE (void)piQxelOr; (void)spiQxelOr;
204#else
205#define RROP_DECLARE register CfbBits rrop_or;
206#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor;
207#define RROP_SOLID(dst) (*(dst) |= (rrop_or))
208#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask)))
209#define RROP_UNDECLARE
210#endif
211#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or)
212#endif /* GXor */
213
214#if RROP == GXnoop
215#define RROP_DECLARE
216#define RROP_FETCH_GCPRIV(devPriv)
217#define RROP_SOLID(dst)
218#define RROP_SOLID_MASK(dst,mask)
219#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Noop)
220#define RROP_UNDECLARE
221#endif /* GXnoop */
222
223#if RROP == GXset
224#if PSZ == 24
225#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \
226 CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6];
227#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
228 rrop_xor = (devPriv)->xor; \
229 spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
230 spiQxelXor[1] = rrop_xor << 24; \
231 spiQxelXor[2] = rrop_xor << 16; \
232 spiQxelXor[3] = rrop_xor << 8; \
233 spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \
234 spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
235 spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
236 spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \
237 spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \
238 spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \
239 spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
240 spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
241 piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
242 piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
243 piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \
244 piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
245 piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
246 piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
247#define RROP_SOLID24(dst,index) {\
248 switch((index) & 3){ \
249 case 0: \
250 *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
251 break; \
252 case 3: \
253 *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
254 break; \
255 case 1: \
256 *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
257 *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
258 break; \
259 case 2: \
260 *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
261 *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
262 break; \
263 } \
264 }
265#define RROP_SOLID(dst,idx) \
266 (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)]))
267#define RROP_SOLID_MASK(dst,mask,idx) \
268 (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask)))
269#define RROP_UNDECLARE (void)piQxelAnd; (void)piQxelXor; \
270 (void)spiQxelAnd; (void)spiQxelXor;
271#else
272#define RROP_DECLARE register CfbBits rrop_and, rrop_xor;
273#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
274 rrop_xor = (devPriv)->xor;
275#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor))
276#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask)))
277#define RROP_UNDECLARE
278#endif
279#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General)
280#endif /* GXset */
281
282#define RROP_UNROLL_CASE1(p,i) case (i): RROP_SOLID((p) - (i));
283#define RROP_UNROLL_CASE2(p,i) RROP_UNROLL_CASE1(p,(i)+1) RROP_UNROLL_CASE1(p,i)
284#define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i)
285#define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i)
286#define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i)
287#define RROP_UNROLL_CASE32(p,i) RROP_UNROLL_CASE16(p,(i)+16) RROP_UNROLL_CASE16(p,i)
288#define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1)
289#define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p)
290#define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p)
291#define RROP_UNROLL_CASE31(p) RROP_UNROLL_CASE16(p,16) RROP_UNROLL_CASE15(p)
292#ifdef LONG64
293#define RROP_UNROLL_CASE63(p) RROP_UNROLL_CASE32(p,32) RROP_UNROLL_CASE31(p)
294#endif /* LONG64 */
295
296#define RROP_UNROLL_LOOP1(p,i) RROP_SOLID((p) + (i));
297#define RROP_UNROLL_LOOP2(p,i) RROP_UNROLL_LOOP1(p,(i)) RROP_UNROLL_LOOP1(p,(i)+1)
298#define RROP_UNROLL_LOOP4(p,i) RROP_UNROLL_LOOP2(p,(i)) RROP_UNROLL_LOOP2(p,(i)+2)
299#define RROP_UNROLL_LOOP8(p,i) RROP_UNROLL_LOOP4(p,(i)) RROP_UNROLL_LOOP4(p,(i)+4)
300#define RROP_UNROLL_LOOP16(p,i) RROP_UNROLL_LOOP8(p,(i)) RROP_UNROLL_LOOP8(p,(i)+8)
301#define RROP_UNROLL_LOOP32(p,i) RROP_UNROLL_LOOP16(p,(i)) RROP_UNROLL_LOOP16(p,(i)+16)
302#ifdef LONG64
303#define RROP_UNROLL_LOOP64(p,i) RROP_UNROLL_LOOP32(p,(i)) RROP_UNROLL_LOOP32(p,(i)+32)
304#endif /* LONG64 */
305
306#if defined (FAST_CONSTANT_OFFSET_MODE) && defined (SHARED_IDCACHE) && (RROP == GXcopy)
307
308#ifdef LONG64
309#define RROP_UNROLL_SHIFT 6
310#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE63(p)
311#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP64(p,-64)
312#else /* not LONG64 */
313#define RROP_UNROLL_SHIFT 5
314#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE31(p)
315#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP32(p,-32)
316#endif /* LONG64 */
317#define RROP_UNROLL (1<<RROP_UNROLL_SHIFT)
318#define RROP_UNROLL_MASK (RROP_UNROLL-1)
319
320#define RROP_SPAN(pdst,nmiddle) {\
321 int part = (nmiddle) & RROP_UNROLL_MASK; \
322 (nmiddle) >>= RROP_UNROLL_SHIFT; \
323 (pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \
324 switch (part) {\
325 RROP_UNROLL_CASE((CfbBits *) (pdst)) \
326 } \
327 while (--(nmiddle) >= 0) { \
328 (pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \
329 RROP_UNROLL_LOOP((CfbBits *) (pdst)) \
330 } \
331}
332#else
333#define RROP_SPAN(pdst,nmiddle) \
334 while (--(nmiddle) >= 0) { \
335 RROP_SOLID((CfbBits *) (pdst)); \
336 (pdst) += sizeof (CfbBits) / sizeof (*pdst); \
337 }
338#endif
339
340#if !defined(UNIXCPP) || defined(ANSICPP)
341#define RROP_NAME_CAT(prefix,suffix) prefix##suffix
342#else
343#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix
344#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette