Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / kdrive / ephyr / ephyr.h
1 /*
2 * Xephyr - A kdrive X server thats runs in a host X window.
3 * Authored by Matthew Allum <mallum@o-hand.com>
4 *
5 * Copyright © 2004 Nokia
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Nokia not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Nokia makes no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
16 *
17 * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 * PERFORMANCE OF THIS SOFTWARE.
24 */
25
26 #ifndef _EPHYR_H_
27 #define _EPHYR_H_
28 #include <stdio.h>
29 #include <unistd.h>
30 #include <signal.h>
31 #include <libgen.h>
32 #include <xcb/xcb_image.h>
33
34 #include "os.h" /* for OsSignal() */
35 #include "kdrive.h"
36 #include "hostx.h"
37 #include "exa.h"
38
39 #ifdef RANDR
40 #include "randrstr.h"
41 #endif
42
43 #include "damage.h"
44
45 typedef struct _ephyrPriv {
46 CARD8 *base;
47 int bytes_per_line;
48 } EphyrPriv;
49
50 typedef struct _ephyrFakexaPriv {
51 ExaDriverPtr exa;
52 Bool is_synced;
53
54 /* The following are arguments and other information from Prepare* calls
55 * which are stored for use in the inner calls.
56 */
57 int op;
58 PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
59 void *saved_ptrs[3];
60 PixmapPtr pDst, pSrc, pMask;
61 GCPtr pGC;
62 } EphyrFakexaPriv;
63
64 typedef struct _ephyrScrPriv {
65 /* ephyr server info */
66 Rotation randr;
67 Bool shadow;
68 DamagePtr pDamage;
69 EphyrFakexaPriv *fakexa;
70
71 /* Host X window info */
72 xcb_window_t win;
73 xcb_window_t win_pre_existing; /* Set via -parent option like xnest */
74 xcb_window_t peer_win; /* Used for GL; should be at most one */
75 xcb_image_t *ximg;
76 int win_width, win_height;
77 int server_depth;
78 unsigned char *fb_data; /* only used when host bpp != server bpp */
79 xcb_shm_segment_info_t shminfo;
80
81 KdScreenInfo *screen;
82 int mynum; /* Screen number */
83 } EphyrScrPriv;
84
85 extern KdCardFuncs ephyrFuncs;
86 extern KdKeyboardInfo *ephyrKbd;
87 extern KdPointerInfo *ephyrMouse;
88
89 extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
90
91 Bool
92 ephyrInitialize(KdCardInfo * card, EphyrPriv * priv);
93
94 Bool
95 ephyrCardInit(KdCardInfo * card);
96
97 Bool
98 ephyrScreenInitialize(KdScreenInfo *screen);
99
100 Bool
101 ephyrInitScreen(ScreenPtr pScreen);
102
103 Bool
104 ephyrFinishInitScreen(ScreenPtr pScreen);
105
106 Bool
107 ephyrCreateResources(ScreenPtr pScreen);
108
109 void
110 ephyrPreserve(KdCardInfo * card);
111
112 Bool
113 ephyrEnable(ScreenPtr pScreen);
114
115 Bool
116 ephyrDPMS(ScreenPtr pScreen, int mode);
117
118 void
119 ephyrDisable(ScreenPtr pScreen);
120
121 void
122 ephyrRestore(KdCardInfo * card);
123
124 void
125 ephyrScreenFini(KdScreenInfo * screen);
126
127 void
128 ephyrCardFini(KdCardInfo * card);
129
130 void
131 ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
132
133 void
134 ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
135
136 Bool
137 ephyrMapFramebuffer(KdScreenInfo * screen);
138
139 void *ephyrWindowLinear(ScreenPtr pScreen,
140 CARD32 row,
141 CARD32 offset, int mode, CARD32 *size, void *closure);
142
143 void
144 ephyrSetScreenSizes(ScreenPtr pScreen);
145
146 Bool
147 ephyrUnmapFramebuffer(KdScreenInfo * screen);
148
149 void
150 ephyrUnsetInternalDamage(ScreenPtr pScreen);
151
152 Bool
153 ephyrSetInternalDamage(ScreenPtr pScreen);
154
155 Bool
156 ephyrCreateColormap(ColormapPtr pmap);
157
158 void
159 ephyrPoll(void);
160
161 #ifdef RANDR
162 Bool
163 ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations);
164
165 Bool
166
167 ephyrRandRSetConfig(ScreenPtr pScreen,
168 Rotation randr, int rate, RRScreenSizePtr pSize);
169 Bool
170 ephyrRandRInit(ScreenPtr pScreen);
171
172 void
173 ephyrShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf);
174
175 #endif
176
177 void
178 ephyrUpdateModifierState(unsigned int state);
179
180 extern KdPointerDriver EphyrMouseDriver;
181
182 extern KdKeyboardDriver EphyrKeyboardDriver;
183
184 extern KdOsFuncs EphyrOsFuncs;
185
186 extern Bool ephyrCursorInit(ScreenPtr pScreen);
187
188 extern void ephyrCursorEnable(ScreenPtr pScreen);
189
190 extern int ephyrBufferHeight(KdScreenInfo * screen);
191
192 /* ephyr_draw.c */
193
194 Bool
195 ephyrDrawInit(ScreenPtr pScreen);
196
197 void
198 ephyrDrawEnable(ScreenPtr pScreen);
199
200 void
201 ephyrDrawDisable(ScreenPtr pScreen);
202
203 void
204 ephyrDrawFini(ScreenPtr pScreen);
205
206 /*ephyvideo.c*/
207
208 Bool ephyrInitVideo(ScreenPtr pScreen);
209
210 #endif