Initial commit
[xorg_rtime.git] / xorg-server-1.4 / fb / fb.h
blobdf430b8fd50f56adb2da25f72e440ecab5179fb5
1 /*
3 * Copyright © 1998 Keith Packard
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Keith Packard makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
25 #ifndef _FB_H_
26 #define _FB_H_
28 #include <X11/X.h>
29 #include <pixman.h>
31 #include "scrnintstr.h"
32 #include "pixmap.h"
33 #include "pixmapstr.h"
34 #include "region.h"
35 #include "gcstruct.h"
36 #include "colormap.h"
37 #include "miscstruct.h"
38 #include "servermd.h"
39 #include "windowstr.h"
40 #include "mi.h"
41 #include "migc.h"
42 #include "mibstore.h"
43 #ifdef RENDER
44 #include "picturestr.h"
45 #else
46 #include "picture.h"
47 #endif
49 #ifdef FB_ACCESS_WRAPPER
51 #include "wfbrename.h"
52 #define FBPREFIX(x) wfb##x
53 #define WRITE(ptr, val) ((*wfbWriteMemory)((ptr), (val), sizeof(*(ptr))))
54 #define READ(ptr) ((*wfbReadMemory)((ptr), sizeof(*(ptr))))
56 #define MEMCPY_WRAPPED(dst, src, size) do { \
57 size_t _i; \
58 CARD8 *_dst = (CARD8*)(dst), *_src = (CARD8*)(src); \
59 for(_i = 0; _i < size; _i++) { \
60 WRITE(_dst +_i, READ(_src + _i)); \
61 } \
62 } while(0)
64 #define MEMSET_WRAPPED(dst, val, size) do { \
65 size_t _i; \
66 CARD8 *_dst = (CARD8*)(dst); \
67 for(_i = 0; _i < size; _i++) { \
68 WRITE(_dst +_i, (val)); \
69 } \
70 } while(0)
72 #else
74 #define FBPREFIX(x) fb##x
75 #define WRITE(ptr, val) (*(ptr) = (val))
76 #define READ(ptr) (*(ptr))
77 #define MEMCPY_WRAPPED(dst, src, size) memcpy((dst), (src), (size))
78 #define MEMSET_WRAPPED(dst, val, size) memset((dst), (val), (size))
80 #endif
83 * This single define controls the basic size of data manipulated
84 * by this software; it must be log2(sizeof (FbBits) * 8)
87 #ifndef FB_SHIFT
88 #define FB_SHIFT LOG2_BITMAP_PAD
89 #endif
91 #if FB_SHIFT < LOG2_BITMAP_PAD
92 error FB_SHIFT must be >= LOG2_BITMAP_PAD
93 #endif
95 #define FB_UNIT (1 << FB_SHIFT)
96 #define FB_HALFUNIT (1 << (FB_SHIFT-1))
97 #define FB_MASK (FB_UNIT - 1)
98 #define FB_ALLONES ((FbBits) -1)
100 #if GLYPHPADBYTES != 4
101 #error "GLYPHPADBYTES must be 4"
102 #endif
103 #if GETLEFTBITS_ALIGNMENT != 1
104 #error "GETLEFTBITS_ALIGNMENT must be 1"
105 #endif
106 /* whether to bother to include 24bpp support */
107 #ifndef FBNO24BIT
108 #define FB_24BIT
109 #endif
112 * Unless otherwise instructed, fb includes code to advertise 24bpp
113 * windows with 32bpp image format for application compatibility
116 #ifdef FB_24BIT
117 #ifndef FBNO24_32
118 #define FB_24_32BIT
119 #endif
120 #endif
122 #define FB_STIP_SHIFT LOG2_BITMAP_PAD
123 #define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
124 #define FB_STIP_MASK (FB_STIP_UNIT - 1)
125 #define FB_STIP_ALLONES ((FbStip) -1)
127 #define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
128 #define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
130 #define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
131 #define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
133 #define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
135 #if FB_SHIFT == 6
136 # ifdef WIN32
137 typedef unsigned __int64 FbBits;
138 # else
139 # if defined(__alpha__) || defined(__alpha) || \
140 defined(ia64) || defined(__ia64__) || \
141 defined(__sparc64__) || defined(_LP64) || \
142 defined(__s390x__) || \
143 defined(amd64) || defined (__amd64__) || \
144 defined (__powerpc64__) || \
145 (defined(sgi) && (_MIPS_SZLONG == 64))
146 typedef unsigned long FbBits;
147 # else
148 typedef unsigned long long FbBits;
149 # endif
150 # endif
151 #endif
153 #if FB_SHIFT == 5
154 typedef CARD32 FbBits;
155 #endif
157 #if FB_SHIFT == 4
158 typedef CARD16 FbBits;
159 #endif
161 #if LOG2_BITMAP_PAD == FB_SHIFT
162 typedef FbBits FbStip;
163 #else
164 # if LOG2_BITMAP_PAD == 5
165 typedef CARD32 FbStip;
166 # endif
167 #endif
169 typedef int FbStride;
172 #ifdef FB_DEBUG
173 extern void fbValidateDrawable(DrawablePtr d);
174 extern void fbInitializeDrawable(DrawablePtr d);
175 extern void fbSetBits (FbStip *bits, int stride, FbStip data);
176 #define FB_HEAD_BITS (FbStip) (0xbaadf00d)
177 #define FB_TAIL_BITS (FbStip) (0xbaddf0ad)
178 #else
179 #define fbValidateDrawable(d)
180 #define fdInitializeDrawable(d)
181 #endif
183 #include "fbrop.h"
185 #if BITMAP_BIT_ORDER == LSBFirst
186 #define FbScrLeft(x,n) ((x) >> (n))
187 #define FbScrRight(x,n) ((x) << (n))
188 /* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */
189 #define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1))
190 #define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n)))
191 #define FbPatternOffsetBits 0
192 #else
193 #define FbScrLeft(x,n) ((x) << (n))
194 #define FbScrRight(x,n) ((x) >> (n))
195 /* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */
196 #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
197 #define FbStipMoveLsb(x,s,n) (x)
198 #define FbPatternOffsetBits (sizeof (FbBits) - 1)
199 #endif
201 #include "micoord.h"
203 #define FbStipLeft(x,n) FbScrLeft(x,n)
204 #define FbStipRight(x,n) FbScrRight(x,n)
206 #define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0)
207 #define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0)
209 #define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0)
210 #define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0)
212 #define FbLeftMask(x) ( ((x) & FB_MASK) ? \
213 FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
214 #define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
215 FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
217 #define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \
218 FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0)
219 #define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \
220 FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0)
222 #define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \
223 FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK))
225 #define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
226 FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
229 #define FbMaskBits(x,w,l,n,r) { \
230 n = (w); \
231 r = FbRightMask((x)+n); \
232 l = FbLeftMask(x); \
233 if (l) { \
234 n -= FB_UNIT - ((x) & FB_MASK); \
235 if (n < 0) { \
236 n = 0; \
237 l &= r; \
238 r = 0; \
241 n >>= FB_SHIFT; \
244 #ifdef FBNOPIXADDR
245 #define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) FbMaskBits(x,w,l,n,r)
246 #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
247 *dst = FbDoMaskRRop(*dst,and,xor,l); \
249 #define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
250 *dst = FbDoMaskRRop(*dst,and,xor,r); \
252 #else
254 #define FbByteMaskInvalid 0x10
256 #define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1)))
258 #define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o)))
259 #define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3))
260 #define FbStorePart(dst,off,t,xor) (WRITE(FbPtrOffset(dst,off,t), \
261 FbSelectPart(xor,off,t)))
262 #ifndef FbSelectPart
263 #define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
264 #endif
266 #define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \
267 n = (w); \
268 lb = 0; \
269 rb = 0; \
270 r = FbRightMask((x)+n); \
271 if (r) { \
272 /* compute right byte length */ \
273 if ((copy) && (((x) + n) & 7) == 0) { \
274 rb = (((x) + n) & FB_MASK) >> 3; \
275 } else { \
276 rb = FbByteMaskInvalid; \
279 l = FbLeftMask(x); \
280 if (l) { \
281 /* compute left byte length */ \
282 if ((copy) && ((x) & 7) == 0) { \
283 lb = ((x) & FB_MASK) >> 3; \
284 } else { \
285 lb = FbByteMaskInvalid; \
287 /* subtract out the portion painted by leftMask */ \
288 n -= FB_UNIT - ((x) & FB_MASK); \
289 if (n < 0) { \
290 if (lb != FbByteMaskInvalid) { \
291 if (rb == FbByteMaskInvalid) { \
292 lb = FbByteMaskInvalid; \
293 } else if (rb) { \
294 lb |= (rb - lb) << (FB_SHIFT - 3); \
295 rb = 0; \
298 n = 0; \
299 l &= r; \
300 r = 0; \
303 n >>= FB_SHIFT; \
306 #if FB_SHIFT == 6
307 #define FbDoLeftMaskByteRRop6Cases(dst,xor) \
308 case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \
309 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
310 break; \
311 case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \
312 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
313 FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
314 break; \
315 case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \
316 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
317 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
318 break; \
319 case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \
320 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
321 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
322 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
323 break; \
324 case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \
325 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
326 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
327 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
328 break; \
329 case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \
330 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
331 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
332 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
333 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
334 break; \
335 case (sizeof (FbBits) - 7): \
336 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
337 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
338 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
339 break; \
340 case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \
341 FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
342 break; \
343 case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \
344 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
345 break; \
346 case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \
347 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
348 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
349 break; \
350 case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \
351 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
352 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
353 break; \
354 case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \
355 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
356 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
357 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
358 break; \
359 case (sizeof (FbBits) - 6): \
360 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
361 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
362 break; \
363 case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \
364 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
365 break; \
366 case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \
367 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
368 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
369 break; \
370 case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \
371 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
372 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
373 break; \
374 case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \
375 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
376 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
377 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
378 break; \
379 case (sizeof (FbBits) - 5): \
380 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
381 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
382 break; \
383 case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \
384 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
385 break; \
386 case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \
387 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
388 break; \
389 case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \
390 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
391 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
392 break; \
393 case (sizeof (FbBits) - 4): \
394 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
395 break;
397 #define FbDoRightMaskByteRRop6Cases(dst,xor) \
398 case 4: \
399 FbStorePart(dst,0,CARD32,xor); \
400 break; \
401 case 5: \
402 FbStorePart(dst,0,CARD32,xor); \
403 FbStorePart(dst,4,CARD8,xor); \
404 break; \
405 case 6: \
406 FbStorePart(dst,0,CARD32,xor); \
407 FbStorePart(dst,4,CARD16,xor); \
408 break; \
409 case 7: \
410 FbStorePart(dst,0,CARD32,xor); \
411 FbStorePart(dst,4,CARD16,xor); \
412 FbStorePart(dst,6,CARD8,xor); \
413 break;
414 #else
415 #define FbDoLeftMaskByteRRop6Cases(dst,xor)
416 #define FbDoRightMaskByteRRop6Cases(dst,xor)
417 #endif
419 #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
420 switch (lb) { \
421 FbDoLeftMaskByteRRop6Cases(dst,xor) \
422 case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \
423 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
424 break; \
425 case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \
426 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
427 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
428 break; \
429 case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \
430 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
431 break; \
432 case sizeof (FbBits) - 3: \
433 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
434 case sizeof (FbBits) - 2: \
435 FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \
436 break; \
437 case sizeof (FbBits) - 1: \
438 FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \
439 break; \
440 default: \
441 WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, l)); \
442 break; \
447 #define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
448 switch (rb) { \
449 case 1: \
450 FbStorePart(dst,0,CARD8,xor); \
451 break; \
452 case 2: \
453 FbStorePart(dst,0,CARD16,xor); \
454 break; \
455 case 3: \
456 FbStorePart(dst,0,CARD16,xor); \
457 FbStorePart(dst,2,CARD8,xor); \
458 break; \
459 FbDoRightMaskByteRRop6Cases(dst,xor) \
460 default: \
461 WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, r)); \
464 #endif
466 #define FbMaskStip(x,w,l,n,r) { \
467 n = (w); \
468 r = FbRightStipMask((x)+n); \
469 l = FbLeftStipMask(x); \
470 if (l) { \
471 n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \
472 if (n < 0) { \
473 n = 0; \
474 l &= r; \
475 r = 0; \
478 n >>= FB_STIP_SHIFT; \
482 * These macros are used to transparently stipple
483 * in copy mode; the expected usage is with 'n' constant
484 * so all of the conditional parts collapse into a minimal
485 * sequence of partial word writes
487 * 'n' is the bytemask of which bytes to store, 'a' is the address
488 * of the FbBits base unit, 'o' is the offset within that unit
490 * The term "lane" comes from the hardware term "byte-lane" which
493 #define FbLaneCase1(n,a,o) ((n) == 0x01 ? (void) \
494 WRITE((CARD8 *) ((a)+FbPatternOffset(o,CARD8)), \
495 fgxor) : (void) 0)
496 #define FbLaneCase2(n,a,o) ((n) == 0x03 ? (void) \
497 WRITE((CARD16 *) ((a)+FbPatternOffset(o,CARD16)), \
498 fgxor) : \
499 ((void)FbLaneCase1((n)&1,a,o), \
500 FbLaneCase1((n)>>1,a,(o)+1)))
501 #define FbLaneCase4(n,a,o) ((n) == 0x0f ? (void) \
502 WRITE((CARD32 *) ((a)+FbPatternOffset(o,CARD32)), \
503 fgxor) : \
504 ((void)FbLaneCase2((n)&3,a,o), \
505 FbLaneCase2((n)>>2,a,(o)+2)))
506 #define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (void) (*(FbBits *) ((a)+(o)) = fgxor) : \
507 ((void)FbLaneCase4((n)&15,a,o), \
508 FbLaneCase4((n)>>4,a,(o)+4)))
510 #if FB_SHIFT == 6
511 #define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0)
512 #endif
514 #if FB_SHIFT == 5
515 #define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0)
516 #endif
518 /* Rotate a filled pixel value to the specified alignement */
519 #define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
520 #define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b)))
522 /* step a filled pixel value to the next/previous FB_UNIT alignment */
523 #define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24)))
524 #define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24))
525 #define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24)))
526 #define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24))
528 /* step a rotation value to the next/previous rotation value */
529 #if FB_UNIT == 64
530 #define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8)
531 #define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8)
533 #if IMAGE_BYTE_ORDER == MSBFirst
534 #define FbFirst24Rot(x) (((x) + 8) % 24)
535 #else
536 #define FbFirst24Rot(x) ((x) % 24)
537 #endif
539 #endif
541 #if FB_UNIT == 32
542 #define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8)
543 #define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8)
545 #if IMAGE_BYTE_ORDER == MSBFirst
546 #define FbFirst24Rot(x) (((x) + 16) % 24)
547 #else
548 #define FbFirst24Rot(x) ((x) % 24)
549 #endif
550 #endif
552 #define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8)
553 #define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8)
555 /* Whether 24-bit specific code is needed for this filled pixel value */
556 #define FbCheck24Pix(p) ((p) == FbNext24Pix(p))
558 /* Macros for dealing with dashing */
560 #define FbDashDeclare \
561 unsigned char *__dash, *__firstDash, *__lastDash
563 #define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
564 (even) = TRUE; \
565 __firstDash = (pGC)->dash; \
566 __lastDash = __firstDash + (pGC)->numInDashList; \
567 (dashOffset) %= (pPriv)->dashLength; \
569 __dash = __firstDash; \
570 while ((dashOffset) >= ((dashlen) = *__dash)) \
572 (dashOffset) -= (dashlen); \
573 (even) = 1-(even); \
574 if (++__dash == __lastDash) \
575 __dash = __firstDash; \
577 (dashlen) -= (dashOffset); \
580 #define FbDashNext(dashlen) { \
581 if (++__dash == __lastDash) \
582 __dash = __firstDash; \
583 (dashlen) = *__dash; \
586 /* as numInDashList is always even, this case can skip a test */
588 #define FbDashNextEven(dashlen) { \
589 (dashlen) = *++__dash; \
592 #define FbDashNextOdd(dashlen) FbDashNext(dashlen)
594 #define FbDashStep(dashlen,even) { \
595 if (!--(dashlen)) { \
596 FbDashNext(dashlen); \
597 (even) = 1-(even); \
601 /* XXX fb*PrivateIndex should be static, but it breaks the ABI */
603 extern int fbGCPrivateIndex;
604 extern int fbGetGCPrivateIndex(void);
605 #ifndef FB_NO_WINDOW_PIXMAPS
606 extern int fbWinPrivateIndex;
607 extern int fbGetWinPrivateIndex(void);
608 #endif
609 extern const GCOps fbGCOps;
610 extern const GCFuncs fbGCFuncs;
612 #ifdef FB_24_32BIT
613 #define FB_SCREEN_PRIVATE
614 #endif
616 /* Framebuffer access wrapper */
617 typedef FbBits (*ReadMemoryProcPtr)(const void *src, int size);
618 typedef void (*WriteMemoryProcPtr)(void *dst, FbBits value, int size);
619 typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr *pRead,
620 WriteMemoryProcPtr *pWrite,
621 DrawablePtr pDraw);
622 typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
624 #ifdef FB_ACCESS_WRAPPER
626 #define fbPrepareAccess(pDraw) \
627 fbGetScreenPrivate((pDraw)->pScreen)->setupWrap( \
628 &wfbReadMemory, \
629 &wfbWriteMemory, \
630 (pDraw))
631 #define fbFinishAccess(pDraw) \
632 fbGetScreenPrivate((pDraw)->pScreen)->finishWrap(pDraw)
634 #else
636 #define fbPrepareAccess(pPix)
637 #define fbFinishAccess(pDraw)
639 #endif
642 #ifdef FB_SCREEN_PRIVATE
643 extern int fbScreenPrivateIndex;
644 extern int fbGetScreenPrivateIndex(void);
646 /* private field of a screen */
647 typedef struct {
648 unsigned char win32bpp; /* window bpp for 32-bpp images */
649 unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
650 #ifdef FB_ACCESS_WRAPPER
651 SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
652 FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
653 #endif
654 } FbScreenPrivRec, *FbScreenPrivPtr;
656 #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
657 (pScreen)->devPrivates[fbGetScreenPrivateIndex()].ptr)
658 #endif
660 /* private field of GC */
661 typedef struct {
662 FbBits and, xor; /* reduced rop values */
663 FbBits bgand, bgxor; /* for stipples */
664 FbBits fg, bg, pm; /* expanded and filled */
665 unsigned int dashLength; /* total of all dash elements */
666 unsigned char oneRect; /* clip list is single rectangle */
667 unsigned char evenStipple; /* stipple is even */
668 unsigned char bpp; /* current drawable bpp */
669 } FbGCPrivRec, *FbGCPrivPtr;
671 #define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
672 (pGC)->devPrivates[fbGetGCPrivateIndex()].ptr)
674 #define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
675 #define fbGetExpose(pGC) ((pGC)->fExpose)
676 #define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip)
677 #define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
679 #define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
680 #ifdef FB_NO_WINDOW_PIXMAPS
681 #define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen)
682 #else
683 #define fbGetWindowPixmap(pWin) ((PixmapPtr)\
684 ((WindowPtr) (pWin))->devPrivates[fbGetWinPrivateIndex()].ptr)
685 #endif
687 #ifdef ROOTLESS
688 #define __fbPixDrawableX(pPix) ((pPix)->drawable.x)
689 #define __fbPixDrawableY(pPix) ((pPix)->drawable.y)
690 #else
691 #define __fbPixDrawableX(pPix) 0
692 #define __fbPixDrawableY(pPix) 0
693 #endif
695 #ifdef COMPOSITE
696 #define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix) - (pPix)->screen_x)
697 #define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix) - (pPix)->screen_y)
698 #else
699 #define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix))
700 #define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix))
701 #endif
702 #define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
703 #define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
705 #define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
706 PixmapPtr _pPix; \
707 if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
708 _pPix = fbGetWindowPixmap(pDrawable); \
709 (xoff) = __fbPixOffXWin(_pPix); \
710 (yoff) = __fbPixOffYWin(_pPix); \
711 } else { \
712 _pPix = (PixmapPtr) (pDrawable); \
713 (xoff) = __fbPixOffXPix(_pPix); \
714 (yoff) = __fbPixOffYPix(_pPix); \
716 fbPrepareAccess(pDrawable); \
717 (pointer) = (FbBits *) _pPix->devPrivate.ptr; \
718 (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
719 (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
722 #define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
723 PixmapPtr _pPix; \
724 if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
725 _pPix = fbGetWindowPixmap(pDrawable); \
726 (xoff) = __fbPixOffXWin(_pPix); \
727 (yoff) = __fbPixOffYWin(_pPix); \
728 } else { \
729 _pPix = (PixmapPtr) (pDrawable); \
730 (xoff) = __fbPixOffXPix(_pPix); \
731 (yoff) = __fbPixOffYPix(_pPix); \
733 fbPrepareAccess(pDrawable); \
734 (pointer) = (FbStip *) _pPix->devPrivate.ptr; \
735 (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
736 (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
740 * XFree86 empties the root BorderClip when the VT is inactive,
741 * here's a macro which uses that to disable GetImage and GetSpans
744 #define fbWindowEnabled(pWin) \
745 REGION_NOTEMPTY((pWin)->drawable.pScreen, \
746 &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
748 #define fbDrawableEnabled(pDrawable) \
749 ((pDrawable)->type == DRAWABLE_PIXMAP ? \
750 TRUE : fbWindowEnabled((WindowPtr) pDrawable))
752 #define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
754 * Accelerated tiles are power of 2 width <= FB_UNIT
756 #define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w))
758 * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp
759 * with dstBpp a power of 2 as well
761 #define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp))
764 * fb24_32.c
766 void
767 fb24_32GetSpans(DrawablePtr pDrawable,
768 int wMax,
769 DDXPointPtr ppt,
770 int *pwidth,
771 int nspans,
772 char *pchardstStart);
774 void
775 fb24_32SetSpans (DrawablePtr pDrawable,
776 GCPtr pGC,
777 char *src,
778 DDXPointPtr ppt,
779 int *pwidth,
780 int nspans,
781 int fSorted);
783 void
784 fb24_32PutZImage (DrawablePtr pDrawable,
785 RegionPtr pClip,
786 int alu,
787 FbBits pm,
788 int x,
789 int y,
790 int width,
791 int height,
792 CARD8 *src,
793 FbStride srcStride);
795 void
796 fb24_32GetImage (DrawablePtr pDrawable,
797 int x,
798 int y,
799 int w,
800 int h,
801 unsigned int format,
802 unsigned long planeMask,
803 char *d);
805 void
806 fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
807 DrawablePtr pDstDrawable,
808 GCPtr pGC,
809 BoxPtr pbox,
810 int nbox,
811 int dx,
812 int dy,
813 Bool reverse,
814 Bool upsidedown,
815 Pixel bitplane,
816 void *closure);
818 PixmapPtr
819 fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
821 Bool
822 fb24_32CreateScreenResources(ScreenPtr pScreen);
824 Bool
825 fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
826 int width,
827 int height,
828 int depth,
829 int bitsPerPixel,
830 int devKind,
831 pointer pPixData);
834 * fballpriv.c
836 Bool
837 fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex);
840 * fbarc.c
843 void
844 fbPolyArc (DrawablePtr pDrawable,
845 GCPtr pGC,
846 int narcs,
847 xArc *parcs);
850 * fbbits.c
853 void
854 fbBresSolid8(DrawablePtr pDrawable,
855 GCPtr pGC,
856 int dashOffset,
857 int signdx,
858 int signdy,
859 int axis,
860 int x,
861 int y,
862 int e,
863 int e1,
864 int e3,
865 int len);
867 void
868 fbBresDash8 (DrawablePtr pDrawable,
869 GCPtr pGC,
870 int dashOffset,
871 int signdx,
872 int signdy,
873 int axis,
874 int x,
875 int y,
876 int e,
877 int e1,
878 int e3,
879 int len);
881 void
882 fbDots8 (FbBits *dst,
883 FbStride dstStride,
884 int dstBpp,
885 BoxPtr pBox,
886 xPoint *pts,
887 int npt,
888 int xorg,
889 int yorg,
890 int xoff,
891 int yoff,
892 FbBits and,
893 FbBits xor);
895 void
896 fbArc8 (FbBits *dst,
897 FbStride dstStride,
898 int dstBpp,
899 xArc *arc,
900 int dx,
901 int dy,
902 FbBits and,
903 FbBits xor);
905 void
906 fbGlyph8 (FbBits *dstLine,
907 FbStride dstStride,
908 int dstBpp,
909 FbStip *stipple,
910 FbBits fg,
911 int height,
912 int shift);
914 void
915 fbPolyline8 (DrawablePtr pDrawable,
916 GCPtr pGC,
917 int mode,
918 int npt,
919 DDXPointPtr ptsOrig);
921 void
922 fbPolySegment8 (DrawablePtr pDrawable,
923 GCPtr pGC,
924 int nseg,
925 xSegment *pseg);
927 void
928 fbBresSolid16(DrawablePtr pDrawable,
929 GCPtr pGC,
930 int dashOffset,
931 int signdx,
932 int signdy,
933 int axis,
934 int x,
935 int y,
936 int e,
937 int e1,
938 int e3,
939 int len);
941 void
942 fbBresDash16(DrawablePtr pDrawable,
943 GCPtr pGC,
944 int dashOffset,
945 int signdx,
946 int signdy,
947 int axis,
948 int x,
949 int y,
950 int e,
951 int e1,
952 int e3,
953 int len);
955 void
956 fbDots16(FbBits *dst,
957 FbStride dstStride,
958 int dstBpp,
959 BoxPtr pBox,
960 xPoint *pts,
961 int npt,
962 int xorg,
963 int yorg,
964 int xoff,
965 int yoff,
966 FbBits and,
967 FbBits xor);
969 void
970 fbArc16(FbBits *dst,
971 FbStride dstStride,
972 int dstBpp,
973 xArc *arc,
974 int dx,
975 int dy,
976 FbBits and,
977 FbBits xor);
979 void
980 fbGlyph16(FbBits *dstLine,
981 FbStride dstStride,
982 int dstBpp,
983 FbStip *stipple,
984 FbBits fg,
985 int height,
986 int shift);
988 void
989 fbPolyline16 (DrawablePtr pDrawable,
990 GCPtr pGC,
991 int mode,
992 int npt,
993 DDXPointPtr ptsOrig);
995 void
996 fbPolySegment16 (DrawablePtr pDrawable,
997 GCPtr pGC,
998 int nseg,
999 xSegment *pseg);
1002 void
1003 fbBresSolid24(DrawablePtr pDrawable,
1004 GCPtr pGC,
1005 int dashOffset,
1006 int signdx,
1007 int signdy,
1008 int axis,
1009 int x,
1010 int y,
1011 int e,
1012 int e1,
1013 int e3,
1014 int len);
1016 void
1017 fbBresDash24(DrawablePtr pDrawable,
1018 GCPtr pGC,
1019 int dashOffset,
1020 int signdx,
1021 int signdy,
1022 int axis,
1023 int x,
1024 int y,
1025 int e,
1026 int e1,
1027 int e3,
1028 int len);
1030 void
1031 fbDots24(FbBits *dst,
1032 FbStride dstStride,
1033 int dstBpp,
1034 BoxPtr pBox,
1035 xPoint *pts,
1036 int npt,
1037 int xorg,
1038 int yorg,
1039 int xoff,
1040 int yoff,
1041 FbBits and,
1042 FbBits xor);
1044 void
1045 fbArc24(FbBits *dst,
1046 FbStride dstStride,
1047 int dstBpp,
1048 xArc *arc,
1049 int dx,
1050 int dy,
1051 FbBits and,
1052 FbBits xor);
1054 void
1055 fbGlyph24(FbBits *dstLine,
1056 FbStride dstStride,
1057 int dstBpp,
1058 FbStip *stipple,
1059 FbBits fg,
1060 int height,
1061 int shift);
1063 void
1064 fbPolyline24 (DrawablePtr pDrawable,
1065 GCPtr pGC,
1066 int mode,
1067 int npt,
1068 DDXPointPtr ptsOrig);
1070 void
1071 fbPolySegment24 (DrawablePtr pDrawable,
1072 GCPtr pGC,
1073 int nseg,
1074 xSegment *pseg);
1077 void
1078 fbBresSolid32(DrawablePtr pDrawable,
1079 GCPtr pGC,
1080 int dashOffset,
1081 int signdx,
1082 int signdy,
1083 int axis,
1084 int x,
1085 int y,
1086 int e,
1087 int e1,
1088 int e3,
1089 int len);
1091 void
1092 fbBresDash32(DrawablePtr pDrawable,
1093 GCPtr pGC,
1094 int dashOffset,
1095 int signdx,
1096 int signdy,
1097 int axis,
1098 int x,
1099 int y,
1100 int e,
1101 int e1,
1102 int e3,
1103 int len);
1105 void
1106 fbDots32(FbBits *dst,
1107 FbStride dstStride,
1108 int dstBpp,
1109 BoxPtr pBox,
1110 xPoint *pts,
1111 int npt,
1112 int xorg,
1113 int yorg,
1114 int xoff,
1115 int yoff,
1116 FbBits and,
1117 FbBits xor);
1119 void
1120 fbArc32(FbBits *dst,
1121 FbStride dstStride,
1122 int dstBpp,
1123 xArc *arc,
1124 int dx,
1125 int dy,
1126 FbBits and,
1127 FbBits xor);
1129 void
1130 fbGlyph32(FbBits *dstLine,
1131 FbStride dstStride,
1132 int dstBpp,
1133 FbStip *stipple,
1134 FbBits fg,
1135 int height,
1136 int shift);
1137 void
1138 fbPolyline32 (DrawablePtr pDrawable,
1139 GCPtr pGC,
1140 int mode,
1141 int npt,
1142 DDXPointPtr ptsOrig);
1144 void
1145 fbPolySegment32 (DrawablePtr pDrawable,
1146 GCPtr pGC,
1147 int nseg,
1148 xSegment *pseg);
1151 * fbblt.c
1153 void
1154 fbBlt (FbBits *src,
1155 FbStride srcStride,
1156 int srcX,
1158 FbBits *dst,
1159 FbStride dstStride,
1160 int dstX,
1162 int width,
1163 int height,
1165 int alu,
1166 FbBits pm,
1167 int bpp,
1169 Bool reverse,
1170 Bool upsidedown);
1172 void
1173 fbBlt24 (FbBits *srcLine,
1174 FbStride srcStride,
1175 int srcX,
1177 FbBits *dstLine,
1178 FbStride dstStride,
1179 int dstX,
1181 int width,
1182 int height,
1184 int alu,
1185 FbBits pm,
1187 Bool reverse,
1188 Bool upsidedown);
1190 void
1191 fbBltStip (FbStip *src,
1192 FbStride srcStride, /* in FbStip units, not FbBits units */
1193 int srcX,
1195 FbStip *dst,
1196 FbStride dstStride, /* in FbStip units, not FbBits units */
1197 int dstX,
1199 int width,
1200 int height,
1202 int alu,
1203 FbBits pm,
1204 int bpp);
1207 * fbbltone.c
1209 void
1210 fbBltOne (FbStip *src,
1211 FbStride srcStride,
1212 int srcX,
1213 FbBits *dst,
1214 FbStride dstStride,
1215 int dstX,
1216 int dstBpp,
1218 int width,
1219 int height,
1221 FbBits fgand,
1222 FbBits fbxor,
1223 FbBits bgand,
1224 FbBits bgxor);
1226 #ifdef FB_24BIT
1227 void
1228 fbBltOne24 (FbStip *src,
1229 FbStride srcStride, /* FbStip units per scanline */
1230 int srcX, /* bit position of source */
1231 FbBits *dst,
1232 FbStride dstStride, /* FbBits units per scanline */
1233 int dstX, /* bit position of dest */
1234 int dstBpp, /* bits per destination unit */
1236 int width, /* width in bits of destination */
1237 int height, /* height in scanlines */
1239 FbBits fgand, /* rrop values */
1240 FbBits fgxor,
1241 FbBits bgand,
1242 FbBits bgxor);
1243 #endif
1245 void
1246 fbBltPlane (FbBits *src,
1247 FbStride srcStride,
1248 int srcX,
1249 int srcBpp,
1251 FbStip *dst,
1252 FbStride dstStride,
1253 int dstX,
1255 int width,
1256 int height,
1258 FbStip fgand,
1259 FbStip fgxor,
1260 FbStip bgand,
1261 FbStip bgxor,
1262 Pixel planeMask);
1265 * fbbstore.c
1267 void
1268 fbSaveAreas(PixmapPtr pPixmap,
1269 RegionPtr prgnSave,
1270 int xorg,
1271 int yorg,
1272 WindowPtr pWin);
1274 void
1275 fbRestoreAreas(PixmapPtr pPixmap,
1276 RegionPtr prgnRestore,
1277 int xorg,
1278 int yorg,
1279 WindowPtr pWin);
1282 * fbcmap.c
1285 fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
1287 void
1288 fbInstallColormap(ColormapPtr pmap);
1290 void
1291 fbUninstallColormap(ColormapPtr pmap);
1293 void
1294 fbResolveColor(unsigned short *pred,
1295 unsigned short *pgreen,
1296 unsigned short *pblue,
1297 VisualPtr pVisual);
1299 Bool
1300 fbInitializeColormap(ColormapPtr pmap);
1303 fbExpandDirectColors (ColormapPtr pmap,
1304 int ndef,
1305 xColorItem *indefs,
1306 xColorItem *outdefs);
1308 Bool
1309 fbCreateDefColormap(ScreenPtr pScreen);
1311 void
1312 fbClearVisualTypes(void);
1314 Bool
1315 fbHasVisualTypes (int depth);
1317 Bool
1318 fbSetVisualTypes (int depth, int visuals, int bitsPerRGB);
1320 Bool
1321 fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
1322 Pixel redMask, Pixel greenMask, Pixel blueMask);
1324 Bool
1325 fbInitVisuals (VisualPtr *visualp,
1326 DepthPtr *depthp,
1327 int *nvisualp,
1328 int *ndepthp,
1329 int *rootDepthp,
1330 VisualID *defaultVisp,
1331 unsigned long sizes,
1332 int bitsPerRGB);
1335 * fbcopy.c
1338 typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
1339 DrawablePtr pDstDrawable,
1340 GCPtr pGC,
1341 BoxPtr pDstBox,
1342 int nbox,
1343 int dx,
1344 int dy,
1345 Bool reverse,
1346 Bool upsidedown,
1347 Pixel bitplane,
1348 void *closure);
1350 void
1351 fbCopyNtoN (DrawablePtr pSrcDrawable,
1352 DrawablePtr pDstDrawable,
1353 GCPtr pGC,
1354 BoxPtr pbox,
1355 int nbox,
1356 int dx,
1357 int dy,
1358 Bool reverse,
1359 Bool upsidedown,
1360 Pixel bitplane,
1361 void *closure);
1363 void
1364 fbCopy1toN (DrawablePtr pSrcDrawable,
1365 DrawablePtr pDstDrawable,
1366 GCPtr pGC,
1367 BoxPtr pbox,
1368 int nbox,
1369 int dx,
1370 int dy,
1371 Bool reverse,
1372 Bool upsidedown,
1373 Pixel bitplane,
1374 void *closure);
1376 void
1377 fbCopyNto1 (DrawablePtr pSrcDrawable,
1378 DrawablePtr pDstDrawable,
1379 GCPtr pGC,
1380 BoxPtr pbox,
1381 int nbox,
1382 int dx,
1383 int dy,
1384 Bool reverse,
1385 Bool upsidedown,
1386 Pixel bitplane,
1387 void *closure);
1389 void
1390 fbCopyRegion (DrawablePtr pSrcDrawable,
1391 DrawablePtr pDstDrawable,
1392 GCPtr pGC,
1393 RegionPtr pDstRegion,
1394 int dx,
1395 int dy,
1396 fbCopyProc copyProc,
1397 Pixel bitPlane,
1398 void *closure);
1400 RegionPtr
1401 fbDoCopy (DrawablePtr pSrcDrawable,
1402 DrawablePtr pDstDrawable,
1403 GCPtr pGC,
1404 int xIn,
1405 int yIn,
1406 int widthSrc,
1407 int heightSrc,
1408 int xOut,
1409 int yOut,
1410 fbCopyProc copyProc,
1411 Pixel bitplane,
1412 void *closure);
1414 RegionPtr
1415 fbCopyArea (DrawablePtr pSrcDrawable,
1416 DrawablePtr pDstDrawable,
1417 GCPtr pGC,
1418 int xIn,
1419 int yIn,
1420 int widthSrc,
1421 int heightSrc,
1422 int xOut,
1423 int yOut);
1425 RegionPtr
1426 fbCopyPlane (DrawablePtr pSrcDrawable,
1427 DrawablePtr pDstDrawable,
1428 GCPtr pGC,
1429 int xIn,
1430 int yIn,
1431 int widthSrc,
1432 int heightSrc,
1433 int xOut,
1434 int yOut,
1435 unsigned long bitplane);
1438 * fbfill.c
1440 void
1441 fbFill (DrawablePtr pDrawable,
1442 GCPtr pGC,
1443 int x,
1444 int y,
1445 int width,
1446 int height);
1448 void
1449 fbSolidBoxClipped (DrawablePtr pDrawable,
1450 RegionPtr pClip,
1451 int xa,
1452 int ya,
1453 int xb,
1454 int yb,
1455 FbBits and,
1456 FbBits xor);
1459 * fbfillrect.c
1461 void
1462 fbPolyFillRect(DrawablePtr pDrawable,
1463 GCPtr pGC,
1464 int nrectInit,
1465 xRectangle *prectInit);
1467 #define fbPolyFillArc miPolyFillArc
1469 #define fbFillPolygon miFillPolygon
1472 * fbfillsp.c
1474 void
1475 fbFillSpans (DrawablePtr pDrawable,
1476 GCPtr pGC,
1477 int nInit,
1478 DDXPointPtr pptInit,
1479 int *pwidthInit,
1480 int fSorted);
1484 * fbgc.c
1487 Bool
1488 fbCreateGC(GCPtr pGC);
1490 void
1491 fbPadPixmap (PixmapPtr pPixmap);
1493 void
1494 fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
1497 * fbgetsp.c
1499 void
1500 fbGetSpans(DrawablePtr pDrawable,
1501 int wMax,
1502 DDXPointPtr ppt,
1503 int *pwidth,
1504 int nspans,
1505 char *pchardstStart);
1508 * fbglyph.c
1511 Bool
1512 fbGlyphIn (RegionPtr pRegion,
1513 int x,
1514 int y,
1515 int width,
1516 int height);
1518 void
1519 fbPolyGlyphBlt (DrawablePtr pDrawable,
1520 GCPtr pGC,
1521 int x,
1522 int y,
1523 unsigned int nglyph,
1524 CharInfoPtr *ppci,
1525 pointer pglyphBase);
1527 void
1528 fbImageGlyphBlt (DrawablePtr pDrawable,
1529 GCPtr pGC,
1530 int x,
1531 int y,
1532 unsigned int nglyph,
1533 CharInfoPtr *ppci,
1534 pointer pglyphBase);
1537 * fbimage.c
1540 void
1541 fbPutImage (DrawablePtr pDrawable,
1542 GCPtr pGC,
1543 int depth,
1544 int x,
1545 int y,
1546 int w,
1547 int h,
1548 int leftPad,
1549 int format,
1550 char *pImage);
1552 void
1553 fbPutZImage (DrawablePtr pDrawable,
1554 RegionPtr pClip,
1555 int alu,
1556 FbBits pm,
1557 int x,
1558 int y,
1559 int width,
1560 int height,
1561 FbStip *src,
1562 FbStride srcStride);
1564 void
1565 fbPutXYImage (DrawablePtr pDrawable,
1566 RegionPtr pClip,
1567 FbBits fg,
1568 FbBits bg,
1569 FbBits pm,
1570 int alu,
1571 Bool opaque,
1573 int x,
1574 int y,
1575 int width,
1576 int height,
1578 FbStip *src,
1579 FbStride srcStride,
1580 int srcX);
1582 void
1583 fbGetImage (DrawablePtr pDrawable,
1584 int x,
1585 int y,
1586 int w,
1587 int h,
1588 unsigned int format,
1589 unsigned long planeMask,
1590 char *d);
1592 * fbline.c
1595 void
1596 fbZeroLine (DrawablePtr pDrawable,
1597 GCPtr pGC,
1598 int mode,
1599 int npt,
1600 DDXPointPtr ppt);
1602 void
1603 fbZeroSegment (DrawablePtr pDrawable,
1604 GCPtr pGC,
1605 int nseg,
1606 xSegment *pSegs);
1608 void
1609 fbPolyLine (DrawablePtr pDrawable,
1610 GCPtr pGC,
1611 int mode,
1612 int npt,
1613 DDXPointPtr ppt);
1615 void
1616 fbFixCoordModePrevious (int npt,
1617 DDXPointPtr ppt);
1619 void
1620 fbPolySegment (DrawablePtr pDrawable,
1621 GCPtr pGC,
1622 int nseg,
1623 xSegment *pseg);
1625 #define fbPolyRectangle miPolyRectangle
1628 * fbpict.c
1631 Bool
1632 fbPictureInit (ScreenPtr pScreen,
1633 PictFormatPtr formats,
1634 int nformats);
1637 * fbpixmap.c
1640 PixmapPtr
1641 fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp);
1643 PixmapPtr
1644 fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth);
1646 Bool
1647 fbDestroyPixmap (PixmapPtr pPixmap);
1649 RegionPtr
1650 fbPixmapToRegion(PixmapPtr pPix);
1653 * fbpoint.c
1656 void
1657 fbDots (FbBits *dstOrig,
1658 FbStride dstStride,
1659 int dstBpp,
1660 BoxPtr pBox,
1661 xPoint *pts,
1662 int npt,
1663 int xorg,
1664 int yorg,
1665 int xoff,
1666 int yoff,
1667 FbBits andOrig,
1668 FbBits xorOrig);
1670 void
1671 fbPolyPoint (DrawablePtr pDrawable,
1672 GCPtr pGC,
1673 int mode,
1674 int npt,
1675 xPoint *pptInit);
1678 * fbpush.c
1680 void
1681 fbPushPattern (DrawablePtr pDrawable,
1682 GCPtr pGC,
1684 FbStip *src,
1685 FbStride srcStride,
1686 int srcX,
1688 int x,
1689 int y,
1691 int width,
1692 int height);
1694 void
1695 fbPushFill (DrawablePtr pDrawable,
1696 GCPtr pGC,
1698 FbStip *src,
1699 FbStride srcStride,
1700 int srcX,
1702 int x,
1703 int y,
1704 int width,
1705 int height);
1707 void
1708 fbPush1toN (DrawablePtr pSrcDrawable,
1709 DrawablePtr pDstDrawable,
1710 GCPtr pGC,
1711 BoxPtr pbox,
1712 int nbox,
1713 int dx,
1714 int dy,
1715 Bool reverse,
1716 Bool upsidedown,
1717 Pixel bitplane,
1718 void *closure);
1720 void
1721 fbPushImage (DrawablePtr pDrawable,
1722 GCPtr pGC,
1724 FbStip *src,
1725 FbStride srcStride,
1726 int srcX,
1728 int x,
1729 int y,
1730 int width,
1731 int height);
1733 void
1734 fbPushPixels (GCPtr pGC,
1735 PixmapPtr pBitmap,
1736 DrawablePtr pDrawable,
1737 int dx,
1738 int dy,
1739 int xOrg,
1740 int yOrg);
1744 * fbscreen.c
1747 Bool
1748 fbCloseScreen (int indx, ScreenPtr pScreen);
1750 Bool
1751 fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
1753 Bool
1754 fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
1756 void
1757 fbQueryBestSize (int class,
1758 unsigned short *width, unsigned short *height,
1759 ScreenPtr pScreen);
1761 PixmapPtr
1762 _fbGetWindowPixmap (WindowPtr pWindow);
1764 void
1765 _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
1767 Bool
1768 fbSetupScreen(ScreenPtr pScreen,
1769 pointer pbits, /* pointer to screen bitmap */
1770 int xsize, /* in pixels */
1771 int ysize,
1772 int dpix, /* dots per inch */
1773 int dpiy,
1774 int width, /* pixel width of frame buffer */
1775 int bpp); /* bits per pixel of frame buffer */
1777 Bool
1778 wfbFinishScreenInit(ScreenPtr pScreen,
1779 pointer pbits,
1780 int xsize,
1781 int ysize,
1782 int dpix,
1783 int dpiy,
1784 int width,
1785 int bpp,
1786 SetupWrapProcPtr setupWrap,
1787 FinishWrapProcPtr finishWrap);
1789 Bool
1790 wfbScreenInit(ScreenPtr pScreen,
1791 pointer pbits,
1792 int xsize,
1793 int ysize,
1794 int dpix,
1795 int dpiy,
1796 int width,
1797 int bpp,
1798 SetupWrapProcPtr setupWrap,
1799 FinishWrapProcPtr finishWrap);
1801 Bool
1802 fbFinishScreenInit(ScreenPtr pScreen,
1803 pointer pbits,
1804 int xsize,
1805 int ysize,
1806 int dpix,
1807 int dpiy,
1808 int width,
1809 int bpp);
1811 Bool
1812 fbScreenInit(ScreenPtr pScreen,
1813 pointer pbits,
1814 int xsize,
1815 int ysize,
1816 int dpix,
1817 int dpiy,
1818 int width,
1819 int bpp);
1821 void
1822 fbInitializeBackingStore (ScreenPtr pScreen);
1825 * fbseg.c
1827 typedef void FbBres (DrawablePtr pDrawable,
1828 GCPtr pGC,
1829 int dashOffset,
1830 int signdx,
1831 int signdy,
1832 int axis,
1833 int x,
1834 int y,
1835 int e,
1836 int e1,
1837 int e3,
1838 int len);
1840 FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
1842 * fbsetsp.c
1845 void
1846 fbSetSpans (DrawablePtr pDrawable,
1847 GCPtr pGC,
1848 char *src,
1849 DDXPointPtr ppt,
1850 int *pwidth,
1851 int nspans,
1852 int fSorted);
1854 FbBres *
1855 fbSelectBres (DrawablePtr pDrawable,
1856 GCPtr pGC);
1858 void
1859 fbBres (DrawablePtr pDrawable,
1860 GCPtr pGC,
1861 int dashOffset,
1862 int signdx,
1863 int signdy,
1864 int axis,
1865 int x,
1866 int y,
1867 int e,
1868 int e1,
1869 int e3,
1870 int len);
1872 void
1873 fbSegment (DrawablePtr pDrawable,
1874 GCPtr pGC,
1875 int xa,
1876 int ya,
1877 int xb,
1878 int yb,
1879 Bool drawLast,
1880 int *dashOffset);
1884 * fbsolid.c
1887 void
1888 fbSolid (FbBits *dst,
1889 FbStride dstStride,
1890 int dstX,
1891 int bpp,
1893 int width,
1894 int height,
1896 FbBits and,
1897 FbBits xor);
1899 #ifdef FB_24BIT
1900 void
1901 fbSolid24 (FbBits *dst,
1902 FbStride dstStride,
1903 int dstX,
1905 int width,
1906 int height,
1908 FbBits and,
1909 FbBits xor);
1910 #endif
1913 * fbstipple.c
1916 void
1917 fbTransparentSpan (FbBits *dst,
1918 FbBits stip,
1919 FbBits fgxor,
1920 int n);
1922 void
1923 fbEvenStipple (FbBits *dst,
1924 FbStride dstStride,
1925 int dstX,
1926 int dstBpp,
1928 int width,
1929 int height,
1931 FbStip *stip,
1932 FbStride stipStride,
1933 int stipHeight,
1935 FbBits fgand,
1936 FbBits fgxor,
1937 FbBits bgand,
1938 FbBits bgxor,
1940 int xRot,
1941 int yRot);
1943 void
1944 fbOddStipple (FbBits *dst,
1945 FbStride dstStride,
1946 int dstX,
1947 int dstBpp,
1949 int width,
1950 int height,
1952 FbStip *stip,
1953 FbStride stipStride,
1954 int stipWidth,
1955 int stipHeight,
1957 FbBits fgand,
1958 FbBits fgxor,
1959 FbBits bgand,
1960 FbBits bgxor,
1962 int xRot,
1963 int yRot);
1965 void
1966 fbStipple (FbBits *dst,
1967 FbStride dstStride,
1968 int dstX,
1969 int dstBpp,
1971 int width,
1972 int height,
1974 FbStip *stip,
1975 FbStride stipStride,
1976 int stipWidth,
1977 int stipHeight,
1978 Bool even,
1980 FbBits fgand,
1981 FbBits fgxor,
1982 FbBits bgand,
1983 FbBits bgxor,
1985 int xRot,
1986 int yRot);
1989 * fbtile.c
1992 void
1993 fbEvenTile (FbBits *dst,
1994 FbStride dstStride,
1995 int dstX,
1997 int width,
1998 int height,
2000 FbBits *tile,
2001 FbStride tileStride,
2002 int tileHeight,
2004 int alu,
2005 FbBits pm,
2006 int xRot,
2007 int yRot);
2009 void
2010 fbOddTile (FbBits *dst,
2011 FbStride dstStride,
2012 int dstX,
2014 int width,
2015 int height,
2017 FbBits *tile,
2018 FbStride tileStride,
2019 int tileWidth,
2020 int tileHeight,
2022 int alu,
2023 FbBits pm,
2024 int bpp,
2026 int xRot,
2027 int yRot);
2029 void
2030 fbTile (FbBits *dst,
2031 FbStride dstStride,
2032 int dstX,
2034 int width,
2035 int height,
2037 FbBits *tile,
2038 FbStride tileStride,
2039 int tileWidth,
2040 int tileHeight,
2042 int alu,
2043 FbBits pm,
2044 int bpp,
2046 int xRot,
2047 int yRot);
2050 * fbutil.c
2052 FbBits
2053 fbReplicatePixel (Pixel p, int bpp);
2055 void
2056 fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
2058 #ifdef FB_ACCESS_WRAPPER
2059 extern ReadMemoryProcPtr wfbReadMemory;
2060 extern WriteMemoryProcPtr wfbWriteMemory;
2061 #endif
2064 * fbwindow.c
2067 Bool
2068 fbCreateWindow(WindowPtr pWin);
2070 Bool
2071 fbDestroyWindow(WindowPtr pWin);
2073 Bool
2074 fbMapWindow(WindowPtr pWindow);
2076 Bool
2077 fbPositionWindow(WindowPtr pWin, int x, int y);
2079 Bool
2080 fbUnmapWindow(WindowPtr pWindow);
2082 void
2083 fbCopyWindowProc (DrawablePtr pSrcDrawable,
2084 DrawablePtr pDstDrawable,
2085 GCPtr pGC,
2086 BoxPtr pbox,
2087 int nbox,
2088 int dx,
2089 int dy,
2090 Bool reverse,
2091 Bool upsidedown,
2092 Pixel bitplane,
2093 void *closure);
2095 void
2096 fbCopyWindow(WindowPtr pWin,
2097 DDXPointRec ptOldOrg,
2098 RegionPtr prgnSrc);
2100 Bool
2101 fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
2103 void
2104 fbFillRegionSolid (DrawablePtr pDrawable,
2105 RegionPtr pRegion,
2106 FbBits and,
2107 FbBits xor);
2109 void
2110 fbFillRegionTiled (DrawablePtr pDrawable,
2111 RegionPtr pRegion,
2112 PixmapPtr pTile);
2114 void
2115 fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
2118 pixman_image_t *image_from_pict (PicturePtr pict,
2119 Bool has_clip);
2120 void free_pixman_pict (PicturePtr, pixman_image_t *);
2122 #endif /* _FB_H_ */