xref: /OK3568_Linux_fs/external/xserver/Xext/shmint.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright © 2003 Keith Packard
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission to use, copy, modify, distribute, and sell this software and its
5*4882a593Smuzhiyun  * documentation for any purpose is hereby granted without fee, provided that
6*4882a593Smuzhiyun  * the above copyright notice appear in all copies and that both that
7*4882a593Smuzhiyun  * copyright notice and this permission notice appear in supporting
8*4882a593Smuzhiyun  * documentation, and that the name of Keith Packard not be used in
9*4882a593Smuzhiyun  * advertising or publicity pertaining to distribution of the software without
10*4882a593Smuzhiyun  * specific, written prior permission.  Keith Packard makes no
11*4882a593Smuzhiyun  * representations about the suitability of this software for any purpose.  It
12*4882a593Smuzhiyun  * is provided "as is" without express or implied warranty.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15*4882a593Smuzhiyun  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16*4882a593Smuzhiyun  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17*4882a593Smuzhiyun  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18*4882a593Smuzhiyun  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19*4882a593Smuzhiyun  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20*4882a593Smuzhiyun  * PERFORMANCE OF THIS SOFTWARE.
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #ifndef _SHMINT_H_
24*4882a593Smuzhiyun #define _SHMINT_H_
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include <X11/extensions/shmproto.h>
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #include "screenint.h"
29*4882a593Smuzhiyun #include "pixmap.h"
30*4882a593Smuzhiyun #include "gc.h"
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #define XSHM_PUT_IMAGE_ARGS \
33*4882a593Smuzhiyun     DrawablePtr		/* dst */, \
34*4882a593Smuzhiyun     GCPtr		/* pGC */, \
35*4882a593Smuzhiyun     int			/* depth */, \
36*4882a593Smuzhiyun     unsigned int	/* format */, \
37*4882a593Smuzhiyun     int			/* w */, \
38*4882a593Smuzhiyun     int			/* h */, \
39*4882a593Smuzhiyun     int			/* sx */, \
40*4882a593Smuzhiyun     int			/* sy */, \
41*4882a593Smuzhiyun     int			/* sw */, \
42*4882a593Smuzhiyun     int			/* sh */, \
43*4882a593Smuzhiyun     int			/* dx */, \
44*4882a593Smuzhiyun     int			/* dy */, \
45*4882a593Smuzhiyun     char *                      /* data */
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #define XSHM_CREATE_PIXMAP_ARGS \
48*4882a593Smuzhiyun     ScreenPtr	/* pScreen */, \
49*4882a593Smuzhiyun     int		/* width */, \
50*4882a593Smuzhiyun     int		/* height */, \
51*4882a593Smuzhiyun     int		/* depth */, \
52*4882a593Smuzhiyun     char *                      /* addr */
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun typedef struct _ShmFuncs {
55*4882a593Smuzhiyun     PixmapPtr (*CreatePixmap) (XSHM_CREATE_PIXMAP_ARGS);
56*4882a593Smuzhiyun     void (*PutImage) (XSHM_PUT_IMAGE_ARGS);
57*4882a593Smuzhiyun } ShmFuncs, *ShmFuncsPtr;
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun #if XTRANS_SEND_FDS
60*4882a593Smuzhiyun #define SHM_FD_PASSING  1
61*4882a593Smuzhiyun #endif
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun typedef struct _ShmDesc {
64*4882a593Smuzhiyun     struct _ShmDesc *next;
65*4882a593Smuzhiyun     int shmid;
66*4882a593Smuzhiyun     int refcnt;
67*4882a593Smuzhiyun     char *addr;
68*4882a593Smuzhiyun     Bool writable;
69*4882a593Smuzhiyun     unsigned long size;
70*4882a593Smuzhiyun #ifdef SHM_FD_PASSING
71*4882a593Smuzhiyun     Bool is_fd;
72*4882a593Smuzhiyun     struct busfault *busfault;
73*4882a593Smuzhiyun     XID resource;
74*4882a593Smuzhiyun #endif
75*4882a593Smuzhiyun } ShmDescRec, *ShmDescPtr;
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun #ifdef SHM_FD_PASSING
78*4882a593Smuzhiyun #define SHMDESC_IS_FD(shmdesc)  ((shmdesc)->is_fd)
79*4882a593Smuzhiyun #else
80*4882a593Smuzhiyun #define SHMDESC_IS_FD(shmdesc)  (0)
81*4882a593Smuzhiyun #endif
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun extern _X_EXPORT void
84*4882a593Smuzhiyun  ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun extern _X_EXPORT void
87*4882a593Smuzhiyun  ShmRegisterFbFuncs(ScreenPtr pScreen);
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun extern _X_EXPORT RESTYPE ShmSegType;
90*4882a593Smuzhiyun extern _X_EXPORT int ShmCompletionCode;
91*4882a593Smuzhiyun extern _X_EXPORT int BadShmSegCode;
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun #endif                          /* _SHMINT_H_ */
94