VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.14.0/fb.h@ 77138

Last change on this file since 77138 was 45134, checked in by vboxsync, 12 years ago

Additions/X11: build vboxvideo_drv.so for X.Org Server 1.14.

  • Property svn:eol-style set to native
File size: 46.6 KB
Line 
1/*
2 *
3 * Copyright © 1998 Keith Packard
4 *
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.
14 *
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.
22 */
23
24#ifndef _FB_H_
25#define _FB_H_
26
27#include <X11/X.h>
28#include <pixman.h>
29
30#include "scrnintstr.h"
31#include "pixmap.h"
32#include "pixmapstr.h"
33#include "region.h"
34#include "gcstruct.h"
35#include "colormap.h"
36#include "miscstruct.h"
37#include "servermd.h"
38#include "windowstr.h"
39#include "privates.h"
40#include "mi.h"
41#include "migc.h"
42#include "picturestr.h"
43
44#ifdef FB_ACCESS_WRAPPER
45
46#include "wfbrename.h"
47#define FBPREFIX(x) wfb##x
48#define WRITE(ptr, val) ((*wfbWriteMemory)((ptr), (val), sizeof(*(ptr))))
49#define READ(ptr) ((*wfbReadMemory)((ptr), sizeof(*(ptr))))
50
51#define MEMCPY_WRAPPED(dst, src, size) do { \
52 size_t _i; \
53 CARD8 *_dst = (CARD8*)(dst), *_src = (CARD8*)(src); \
54 for(_i = 0; _i < size; _i++) { \
55 WRITE(_dst +_i, READ(_src + _i)); \
56 } \
57} while(0)
58
59#define MEMSET_WRAPPED(dst, val, size) do { \
60 size_t _i; \
61 CARD8 *_dst = (CARD8*)(dst); \
62 for(_i = 0; _i < size; _i++) { \
63 WRITE(_dst +_i, (val)); \
64 } \
65} while(0)
66
67#else
68
69#define FBPREFIX(x) fb##x
70#define WRITE(ptr, val) (*(ptr) = (val))
71#define READ(ptr) (*(ptr))
72#define MEMCPY_WRAPPED(dst, src, size) memcpy((dst), (src), (size))
73#define MEMSET_WRAPPED(dst, val, size) memset((dst), (val), (size))
74
75#endif
76
77/*
78 * This single define controls the basic size of data manipulated
79 * by this software; it must be log2(sizeof (FbBits) * 8)
80 */
81
82#ifndef FB_SHIFT
83#define FB_SHIFT LOG2_BITMAP_PAD
84#endif
85
86#if FB_SHIFT < LOG2_BITMAP_PAD
87error FB_SHIFT must be >= LOG2_BITMAP_PAD
88#endif
89#define FB_UNIT (1 << FB_SHIFT)
90#define FB_HALFUNIT (1 << (FB_SHIFT-1))
91#define FB_MASK (FB_UNIT - 1)
92#define FB_ALLONES ((FbBits) -1)
93#if GLYPHPADBYTES != 4
94#error "GLYPHPADBYTES must be 4"
95#endif
96/* for driver compat - intel UXA needs the second one at least */
97#define FB_24BIT
98#define FB_24_32BIT
99#define FB_STIP_SHIFT LOG2_BITMAP_PAD
100#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
101#define FB_STIP_MASK (FB_STIP_UNIT - 1)
102#define FB_STIP_ALLONES ((FbStip) -1)
103#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
104#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
105#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
106#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
107#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
108#if FB_SHIFT == 6
109#ifdef WIN32
110typedef unsigned __int64 FbBits;
111#else
112#if defined(__alpha__) || defined(__alpha) || \
113 defined(ia64) || defined(__ia64__) || \
114 defined(__sparc64__) || defined(_LP64) || \
115 defined(__s390x__) || \
116 defined(amd64) || defined (__amd64__) || \
117 defined (__powerpc64__)
118typedef unsigned long FbBits;
119#else
120typedef unsigned long long FbBits;
121#endif
122#endif
123#endif
124
125#if FB_SHIFT == 5
126typedef CARD32 FbBits;
127#endif
128
129#if FB_SHIFT == 4
130typedef CARD16 FbBits;
131#endif
132
133#if LOG2_BITMAP_PAD == FB_SHIFT
134typedef FbBits FbStip;
135#else
136#if LOG2_BITMAP_PAD == 5
137typedef CARD32 FbStip;
138#endif
139#endif
140
141typedef int FbStride;
142
143#ifdef FB_DEBUG
144extern _X_EXPORT void fbValidateDrawable(DrawablePtr d);
145extern _X_EXPORT void fbInitializeDrawable(DrawablePtr d);
146extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
147
148#define FB_HEAD_BITS (FbStip) (0xbaadf00d)
149#define FB_TAIL_BITS (FbStip) (0xbaddf0ad)
150#else
151#define fbValidateDrawable(d)
152#define fdInitializeDrawable(d)
153#endif
154
155#include "fbrop.h"
156
157#if BITMAP_BIT_ORDER == LSBFirst
158#define FbScrLeft(x,n) ((x) >> (n))
159#define FbScrRight(x,n) ((x) << (n))
160/* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */
161#define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1))
162#define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n)))
163#define FbPatternOffsetBits 0
164#else
165#define FbScrLeft(x,n) ((x) << (n))
166#define FbScrRight(x,n) ((x) >> (n))
167/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */
168#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
169#define FbStipMoveLsb(x,s,n) (x)
170#define FbPatternOffsetBits (sizeof (FbBits) - 1)
171#endif
172
173#include "micoord.h"
174
175#define FbStipLeft(x,n) FbScrLeft(x,n)
176#define FbStipRight(x,n) FbScrRight(x,n)
177
178#define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0)
179#define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0)
180
181#define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0)
182#define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0)
183
184#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
185 FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
186#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
187 FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
188
189#define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \
190 FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0)
191#define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \
192 FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0)
193
194#define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \
195 FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK))
196
197#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
198 FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
199
200#define FbMaskBits(x,w,l,n,r) { \
201 n = (w); \
202 r = FbRightMask((x)+n); \
203 l = FbLeftMask(x); \
204 if (l) { \
205 n -= FB_UNIT - ((x) & FB_MASK); \
206 if (n < 0) { \
207 n = 0; \
208 l &= r; \
209 r = 0; \
210 } \
211 } \
212 n >>= FB_SHIFT; \
213}
214
215#define FbByteMaskInvalid 0x10
216
217#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1)))
218
219#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o)))
220#define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3))
221#define FbStorePart(dst,off,t,xor) (WRITE(FbPtrOffset(dst,off,t), \
222 FbSelectPart(xor,off,t)))
223#ifndef FbSelectPart
224#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
225#endif
226
227#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \
228 n = (w); \
229 lb = 0; \
230 rb = 0; \
231 r = FbRightMask((x)+n); \
232 if (r) { \
233 /* compute right byte length */ \
234 if ((copy) && (((x) + n) & 7) == 0) { \
235 rb = (((x) + n) & FB_MASK) >> 3; \
236 } else { \
237 rb = FbByteMaskInvalid; \
238 } \
239 } \
240 l = FbLeftMask(x); \
241 if (l) { \
242 /* compute left byte length */ \
243 if ((copy) && ((x) & 7) == 0) { \
244 lb = ((x) & FB_MASK) >> 3; \
245 } else { \
246 lb = FbByteMaskInvalid; \
247 } \
248 /* subtract out the portion painted by leftMask */ \
249 n -= FB_UNIT - ((x) & FB_MASK); \
250 if (n < 0) { \
251 if (lb != FbByteMaskInvalid) { \
252 if (rb == FbByteMaskInvalid) { \
253 lb = FbByteMaskInvalid; \
254 } else if (rb) { \
255 lb |= (rb - lb) << (FB_SHIFT - 3); \
256 rb = 0; \
257 } \
258 } \
259 n = 0; \
260 l &= r; \
261 r = 0; \
262 }\
263 } \
264 n >>= FB_SHIFT; \
265}
266
267#if FB_SHIFT == 6
268#define FbDoLeftMaskByteRRop6Cases(dst,xor) \
269 case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \
270 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
271 break; \
272 case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \
273 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
274 FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
275 break; \
276 case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \
277 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
278 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
279 break; \
280 case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \
281 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
282 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
283 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
284 break; \
285 case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \
286 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
287 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
288 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
289 break; \
290 case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \
291 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
292 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
293 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
294 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
295 break; \
296 case (sizeof (FbBits) - 7): \
297 FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
298 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
299 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
300 break; \
301 case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \
302 FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
303 break; \
304 case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \
305 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
306 break; \
307 case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \
308 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
309 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
310 break; \
311 case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \
312 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
313 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
314 break; \
315 case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \
316 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
317 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
318 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
319 break; \
320 case (sizeof (FbBits) - 6): \
321 FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
322 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
323 break; \
324 case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \
325 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
326 break; \
327 case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \
328 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
329 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
330 break; \
331 case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \
332 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
333 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
334 break; \
335 case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \
336 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
337 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
338 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
339 break; \
340 case (sizeof (FbBits) - 5): \
341 FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
342 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
343 break; \
344 case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \
345 FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
346 break; \
347 case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \
348 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
349 break; \
350 case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \
351 FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
352 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
353 break; \
354 case (sizeof (FbBits) - 4): \
355 FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
356 break;
357
358#define FbDoRightMaskByteRRop6Cases(dst,xor) \
359 case 4: \
360 FbStorePart(dst,0,CARD32,xor); \
361 break; \
362 case 5: \
363 FbStorePart(dst,0,CARD32,xor); \
364 FbStorePart(dst,4,CARD8,xor); \
365 break; \
366 case 6: \
367 FbStorePart(dst,0,CARD32,xor); \
368 FbStorePart(dst,4,CARD16,xor); \
369 break; \
370 case 7: \
371 FbStorePart(dst,0,CARD32,xor); \
372 FbStorePart(dst,4,CARD16,xor); \
373 FbStorePart(dst,6,CARD8,xor); \
374 break;
375#else
376#define FbDoLeftMaskByteRRop6Cases(dst,xor)
377#define FbDoRightMaskByteRRop6Cases(dst,xor)
378#endif
379
380#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
381 switch (lb) { \
382 FbDoLeftMaskByteRRop6Cases(dst,xor) \
383 case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \
384 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
385 break; \
386 case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \
387 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
388 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
389 break; \
390 case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \
391 FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
392 break; \
393 case sizeof (FbBits) - 3: \
394 FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
395 case sizeof (FbBits) - 2: \
396 FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \
397 break; \
398 case sizeof (FbBits) - 1: \
399 FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \
400 break; \
401 default: \
402 WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, l)); \
403 break; \
404 } \
405}
406
407#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \
408 switch (rb) { \
409 case 1: \
410 FbStorePart(dst,0,CARD8,xor); \
411 break; \
412 case 2: \
413 FbStorePart(dst,0,CARD16,xor); \
414 break; \
415 case 3: \
416 FbStorePart(dst,0,CARD16,xor); \
417 FbStorePart(dst,2,CARD8,xor); \
418 break; \
419 FbDoRightMaskByteRRop6Cases(dst,xor) \
420 default: \
421 WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, r)); \
422 } \
423}
424
425#define FbMaskStip(x,w,l,n,r) { \
426 n = (w); \
427 r = FbRightStipMask((x)+n); \
428 l = FbLeftStipMask(x); \
429 if (l) { \
430 n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \
431 if (n < 0) { \
432 n = 0; \
433 l &= r; \
434 r = 0; \
435 } \
436 } \
437 n >>= FB_STIP_SHIFT; \
438}
439
440/*
441 * These macros are used to transparently stipple
442 * in copy mode; the expected usage is with 'n' constant
443 * so all of the conditional parts collapse into a minimal
444 * sequence of partial word writes
445 *
446 * 'n' is the bytemask of which bytes to store, 'a' is the address
447 * of the FbBits base unit, 'o' is the offset within that unit
448 *
449 * The term "lane" comes from the hardware term "byte-lane" which
450 */
451
452#define FbLaneCase1(n,a,o) \
453 if ((n) == 0x01) { \
454 WRITE((CARD8 *) ((a)+FbPatternOffset(o,CARD8)), fgxor); \
455 }
456
457#define FbLaneCase2(n,a,o) \
458 if ((n) == 0x03) { \
459 WRITE((CARD16 *) ((a)+FbPatternOffset(o,CARD16)), fgxor); \
460 } else { \
461 FbLaneCase1((n)&1,a,o) \
462 FbLaneCase1((n)>>1,a,(o)+1) \
463 }
464
465#define FbLaneCase4(n,a,o) \
466 if ((n) == 0x0f) { \
467 WRITE((CARD32 *) ((a)+FbPatternOffset(o,CARD32)), fgxor); \
468 } else { \
469 FbLaneCase2((n)&3,a,o) \
470 FbLaneCase2((n)>>2,a,(o)+2) \
471 }
472
473#define FbLaneCase8(n,a,o) \
474 if ((n) == 0x0ff) { \
475 *(FbBits *) ((a)+(o)) = fgxor; \
476 } else { \
477 FbLaneCase4((n)&15,a,o) \
478 FbLaneCase4((n)>>4,a,(o)+4) \
479 }
480
481#if FB_SHIFT == 6
482#define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0)
483#endif
484
485#if FB_SHIFT == 5
486#define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0)
487#endif
488
489/* Rotate a filled pixel value to the specified alignement */
490#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
491#define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b)))
492
493/* step a filled pixel value to the next/previous FB_UNIT alignment */
494#define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24)))
495#define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24))
496#define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24)))
497#define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24))
498
499/* step a rotation value to the next/previous rotation value */
500#if FB_UNIT == 64
501#define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8)
502#define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8)
503
504#if IMAGE_BYTE_ORDER == MSBFirst
505#define FbFirst24Rot(x) (((x) + 8) % 24)
506#else
507#define FbFirst24Rot(x) ((x) % 24)
508#endif
509
510#endif
511
512#if FB_UNIT == 32
513#define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8)
514#define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8)
515
516#if IMAGE_BYTE_ORDER == MSBFirst
517#define FbFirst24Rot(x) (((x) + 16) % 24)
518#else
519#define FbFirst24Rot(x) ((x) % 24)
520#endif
521#endif
522
523#define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8)
524#define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8)
525
526/* Whether 24-bit specific code is needed for this filled pixel value */
527#define FbCheck24Pix(p) ((p) == FbNext24Pix(p))
528
529/* Macros for dealing with dashing */
530
531#define FbDashDeclare \
532 unsigned char *__dash, *__firstDash, *__lastDash
533
534#define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \
535 (even) = TRUE; \
536 __firstDash = (pGC)->dash; \
537 __lastDash = __firstDash + (pGC)->numInDashList; \
538 (dashOffset) %= (pPriv)->dashLength; \
539 \
540 __dash = __firstDash; \
541 while ((dashOffset) >= ((dashlen) = *__dash)) \
542 { \
543 (dashOffset) -= (dashlen); \
544 (even) = 1-(even); \
545 if (++__dash == __lastDash) \
546 __dash = __firstDash; \
547 } \
548 (dashlen) -= (dashOffset); \
549}
550
551#define FbDashNext(dashlen) { \
552 if (++__dash == __lastDash) \
553 __dash = __firstDash; \
554 (dashlen) = *__dash; \
555}
556
557/* as numInDashList is always even, this case can skip a test */
558
559#define FbDashNextEven(dashlen) { \
560 (dashlen) = *++__dash; \
561}
562
563#define FbDashNextOdd(dashlen) FbDashNext(dashlen)
564
565#define FbDashStep(dashlen,even) { \
566 if (!--(dashlen)) { \
567 FbDashNext(dashlen); \
568 (even) = 1-(even); \
569 } \
570}
571
572extern _X_EXPORT const GCOps fbGCOps;
573extern _X_EXPORT const GCFuncs fbGCFuncs;
574
575/* Framebuffer access wrapper */
576typedef FbBits(*ReadMemoryProcPtr) (const void *src, int size);
577typedef void (*WriteMemoryProcPtr) (void *dst, FbBits value, int size);
578typedef void (*SetupWrapProcPtr) (ReadMemoryProcPtr * pRead,
579 WriteMemoryProcPtr * pWrite,
580 DrawablePtr pDraw);
581typedef void (*FinishWrapProcPtr) (DrawablePtr pDraw);
582
583#ifdef FB_ACCESS_WRAPPER
584
585#define fbPrepareAccess(pDraw) \
586 fbGetScreenPrivate((pDraw)->pScreen)->setupWrap( \
587 &wfbReadMemory, \
588 &wfbWriteMemory, \
589 (pDraw))
590#define fbFinishAccess(pDraw) \
591 fbGetScreenPrivate((pDraw)->pScreen)->finishWrap(pDraw)
592
593#else
594
595#define fbPrepareAccess(pPix)
596#define fbFinishAccess(pDraw)
597
598#endif
599
600extern _X_EXPORT DevPrivateKey
601fbGetScreenPrivateKey(void);
602
603/* private field of a screen */
604typedef struct {
605 unsigned char win32bpp; /* window bpp for 32-bpp images */
606 unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
607#ifdef FB_ACCESS_WRAPPER
608 SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
609 FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
610#endif
611 DevPrivateKeyRec gcPrivateKeyRec;
612 DevPrivateKeyRec winPrivateKeyRec;
613} FbScreenPrivRec, *FbScreenPrivPtr;
614
615#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
616 dixLookupPrivate(&(pScreen)->devPrivates, fbGetScreenPrivateKey()))
617
618/* private field of GC */
619typedef struct {
620 FbBits and, xor; /* reduced rop values */
621 FbBits bgand, bgxor; /* for stipples */
622 FbBits fg, bg, pm; /* expanded and filled */
623 unsigned int dashLength; /* total of all dash elements */
624 unsigned char evenStipple; /* stipple is even */
625 unsigned char bpp; /* current drawable bpp */
626} FbGCPrivRec, *FbGCPrivPtr;
627
628#define fbGetGCPrivateKey(pGC) (&fbGetScreenPrivate((pGC)->pScreen)->gcPrivateKeyRec)
629
630#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
631 dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey(pGC)))
632
633#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
634#define fbGetExpose(pGC) ((pGC)->fExpose)
635#define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip)
636#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
637
638#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
639
640#define fbGetWinPrivateKey(pWin) (&fbGetScreenPrivate(((DrawablePtr) (pWin))->pScreen)->winPrivateKeyRec)
641
642#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
643 dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey(pWin)))
644
645#ifdef ROOTLESS
646#define __fbPixDrawableX(pPix) ((pPix)->drawable.x)
647#define __fbPixDrawableY(pPix) ((pPix)->drawable.y)
648#else
649#define __fbPixDrawableX(pPix) 0
650#define __fbPixDrawableY(pPix) 0
651#endif
652
653#ifdef COMPOSITE
654#define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix) - (pPix)->screen_x)
655#define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix) - (pPix)->screen_y)
656#else
657#define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix))
658#define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix))
659#endif
660#define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
661#define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
662
663#define fbGetDrawablePixmap(pDrawable, pixmap, xoff, yoff) { \
664 if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
665 (pixmap) = fbGetWindowPixmap(pDrawable); \
666 (xoff) = __fbPixOffXWin(pixmap); \
667 (yoff) = __fbPixOffYWin(pixmap); \
668 } else { \
669 (pixmap) = (PixmapPtr) (pDrawable); \
670 (xoff) = __fbPixOffXPix(pixmap); \
671 (yoff) = __fbPixOffYPix(pixmap); \
672 } \
673 fbPrepareAccess(pDrawable); \
674}
675
676#define fbGetPixmapBitsData(pixmap, pointer, stride, bpp) { \
677 (pointer) = (FbBits *) (pixmap)->devPrivate.ptr; \
678 (stride) = ((int) (pixmap)->devKind) / sizeof (FbBits); (void)(stride); \
679 (bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \
680}
681
682#define fbGetPixmapStipData(pixmap, pointer, stride, bpp) { \
683 (pointer) = (FbStip *) (pixmap)->devPrivate.ptr; \
684 (stride) = ((int) (pixmap)->devKind) / sizeof (FbStip); (void)(stride); \
685 (bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \
686}
687
688#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
689 PixmapPtr _pPix; \
690 fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \
691 fbGetPixmapBitsData(_pPix, pointer, stride, bpp); \
692}
693
694#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
695 PixmapPtr _pPix; \
696 fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \
697 fbGetPixmapStipData(_pPix, pointer, stride, bpp); \
698}
699
700/*
701 * XFree86 empties the root BorderClip when the VT is inactive,
702 * here's a macro which uses that to disable GetImage and GetSpans
703 */
704
705#define fbWindowEnabled(pWin) \
706 RegionNotEmpty(&(pWin)->drawable.pScreen->root->borderClip)
707
708#define fbDrawableEnabled(pDrawable) \
709 ((pDrawable)->type == DRAWABLE_PIXMAP ? \
710 TRUE : fbWindowEnabled((WindowPtr) pDrawable))
711
712#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
713/*
714 * Accelerated tiles are power of 2 width <= FB_UNIT
715 */
716#define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w))
717/*
718 * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp
719 * with dstBpp a power of 2 as well
720 */
721#define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp))
722
723/*
724 * fb24_32.c
725 */
726extern _X_EXPORT void
727
728fb24_32GetSpans(DrawablePtr pDrawable,
729 int wMax,
730 DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
731
732extern _X_EXPORT void
733
734fb24_32SetSpans(DrawablePtr pDrawable,
735 GCPtr pGC,
736 char *src,
737 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
738
739extern _X_EXPORT void
740
741fb24_32PutZImage(DrawablePtr pDrawable,
742 RegionPtr pClip,
743 int alu,
744 FbBits pm,
745 int x,
746 int y, int width, int height, CARD8 *src, FbStride srcStride);
747
748extern _X_EXPORT void
749
750fb24_32GetImage(DrawablePtr pDrawable,
751 int x,
752 int y,
753 int w,
754 int h, unsigned int format, unsigned long planeMask, char *d);
755
756extern _X_EXPORT void
757
758fb24_32CopyMtoN(DrawablePtr pSrcDrawable,
759 DrawablePtr pDstDrawable,
760 GCPtr pGC,
761 BoxPtr pbox,
762 int nbox,
763 int dx,
764 int dy,
765 Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
766
767extern _X_EXPORT PixmapPtr
768 fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel);
769
770extern _X_EXPORT Bool
771 fb24_32CreateScreenResources(ScreenPtr pScreen);
772
773extern _X_EXPORT Bool
774
775fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
776 int width,
777 int height,
778 int depth,
779 int bitsPerPixel, int devKind, pointer pPixData);
780
781/*
782 * fballpriv.c
783 */
784extern _X_EXPORT Bool
785fbAllocatePrivates(ScreenPtr pScreen);
786
787/*
788 * fbarc.c
789 */
790
791extern _X_EXPORT void
792fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs);
793
794/*
795 * fbbits.c
796 */
797
798extern _X_EXPORT void
799
800fbBresSolid8(DrawablePtr pDrawable,
801 GCPtr pGC,
802 int dashOffset,
803 int signdx,
804 int signdy,
805 int axis, int x, int y, int e, int e1, int e3, int len);
806
807extern _X_EXPORT void
808
809fbBresDash8(DrawablePtr pDrawable,
810 GCPtr pGC,
811 int dashOffset,
812 int signdx,
813 int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
814
815extern _X_EXPORT void
816
817fbDots8(FbBits * dst,
818 FbStride dstStride,
819 int dstBpp,
820 BoxPtr pBox,
821 xPoint * pts,
822 int npt,
823 int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
824
825extern _X_EXPORT void
826
827fbArc8(FbBits * dst,
828 FbStride dstStride,
829 int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
830
831extern _X_EXPORT void
832
833fbGlyph8(FbBits * dstLine,
834 FbStride dstStride,
835 int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
836
837extern _X_EXPORT void
838
839fbPolyline8(DrawablePtr pDrawable,
840 GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
841
842extern _X_EXPORT void
843 fbPolySegment8(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
844
845extern _X_EXPORT void
846
847fbBresSolid16(DrawablePtr pDrawable,
848 GCPtr pGC,
849 int dashOffset,
850 int signdx,
851 int signdy,
852 int axis, int x, int y, int e, int e1, int e3, int len);
853
854extern _X_EXPORT void
855
856fbBresDash16(DrawablePtr pDrawable,
857 GCPtr pGC,
858 int dashOffset,
859 int signdx,
860 int signdy,
861 int axis, int x, int y, int e, int e1, int e3, int len);
862
863extern _X_EXPORT void
864
865fbDots16(FbBits * dst,
866 FbStride dstStride,
867 int dstBpp,
868 BoxPtr pBox,
869 xPoint * pts,
870 int npt,
871 int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
872
873extern _X_EXPORT void
874
875fbArc16(FbBits * dst,
876 FbStride dstStride,
877 int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
878
879extern _X_EXPORT void
880
881fbGlyph16(FbBits * dstLine,
882 FbStride dstStride,
883 int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
884
885extern _X_EXPORT void
886
887fbPolyline16(DrawablePtr pDrawable,
888 GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
889
890extern _X_EXPORT void
891 fbPolySegment16(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
892
893extern _X_EXPORT void
894
895fbBresSolid24(DrawablePtr pDrawable,
896 GCPtr pGC,
897 int dashOffset,
898 int signdx,
899 int signdy,
900 int axis, int x, int y, int e, int e1, int e3, int len);
901
902extern _X_EXPORT void
903
904fbBresDash24(DrawablePtr pDrawable,
905 GCPtr pGC,
906 int dashOffset,
907 int signdx,
908 int signdy,
909 int axis, int x, int y, int e, int e1, int e3, int len);
910
911extern _X_EXPORT void
912
913fbDots24(FbBits * dst,
914 FbStride dstStride,
915 int dstBpp,
916 BoxPtr pBox,
917 xPoint * pts,
918 int npt,
919 int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
920
921extern _X_EXPORT void
922
923fbArc24(FbBits * dst,
924 FbStride dstStride,
925 int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
926
927extern _X_EXPORT void
928
929fbGlyph24(FbBits * dstLine,
930 FbStride dstStride,
931 int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
932
933extern _X_EXPORT void
934
935fbPolyline24(DrawablePtr pDrawable,
936 GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
937
938extern _X_EXPORT void
939 fbPolySegment24(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
940
941extern _X_EXPORT void
942
943fbBresSolid32(DrawablePtr pDrawable,
944 GCPtr pGC,
945 int dashOffset,
946 int signdx,
947 int signdy,
948 int axis, int x, int y, int e, int e1, int e3, int len);
949
950extern _X_EXPORT void
951
952fbBresDash32(DrawablePtr pDrawable,
953 GCPtr pGC,
954 int dashOffset,
955 int signdx,
956 int signdy,
957 int axis, int x, int y, int e, int e1, int e3, int len);
958
959extern _X_EXPORT void
960
961fbDots32(FbBits * dst,
962 FbStride dstStride,
963 int dstBpp,
964 BoxPtr pBox,
965 xPoint * pts,
966 int npt,
967 int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor);
968
969extern _X_EXPORT void
970
971fbArc32(FbBits * dst,
972 FbStride dstStride,
973 int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
974
975extern _X_EXPORT void
976
977fbGlyph32(FbBits * dstLine,
978 FbStride dstStride,
979 int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
980extern _X_EXPORT void
981
982fbPolyline32(DrawablePtr pDrawable,
983 GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
984
985extern _X_EXPORT void
986 fbPolySegment32(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
987
988/*
989 * fbblt.c
990 */
991extern _X_EXPORT void
992
993fbBlt(FbBits * src,
994 FbStride srcStride,
995 int srcX,
996 FbBits * dst,
997 FbStride dstStride,
998 int dstX,
999 int width,
1000 int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown);
1001
1002extern _X_EXPORT void
1003
1004fbBlt24(FbBits * srcLine,
1005 FbStride srcStride,
1006 int srcX,
1007 FbBits * dstLine,
1008 FbStride dstStride,
1009 int dstX,
1010 int width,
1011 int height, int alu, FbBits pm, Bool reverse, Bool upsidedown);
1012
1013extern _X_EXPORT void
1014 fbBltStip(FbStip * src, FbStride srcStride, /* in FbStip units, not FbBits units */
1015 int srcX, FbStip * dst, FbStride dstStride, /* in FbStip units, not FbBits units */
1016 int dstX, int width, int height, int alu, FbBits pm, int bpp);
1017
1018/*
1019 * fbbltone.c
1020 */
1021extern _X_EXPORT void
1022
1023fbBltOne(FbStip * src,
1024 FbStride srcStride,
1025 int srcX,
1026 FbBits * dst,
1027 FbStride dstStride,
1028 int dstX,
1029 int dstBpp,
1030 int width,
1031 int height, FbBits fgand, FbBits fbxor, FbBits bgand, FbBits bgxor);
1032
1033extern _X_EXPORT void
1034 fbBltOne24(FbStip * src, FbStride srcStride, /* FbStip units per scanline */
1035 int srcX, /* bit position of source */
1036 FbBits * dst, FbStride dstStride, /* FbBits units per scanline */
1037 int dstX, /* bit position of dest */
1038 int dstBpp, /* bits per destination unit */
1039 int width, /* width in bits of destination */
1040 int height, /* height in scanlines */
1041 FbBits fgand, /* rrop values */
1042 FbBits fgxor, FbBits bgand, FbBits bgxor);
1043
1044extern _X_EXPORT void
1045
1046fbBltPlane(FbBits * src,
1047 FbStride srcStride,
1048 int srcX,
1049 int srcBpp,
1050 FbStip * dst,
1051 FbStride dstStride,
1052 int dstX,
1053 int width,
1054 int height,
1055 FbStip fgand,
1056 FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask);
1057
1058/*
1059 * fbcmap_mi.c
1060 */
1061extern _X_EXPORT int
1062 fbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps);
1063
1064extern _X_EXPORT void
1065 fbInstallColormap(ColormapPtr pmap);
1066
1067extern _X_EXPORT void
1068 fbUninstallColormap(ColormapPtr pmap);
1069
1070extern _X_EXPORT void
1071
1072fbResolveColor(unsigned short *pred,
1073 unsigned short *pgreen,
1074 unsigned short *pblue, VisualPtr pVisual);
1075
1076extern _X_EXPORT Bool
1077 fbInitializeColormap(ColormapPtr pmap);
1078
1079extern _X_EXPORT int
1080
1081fbExpandDirectColors(ColormapPtr pmap,
1082 int ndef, xColorItem * indefs, xColorItem * outdefs);
1083
1084extern _X_EXPORT Bool
1085 fbCreateDefColormap(ScreenPtr pScreen);
1086
1087extern _X_EXPORT void
1088 fbClearVisualTypes(void);
1089
1090extern _X_EXPORT Bool
1091 fbHasVisualTypes(int depth);
1092
1093extern _X_EXPORT Bool
1094 fbSetVisualTypes(int depth, int visuals, int bitsPerRGB);
1095
1096extern _X_EXPORT Bool
1097
1098fbSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
1099 Pixel redMask, Pixel greenMask, Pixel blueMask);
1100
1101extern _X_EXPORT Bool
1102
1103fbInitVisuals(VisualPtr * visualp,
1104 DepthPtr * depthp,
1105 int *nvisualp,
1106 int *ndepthp,
1107 int *rootDepthp,
1108 VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB);
1109
1110/*
1111 * fbcopy.c
1112 */
1113
1114/* Compatibility definition, to be removed at next ABI change. */
1115typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
1116 DrawablePtr pDstDrawable,
1117 GCPtr pGC,
1118 BoxPtr pDstBox,
1119 int nbox,
1120 int dx,
1121 int dy,
1122 Bool reverse,
1123 Bool upsidedown, Pixel bitplane, void *closure);
1124
1125extern _X_EXPORT void
1126
1127fbCopyNtoN(DrawablePtr pSrcDrawable,
1128 DrawablePtr pDstDrawable,
1129 GCPtr pGC,
1130 BoxPtr pbox,
1131 int nbox,
1132 int dx,
1133 int dy,
1134 Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
1135
1136/* Compatibility wrapper, to be removed at next ABI change. */
1137extern _X_EXPORT void
1138
1139fbCopyRegion(DrawablePtr pSrcDrawable,
1140 DrawablePtr pDstDrawable,
1141 GCPtr pGC,
1142 RegionPtr pDstRegion,
1143 int dx,
1144 int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure);
1145
1146/* Compatibility wrapper, to be removed at next ABI change. */
1147extern _X_EXPORT RegionPtr
1148
1149fbDoCopy(DrawablePtr pSrcDrawable,
1150 DrawablePtr pDstDrawable,
1151 GCPtr pGC,
1152 int xIn,
1153 int yIn,
1154 int widthSrc,
1155 int heightSrc,
1156 int xOut,
1157 int yOut, fbCopyProc copyProc, Pixel bitplane, void *closure);
1158
1159extern _X_EXPORT void
1160
1161fbCopy1toN(DrawablePtr pSrcDrawable,
1162 DrawablePtr pDstDrawable,
1163 GCPtr pGC,
1164 BoxPtr pbox,
1165 int nbox,
1166 int dx,
1167 int dy,
1168 Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
1169
1170extern _X_EXPORT void
1171
1172fbCopyNto1(DrawablePtr pSrcDrawable,
1173 DrawablePtr pDstDrawable,
1174 GCPtr pGC,
1175 BoxPtr pbox,
1176 int nbox,
1177 int dx,
1178 int dy,
1179 Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
1180
1181extern _X_EXPORT RegionPtr
1182
1183fbCopyArea(DrawablePtr pSrcDrawable,
1184 DrawablePtr pDstDrawable,
1185 GCPtr pGC,
1186 int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut);
1187
1188extern _X_EXPORT RegionPtr
1189
1190fbCopyPlane(DrawablePtr pSrcDrawable,
1191 DrawablePtr pDstDrawable,
1192 GCPtr pGC,
1193 int xIn,
1194 int yIn,
1195 int widthSrc,
1196 int heightSrc, int xOut, int yOut, unsigned long bitplane);
1197
1198/*
1199 * fbfill.c
1200 */
1201extern _X_EXPORT void
1202 fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height);
1203
1204extern _X_EXPORT void
1205
1206fbSolidBoxClipped(DrawablePtr pDrawable,
1207 RegionPtr pClip,
1208 int xa, int ya, int xb, int yb, FbBits and, FbBits xor);
1209
1210/*
1211 * fbfillrect.c
1212 */
1213extern _X_EXPORT void
1214
1215fbPolyFillRect(DrawablePtr pDrawable,
1216 GCPtr pGC, int nrectInit, xRectangle *prectInit);
1217
1218#define fbPolyFillArc miPolyFillArc
1219
1220#define fbFillPolygon miFillPolygon
1221
1222/*
1223 * fbfillsp.c
1224 */
1225extern _X_EXPORT void
1226
1227fbFillSpans(DrawablePtr pDrawable,
1228 GCPtr pGC,
1229 int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted);
1230
1231/*
1232 * fbgc.c
1233 */
1234
1235extern _X_EXPORT Bool
1236 fbCreateGC(GCPtr pGC);
1237
1238extern _X_EXPORT void
1239 fbPadPixmap(PixmapPtr pPixmap);
1240
1241extern _X_EXPORT void
1242 fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
1243
1244/*
1245 * fbgetsp.c
1246 */
1247extern _X_EXPORT void
1248
1249fbGetSpans(DrawablePtr pDrawable,
1250 int wMax,
1251 DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart);
1252
1253/*
1254 * fbglyph.c
1255 */
1256
1257extern _X_EXPORT Bool
1258 fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height);
1259
1260extern _X_EXPORT void
1261
1262fbPolyGlyphBlt(DrawablePtr pDrawable,
1263 GCPtr pGC,
1264 int x,
1265 int y,
1266 unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
1267
1268extern _X_EXPORT void
1269
1270fbImageGlyphBlt(DrawablePtr pDrawable,
1271 GCPtr pGC,
1272 int x,
1273 int y,
1274 unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
1275
1276/*
1277 * fbimage.c
1278 */
1279
1280extern _X_EXPORT void
1281
1282fbPutImage(DrawablePtr pDrawable,
1283 GCPtr pGC,
1284 int depth,
1285 int x, int y, int w, int h, int leftPad, int format, char *pImage);
1286
1287extern _X_EXPORT void
1288
1289fbPutZImage(DrawablePtr pDrawable,
1290 RegionPtr pClip,
1291 int alu,
1292 FbBits pm,
1293 int x,
1294 int y, int width, int height, FbStip * src, FbStride srcStride);
1295
1296extern _X_EXPORT void
1297
1298fbPutXYImage(DrawablePtr pDrawable,
1299 RegionPtr pClip,
1300 FbBits fg,
1301 FbBits bg,
1302 FbBits pm,
1303 int alu,
1304 Bool opaque,
1305 int x,
1306 int y,
1307 int width, int height, FbStip * src, FbStride srcStride, int srcX);
1308
1309extern _X_EXPORT void
1310
1311fbGetImage(DrawablePtr pDrawable,
1312 int x,
1313 int y,
1314 int w, int h, unsigned int format, unsigned long planeMask, char *d);
1315/*
1316 * fbline.c
1317 */
1318
1319extern _X_EXPORT void
1320
1321fbZeroLine(DrawablePtr pDrawable,
1322 GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
1323
1324extern _X_EXPORT void
1325 fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs);
1326
1327extern _X_EXPORT void
1328
1329fbPolyLine(DrawablePtr pDrawable,
1330 GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
1331
1332extern _X_EXPORT void
1333 fbFixCoordModePrevious(int npt, DDXPointPtr ppt);
1334
1335extern _X_EXPORT void
1336 fbPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pseg);
1337
1338#define fbPolyRectangle miPolyRectangle
1339
1340/*
1341 * fbpict.c
1342 */
1343
1344extern _X_EXPORT Bool
1345 fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
1346
1347extern _X_EXPORT void
1348fbDestroyGlyphCache(void);
1349
1350/*
1351 * fbpixmap.c
1352 */
1353
1354extern _X_EXPORT PixmapPtr
1355
1356fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
1357 unsigned usage_hint);
1358
1359extern _X_EXPORT PixmapPtr
1360
1361fbCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
1362 unsigned usage_hint);
1363
1364extern _X_EXPORT Bool
1365 fbDestroyPixmap(PixmapPtr pPixmap);
1366
1367extern _X_EXPORT RegionPtr
1368 fbPixmapToRegion(PixmapPtr pPix);
1369
1370/*
1371 * fbpoint.c
1372 */
1373
1374extern _X_EXPORT void
1375
1376fbDots(FbBits * dstOrig,
1377 FbStride dstStride,
1378 int dstBpp,
1379 BoxPtr pBox,
1380 xPoint * pts,
1381 int npt,
1382 int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig);
1383
1384extern _X_EXPORT void
1385
1386fbPolyPoint(DrawablePtr pDrawable,
1387 GCPtr pGC, int mode, int npt, xPoint * pptInit);
1388
1389/*
1390 * fbpush.c
1391 */
1392extern _X_EXPORT void
1393
1394fbPushPattern(DrawablePtr pDrawable,
1395 GCPtr pGC,
1396 FbStip * src,
1397 FbStride srcStride,
1398 int srcX, int x, int y, int width, int height);
1399
1400extern _X_EXPORT void
1401
1402fbPushFill(DrawablePtr pDrawable,
1403 GCPtr pGC,
1404 FbStip * src,
1405 FbStride srcStride, int srcX, int x, int y, int width, int height);
1406
1407extern _X_EXPORT void
1408
1409fbPushImage(DrawablePtr pDrawable,
1410 GCPtr pGC,
1411 FbStip * src,
1412 FbStride srcStride, int srcX, int x, int y, int width, int height);
1413
1414extern _X_EXPORT void
1415
1416fbPushPixels(GCPtr pGC,
1417 PixmapPtr pBitmap,
1418 DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
1419
1420/*
1421 * fbscreen.c
1422 */
1423
1424extern _X_EXPORT Bool
1425 fbCloseScreen(ScreenPtr pScreen);
1426
1427extern _X_EXPORT Bool
1428 fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
1429
1430extern _X_EXPORT Bool
1431 fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
1432
1433extern _X_EXPORT void
1434
1435fbQueryBestSize(int class,
1436 unsigned short *width, unsigned short *height,
1437 ScreenPtr pScreen);
1438
1439extern _X_EXPORT PixmapPtr
1440 _fbGetWindowPixmap(WindowPtr pWindow);
1441
1442extern _X_EXPORT void
1443 _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap);
1444
1445extern _X_EXPORT Bool
1446 fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
1447 int xsize, /* in pixels */
1448 int ysize, int dpix, /* dots per inch */
1449 int dpiy, int width, /* pixel width of frame buffer */
1450 int bpp); /* bits per pixel of frame buffer */
1451
1452extern _X_EXPORT Bool
1453
1454wfbFinishScreenInit(ScreenPtr pScreen,
1455 pointer pbits,
1456 int xsize,
1457 int ysize,
1458 int dpix,
1459 int dpiy,
1460 int width,
1461 int bpp,
1462 SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap);
1463
1464extern _X_EXPORT Bool
1465
1466wfbScreenInit(ScreenPtr pScreen,
1467 pointer pbits,
1468 int xsize,
1469 int ysize,
1470 int dpix,
1471 int dpiy,
1472 int width,
1473 int bpp,
1474 SetupWrapProcPtr setupWrap, FinishWrapProcPtr finishWrap);
1475
1476extern _X_EXPORT Bool
1477
1478fbFinishScreenInit(ScreenPtr pScreen,
1479 pointer pbits,
1480 int xsize,
1481 int ysize, int dpix, int dpiy, int width, int bpp);
1482
1483extern _X_EXPORT Bool
1484
1485fbScreenInit(ScreenPtr pScreen,
1486 pointer pbits,
1487 int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
1488
1489/*
1490 * fbseg.c
1491 */
1492typedef void FbBres(DrawablePtr pDrawable,
1493 GCPtr pGC,
1494 int dashOffset,
1495 int signdx,
1496 int signdy,
1497 int axis, int x, int y, int e, int e1, int e3, int len);
1498
1499extern _X_EXPORT FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
1500
1501/*
1502 * fbsetsp.c
1503 */
1504
1505extern _X_EXPORT void
1506
1507fbSetSpans(DrawablePtr pDrawable,
1508 GCPtr pGC,
1509 char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
1510
1511extern _X_EXPORT FbBres *fbSelectBres(DrawablePtr pDrawable, GCPtr pGC);
1512
1513extern _X_EXPORT void
1514
1515fbBres(DrawablePtr pDrawable,
1516 GCPtr pGC,
1517 int dashOffset,
1518 int signdx,
1519 int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
1520
1521extern _X_EXPORT void
1522
1523fbSegment(DrawablePtr pDrawable,
1524 GCPtr pGC,
1525 int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset);
1526
1527/*
1528 * fbsolid.c
1529 */
1530
1531extern _X_EXPORT void
1532
1533fbSolid(FbBits * dst,
1534 FbStride dstStride,
1535 int dstX, int bpp, int width, int height, FbBits and, FbBits xor);
1536
1537extern _X_EXPORT void
1538
1539fbSolid24(FbBits * dst,
1540 FbStride dstStride,
1541 int dstX, int width, int height, FbBits and, FbBits xor);
1542
1543/*
1544 * fbstipple.c
1545 */
1546
1547extern _X_EXPORT void
1548 fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n);
1549
1550extern _X_EXPORT void
1551
1552fbEvenStipple(FbBits * dst,
1553 FbStride dstStride,
1554 int dstX,
1555 int dstBpp,
1556 int width,
1557 int height,
1558 FbStip * stip,
1559 FbStride stipStride,
1560 int stipHeight,
1561 FbBits fgand,
1562 FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
1563
1564extern _X_EXPORT void
1565
1566fbOddStipple(FbBits * dst,
1567 FbStride dstStride,
1568 int dstX,
1569 int dstBpp,
1570 int width,
1571 int height,
1572 FbStip * stip,
1573 FbStride stipStride,
1574 int stipWidth,
1575 int stipHeight,
1576 FbBits fgand,
1577 FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
1578
1579extern _X_EXPORT void
1580
1581fbStipple(FbBits * dst,
1582 FbStride dstStride,
1583 int dstX,
1584 int dstBpp,
1585 int width,
1586 int height,
1587 FbStip * stip,
1588 FbStride stipStride,
1589 int stipWidth,
1590 int stipHeight,
1591 Bool even,
1592 FbBits fgand,
1593 FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
1594
1595/*
1596 * fbtile.c
1597 */
1598
1599extern _X_EXPORT void
1600
1601fbEvenTile(FbBits * dst,
1602 FbStride dstStride,
1603 int dstX,
1604 int width,
1605 int height,
1606 FbBits * tile,
1607 FbStride tileStride,
1608 int tileHeight, int alu, FbBits pm, int xRot, int yRot);
1609
1610extern _X_EXPORT void
1611
1612fbOddTile(FbBits * dst,
1613 FbStride dstStride,
1614 int dstX,
1615 int width,
1616 int height,
1617 FbBits * tile,
1618 FbStride tileStride,
1619 int tileWidth,
1620 int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
1621
1622extern _X_EXPORT void
1623
1624fbTile(FbBits * dst,
1625 FbStride dstStride,
1626 int dstX,
1627 int width,
1628 int height,
1629 FbBits * tile,
1630 FbStride tileStride,
1631 int tileWidth,
1632 int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
1633
1634/*
1635 * fbutil.c
1636 */
1637extern _X_EXPORT FbBits fbReplicatePixel(Pixel p, int bpp);
1638
1639extern _X_EXPORT void
1640 fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp);
1641
1642#ifdef FB_ACCESS_WRAPPER
1643extern _X_EXPORT ReadMemoryProcPtr wfbReadMemory;
1644extern _X_EXPORT WriteMemoryProcPtr wfbWriteMemory;
1645#endif
1646
1647/*
1648 * fbwindow.c
1649 */
1650
1651extern _X_EXPORT Bool
1652 fbCreateWindow(WindowPtr pWin);
1653
1654extern _X_EXPORT Bool
1655 fbDestroyWindow(WindowPtr pWin);
1656
1657extern _X_EXPORT Bool
1658 fbMapWindow(WindowPtr pWindow);
1659
1660extern _X_EXPORT Bool
1661 fbPositionWindow(WindowPtr pWin, int x, int y);
1662
1663extern _X_EXPORT Bool
1664 fbUnmapWindow(WindowPtr pWindow);
1665
1666extern _X_EXPORT void
1667
1668fbCopyWindowProc(DrawablePtr pSrcDrawable,
1669 DrawablePtr pDstDrawable,
1670 GCPtr pGC,
1671 BoxPtr pbox,
1672 int nbox,
1673 int dx,
1674 int dy,
1675 Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
1676
1677extern _X_EXPORT void
1678 fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
1679
1680extern _X_EXPORT Bool
1681 fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
1682
1683extern _X_EXPORT void
1684
1685fbFillRegionSolid(DrawablePtr pDrawable,
1686 RegionPtr pRegion, FbBits and, FbBits xor);
1687
1688extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
1689 Bool has_clip,
1690 int *xoff, int *yoff);
1691
1692extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
1693
1694#endif /* _FB_H_ */
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