VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.4.2/fastblt.h@ 68495

Last change on this file since 68495 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1/*
2
3Copyright 1989, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26
27*/
28
29/*
30 * Fast bitblt macros for certain hardware. If your machine has an addressing
31 * mode of small constant + register, you'll probably want this magic specific
32 * code. It's 25% faster for the R2000. I haven't studied the Sparc
33 * instruction set, but I suspect it also has this addressing mode. Also,
34 * unrolling the loop by 32 is possibly excessive for mfb. The number of times
35 * the loop is actually looped through is pretty small.
36 */
37
38/*
39 * WARNING: These macros make *a lot* of assumptions about
40 * the environment they are invoked in. Plenty of implicit
41 * arguments, lots of side effects. Don't use them casually.
42 */
43
44#define SwitchOdd(n) case n: BodyOdd(n)
45#define SwitchEven(n) case n: BodyEven(n)
46
47/* to allow mfb and cfb to share code... */
48#ifdef HAVE_DIX_CONFIG_H
49#include <dix-config.h>
50#endif
51
52#ifndef BitRight
53#define BitRight(a,b) SCRRIGHT(a,b)
54#define BitLeft(a,b) SCRLEFT(a,b)
55#endif
56
57#ifdef LARGE_INSTRUCTION_CACHE
58#define UNROLL 8
59#define PackedLoop \
60 switch (nl & (UNROLL-1)) { \
61 SwitchOdd( 7) SwitchEven( 6) SwitchOdd( 5) SwitchEven( 4) \
62 SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
63 } \
64 while ((nl -= UNROLL) >= 0) { \
65 LoopReset \
66 BodyEven( 8) \
67 BodyOdd( 7) BodyEven( 6) BodyOdd( 5) BodyEven( 4) \
68 BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
69 }
70#else
71#define UNROLL 4
72#define PackedLoop \
73 switch (nl & (UNROLL-1)) { \
74 SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
75 } \
76 while ((nl -= UNROLL) >= 0) { \
77 LoopReset \
78 BodyEven( 4) \
79 BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
80 }
81#endif
82
83#define DuffL(counter,label,body) \
84 switch (counter & 3) { \
85 label: \
86 body \
87 case 3: \
88 body \
89 case 2: \
90 body \
91 case 1: \
92 body \
93 case 0: \
94 if ((counter -= 4) >= 0) \
95 goto label; \
96 }
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