xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/darwinfb.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2009 Apple, Inc.
3*4882a593Smuzhiyun  * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
6*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
7*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
8*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
10*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included in
13*4882a593Smuzhiyun  * all copies or substantial portions of the Software.
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*4882a593Smuzhiyun  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18*4882a593Smuzhiyun  * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19*4882a593Smuzhiyun  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20*4882a593Smuzhiyun  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21*4882a593Smuzhiyun  * DEALINGS IN THE SOFTWARE.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  * Except as contained in this notice, the name(s) of the above copyright
24*4882a593Smuzhiyun  * holders shall not be used in advertising or otherwise to promote the sale,
25*4882a593Smuzhiyun  * use or other dealings in this Software without prior written authorization.
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #ifndef _DARWIN_FB_H
29*4882a593Smuzhiyun #define _DARWIN_FB_H
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #include "scrnintstr.h"
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun typedef struct {
34*4882a593Smuzhiyun     void                *framebuffer;
35*4882a593Smuzhiyun     int x;
36*4882a593Smuzhiyun     int y;
37*4882a593Smuzhiyun     int width;
38*4882a593Smuzhiyun     int height;
39*4882a593Smuzhiyun     int pitch;
40*4882a593Smuzhiyun     int depth;
41*4882a593Smuzhiyun     int visuals;
42*4882a593Smuzhiyun     int bitsPerRGB;
43*4882a593Smuzhiyun     int bitsPerPixel;
44*4882a593Smuzhiyun     int preferredCVC;
45*4882a593Smuzhiyun     Pixel redMask;
46*4882a593Smuzhiyun     Pixel greenMask;
47*4882a593Smuzhiyun     Pixel blueMask;
48*4882a593Smuzhiyun } DarwinFramebufferRec, *DarwinFramebufferPtr;
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #define MASK_LH(l, h)       (((1 << (1 + (h) - (l))) - 1) << (l))
51*4882a593Smuzhiyun #define BM_ARGB(a, r, g, b) MASK_LH(0, (b) - 1)
52*4882a593Smuzhiyun #define GM_ARGB(a, r, g, b) MASK_LH(b, (b) + (g) - 1)
53*4882a593Smuzhiyun #define RM_ARGB(a, r, g, b) MASK_LH((b) + (g), (b) + (g) + (r) - 1)
54*4882a593Smuzhiyun #define AM_ARGB(a, r, g, b) MASK_LH((b) + (g) + (r), \
55*4882a593Smuzhiyun                                     (b) + (g) + (r) + (a) - 1)
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun #endif  /* _DARWIN_FB_H */
58