VirtualBox

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

Last change on this file since 36304 was 28062, checked in by vboxsync, 15 years ago

Additions/x11/x11include: header files for building X.Org server 1.8 drivers

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