1 | /*
|
---|
2 | *
|
---|
3 | * Copyright (C) 2000 Keith Packard, member of The XFree86 Project, Inc.
|
---|
4 | * 2005 Zack Rusin, Trolltech
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
7 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
8 | * the above copyright notice appear in all copies and that both that
|
---|
9 | * copyright notice and this permission notice appear in supporting
|
---|
10 | * documentation, and that the name of Keith Packard not be used in
|
---|
11 | * advertising or publicity pertaining to distribution of the software without
|
---|
12 | * specific, written prior permission. Keith Packard makes no
|
---|
13 | * representations about the suitability of this software for any purpose. It
|
---|
14 | * is provided "as is" without express or implied warranty.
|
---|
15 | *
|
---|
16 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
---|
17 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
---|
18 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
---|
19 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
20 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
---|
21 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
---|
22 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
23 | * SOFTWARE.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef EXAPRIV_H
|
---|
27 | #define EXAPRIV_H
|
---|
28 |
|
---|
29 | #ifdef HAVE_XORG_CONFIG_H
|
---|
30 | #include <xorg-config.h>
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include "exa.h"
|
---|
34 |
|
---|
35 | #include <X11/X.h>
|
---|
36 | #define NEED_EVENTS
|
---|
37 | #include <X11/Xproto.h>
|
---|
38 | #include "scrnintstr.h"
|
---|
39 | #include "pixmapstr.h"
|
---|
40 | #include "windowstr.h"
|
---|
41 | #include "servermd.h"
|
---|
42 | #include "mibstore.h"
|
---|
43 | #include "colormapst.h"
|
---|
44 | #include "gcstruct.h"
|
---|
45 | #include "input.h"
|
---|
46 | #include "mipointer.h"
|
---|
47 | #include "mi.h"
|
---|
48 | #include "dix.h"
|
---|
49 | #include "fb.h"
|
---|
50 | #include "fboverlay.h"
|
---|
51 | #ifdef RENDER
|
---|
52 | #include "fbpict.h"
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | #define DEBUG_TRACE_FALL 0
|
---|
56 | #define DEBUG_MIGRATE 0
|
---|
57 | #define DEBUG_PIXMAP 0
|
---|
58 | #define DEBUG_OFFSCREEN 0
|
---|
59 |
|
---|
60 | #if DEBUG_TRACE_FALL
|
---|
61 | #define EXA_FALLBACK(x) \
|
---|
62 | do { \
|
---|
63 | ErrorF("EXA fallback at %s: ", __FUNCTION__); \
|
---|
64 | ErrorF x; \
|
---|
65 | } while (0)
|
---|
66 | #else
|
---|
67 | #define EXA_FALLBACK(x)
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | #ifndef EXA_MAX_FB
|
---|
71 | #define EXA_MAX_FB FB_OVERLAY_MAX
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
|
---|
75 | typedef struct {
|
---|
76 | ExaDriverPtr info;
|
---|
77 | CreateGCProcPtr SavedCreateGC;
|
---|
78 | CloseScreenProcPtr SavedCloseScreen;
|
---|
79 | GetImageProcPtr SavedGetImage;
|
---|
80 | GetSpansProcPtr SavedGetSpans;
|
---|
81 | PaintWindowBackgroundProcPtr SavedPaintWindowBackground;
|
---|
82 | CreatePixmapProcPtr SavedCreatePixmap;
|
---|
83 | DestroyPixmapProcPtr SavedDestroyPixmap;
|
---|
84 | PaintWindowBorderProcPtr SavedPaintWindowBorder;
|
---|
85 | CopyWindowProcPtr SavedCopyWindow;
|
---|
86 | #ifdef RENDER
|
---|
87 | CompositeProcPtr SavedComposite;
|
---|
88 | GlyphsProcPtr SavedGlyphs;
|
---|
89 | #endif
|
---|
90 | EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
|
---|
91 | Bool wrappedEnableDisableFB;
|
---|
92 | Bool swappedOut;
|
---|
93 | } ExaScreenPrivRec, *ExaScreenPrivPtr;
|
---|
94 |
|
---|
95 | /*
|
---|
96 | * This is the only completely portable way to
|
---|
97 | * compute this info.
|
---|
98 | */
|
---|
99 | #ifndef BitsPerPixel
|
---|
100 | #define BitsPerPixel(d) (\
|
---|
101 | PixmapWidthPaddingInfo[d].notPower2 ? \
|
---|
102 | (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
|
---|
103 | ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
|
---|
104 | (PixmapWidthPaddingInfo[d].padRoundUp+1)))
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | extern int exaScreenPrivateIndex;
|
---|
108 | extern int exaPixmapPrivateIndex;
|
---|
109 | #define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)(s)->devPrivates[exaScreenPrivateIndex].ptr)
|
---|
110 | #define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
|
---|
111 |
|
---|
112 | #define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)(p)->devPrivates[exaPixmapPrivateIndex].ptr)
|
---|
113 | #define ExaSetPixmapPriv(p,a) ((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a))
|
---|
114 | #define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
|
---|
115 |
|
---|
116 | typedef struct {
|
---|
117 | ExaOffscreenArea *area;
|
---|
118 | int score;
|
---|
119 | int devKind;
|
---|
120 | DevUnion devPrivate;
|
---|
121 |
|
---|
122 | /* If area is NULL, then dirty == TRUE means that the pixmap has been
|
---|
123 | * modified, so the contents are defined. Used to avoid uploads of
|
---|
124 | * undefined data.
|
---|
125 | * If area is non-NULL, then dirty == TRUE means that the in-framebuffer
|
---|
126 | * copy has been changed from the system-memory copy. Used to avoid
|
---|
127 | * downloads of unmodified data.
|
---|
128 | */
|
---|
129 | Bool dirty;
|
---|
130 | unsigned int size;
|
---|
131 | } ExaPixmapPrivRec, *ExaPixmapPrivPtr;
|
---|
132 |
|
---|
133 |
|
---|
134 | /* exaasync.c */
|
---|
135 | void
|
---|
136 | ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
|
---|
137 | DDXPointPtr ppt, int *pwidth, int fSorted);
|
---|
138 |
|
---|
139 | void
|
---|
140 | ExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
|
---|
141 | DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
|
---|
142 |
|
---|
143 | void
|
---|
144 | ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
|
---|
145 | int x, int y, int w, int h, int leftPad, int format,
|
---|
146 | char *bits);
|
---|
147 |
|
---|
148 | RegionPtr
|
---|
149 | ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
---|
150 | int srcx, int srcy, int w, int h, int dstx, int dsty);
|
---|
151 |
|
---|
152 | RegionPtr
|
---|
153 | ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
---|
154 | int srcx, int srcy, int w, int h, int dstx, int dsty,
|
---|
155 | unsigned long bitPlane);
|
---|
156 |
|
---|
157 | void
|
---|
158 | ExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
---|
159 | DDXPointPtr pptInit);
|
---|
160 |
|
---|
161 | void
|
---|
162 | ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
|
---|
163 | int mode, int npt, DDXPointPtr ppt);
|
---|
164 |
|
---|
165 | void
|
---|
166 | ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
|
---|
167 | int nsegInit, xSegment *pSegInit);
|
---|
168 |
|
---|
169 | void
|
---|
170 | ExaCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
|
---|
171 | int nrects, xRectangle *prect);
|
---|
172 |
|
---|
173 | void
|
---|
174 | ExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
|
---|
175 | int narcs, xArc *pArcs);
|
---|
176 |
|
---|
177 | #define ExaCheckFillPolygon miFillPolygon
|
---|
178 |
|
---|
179 | void
|
---|
180 | ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
|
---|
181 | int nrect, xRectangle *prect);
|
---|
182 |
|
---|
183 | void
|
---|
184 | ExaCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
|
---|
185 | int narcs, xArc *pArcs);
|
---|
186 |
|
---|
187 | void
|
---|
188 | ExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
|
---|
189 | int x, int y, unsigned int nglyph,
|
---|
190 | CharInfoPtr *ppci, pointer pglyphBase);
|
---|
191 |
|
---|
192 | void
|
---|
193 | ExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
|
---|
194 | int x, int y, unsigned int nglyph,
|
---|
195 | CharInfoPtr *ppci, pointer pglyphBase);
|
---|
196 |
|
---|
197 | void
|
---|
198 | ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
|
---|
199 | DrawablePtr pDrawable,
|
---|
200 | int w, int h, int x, int y);
|
---|
201 |
|
---|
202 | void
|
---|
203 | ExaCheckGetImage (DrawablePtr pDrawable,
|
---|
204 | int x, int y, int w, int h,
|
---|
205 | unsigned int format, unsigned long planeMask,
|
---|
206 | char *d);
|
---|
207 |
|
---|
208 | void
|
---|
209 | ExaCheckGetSpans (DrawablePtr pDrawable,
|
---|
210 | int wMax,
|
---|
211 | DDXPointPtr ppt,
|
---|
212 | int *pwidth,
|
---|
213 | int nspans,
|
---|
214 | char *pdstStart);
|
---|
215 |
|
---|
216 | void
|
---|
217 | ExaCheckSaveAreas (PixmapPtr pPixmap,
|
---|
218 | RegionPtr prgnSave,
|
---|
219 | int xorg,
|
---|
220 | int yorg,
|
---|
221 | WindowPtr pWin);
|
---|
222 |
|
---|
223 | void
|
---|
224 | ExaCheckRestoreAreas (PixmapPtr pPixmap,
|
---|
225 | RegionPtr prgnSave,
|
---|
226 | int xorg,
|
---|
227 | int yorg,
|
---|
228 | WindowPtr pWin);
|
---|
229 |
|
---|
230 | void
|
---|
231 | ExaCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
|
---|
232 |
|
---|
233 | extern const GCOps exaAsyncPixmapGCOps;
|
---|
234 |
|
---|
235 | #ifdef RENDER
|
---|
236 | void
|
---|
237 | ExaCheckComposite (CARD8 op,
|
---|
238 | PicturePtr pSrc,
|
---|
239 | PicturePtr pMask,
|
---|
240 | PicturePtr pDst,
|
---|
241 | INT16 xSrc,
|
---|
242 | INT16 ySrc,
|
---|
243 | INT16 xMask,
|
---|
244 | INT16 yMask,
|
---|
245 | INT16 xDst,
|
---|
246 | INT16 yDst,
|
---|
247 | CARD16 width,
|
---|
248 | CARD16 height);
|
---|
249 | #endif
|
---|
250 |
|
---|
251 | /* exaoffscreen.c */
|
---|
252 | void
|
---|
253 | ExaOffscreenMarkUsed (PixmapPtr pPixmap);
|
---|
254 |
|
---|
255 | void
|
---|
256 | ExaOffscreenSwapOut (ScreenPtr pScreen);
|
---|
257 |
|
---|
258 | void
|
---|
259 | ExaOffscreenSwapIn (ScreenPtr pScreen);
|
---|
260 |
|
---|
261 | void
|
---|
262 | ExaOffscreenFini (ScreenPtr pScreen);
|
---|
263 |
|
---|
264 | void
|
---|
265 | exaEnableDisableFBAccess (int index, Bool enable);
|
---|
266 |
|
---|
267 | /* exa.c */
|
---|
268 | void
|
---|
269 | exaDrawableUseScreen(DrawablePtr pDrawable);
|
---|
270 |
|
---|
271 | void
|
---|
272 | exaDrawableUseMemory(DrawablePtr pDrawable);
|
---|
273 |
|
---|
274 | void
|
---|
275 | exaPixmapUseScreen (PixmapPtr pPixmap);
|
---|
276 |
|
---|
277 | void
|
---|
278 | exaPixmapUseMemory (PixmapPtr pPixmap);
|
---|
279 |
|
---|
280 | void
|
---|
281 | exaPrepareAccess(DrawablePtr pDrawable, int index);
|
---|
282 |
|
---|
283 | void
|
---|
284 | exaFinishAccess(DrawablePtr pDrawable, int index);
|
---|
285 |
|
---|
286 | void
|
---|
287 | exaDrawableDirty(DrawablePtr pDrawable);
|
---|
288 |
|
---|
289 | Bool
|
---|
290 | exaDrawableIsOffscreen (DrawablePtr pDrawable);
|
---|
291 |
|
---|
292 | Bool
|
---|
293 | exaPixmapIsOffscreen(PixmapPtr p);
|
---|
294 |
|
---|
295 | PixmapPtr
|
---|
296 | exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
|
---|
297 |
|
---|
298 | void
|
---|
299 | exaMoveInPixmap (PixmapPtr pPixmap);
|
---|
300 |
|
---|
301 | RegionPtr
|
---|
302 | exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
|
---|
303 | int srcx, int srcy, int width, int height, int dstx, int dsty);
|
---|
304 |
|
---|
305 | void
|
---|
306 | exaCopyNtoN (DrawablePtr pSrcDrawable,
|
---|
307 | DrawablePtr pDstDrawable,
|
---|
308 | GCPtr pGC,
|
---|
309 | BoxPtr pbox,
|
---|
310 | int nbox,
|
---|
311 | int dx,
|
---|
312 | int dy,
|
---|
313 | Bool reverse,
|
---|
314 | Bool upsidedown,
|
---|
315 | Pixel bitplane,
|
---|
316 | void *closure);
|
---|
317 |
|
---|
318 | void
|
---|
319 | exaComposite(CARD8 op,
|
---|
320 | PicturePtr pSrc,
|
---|
321 | PicturePtr pMask,
|
---|
322 | PicturePtr pDst,
|
---|
323 | INT16 xSrc,
|
---|
324 | INT16 ySrc,
|
---|
325 | INT16 xMask,
|
---|
326 | INT16 yMask,
|
---|
327 | INT16 xDst,
|
---|
328 | INT16 yDst,
|
---|
329 | CARD16 width,
|
---|
330 | CARD16 height);
|
---|
331 |
|
---|
332 | void
|
---|
333 | exaGlyphs (CARD8 op,
|
---|
334 | PicturePtr pSrc,
|
---|
335 | PicturePtr pDst,
|
---|
336 | PictFormatPtr maskFormat,
|
---|
337 | INT16 xSrc,
|
---|
338 | INT16 ySrc,
|
---|
339 | int nlist,
|
---|
340 | GlyphListPtr list,
|
---|
341 | GlyphPtr *glyphs);
|
---|
342 |
|
---|
343 | #endif /* EXAPRIV_H */
|
---|