2 * Copyright © 1998 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #ifdef HAVE_DIX_CONFIG_H
24 #include <dix-config.h>
30 * Accelerated tile fill -- tile width is a power of two not greater
35 fbEvenTile(FbBits
* dst
,
42 int tileHeight
, int alu
, FbBits pm
, int xRot
, int yRot
)
44 FbBits
*t
, *tileEnd
, bits
;
45 FbBits startmask
, endmask
;
50 int startbyte
, endbyte
;
52 dst
+= dstX
>> FB_SHIFT
;
54 FbMaskBitsBytes(dstX
, width
, FbDestInvarientRop(alu
, pm
),
55 startmask
, startbyte
, nmiddle
, endmask
, endbyte
);
61 * Compute tile start scanline and rotation parameters
63 tileEnd
= tile
+ tileHeight
* tileStride
;
64 modulus(-yRot
, tileHeight
, tileY
);
65 t
= tile
+ tileY
* tileStride
;
66 modulus(-xRot
, FB_UNIT
, tileX
);
72 * Pick up bits for this scanline
78 bits
= FbRotLeft(bits
, rot
);
79 and = fbAnd(alu
, bits
, pm
);
80 xor = fbXor(alu
, bits
, pm
);
83 FbDoLeftMaskByteRRop(dst
, startbyte
, startmask
, and, xor);
92 WRITE(dst
, FbDoRRop(READ(dst
), and, xor));
96 FbDoRightMaskByteRRop(dst
, endbyte
, endmask
, and, xor);
102 fbOddTile(FbBits
* dst
,
110 int tileHeight
, int alu
, FbBits pm
, int bpp
, int xRot
, int yRot
)
117 modulus(-yRot
, tileHeight
, tileY
);
120 h
= tileHeight
- tileY
;
126 modulus(dstX
- xRot
, tileWidth
, tileX
);
128 w
= tileWidth
- tileX
;
132 fbBlt(tile
+ tileY
* tileStride
,
136 dstStride
, x
, w
, h
, alu
, pm
, bpp
, FALSE
, FALSE
);
154 int tileHeight
, int alu
, FbBits pm
, int bpp
, int xRot
, int yRot
)
156 if (FbEvenTile(tileWidth
))
157 fbEvenTile(dst
, dstStride
, dstX
, width
, height
,
158 tile
, tileStride
, tileHeight
, alu
, pm
, xRot
, yRot
);
160 fbOddTile(dst
, dstStride
, dstX
, width
, height
,
161 tile
, tileStride
, tileWidth
, tileHeight
,
162 alu
, pm
, bpp
, xRot
, yRot
);