VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.1.0/exa_priv.h@ 79043

Last change on this file since 79043 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 11.0 KB
Line 
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_DIX_CONFIG_H
30#include <dix-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) \
62do { \
63 ErrorF("EXA fallback at %s: ", __FUNCTION__); \
64 ErrorF x; \
65} while (0)
66#else
67#define EXA_FALLBACK(x)
68#endif
69
70#if DEBUG_PIXMAP
71#define DBG_PIXMAP(a) ErrorF a
72#else
73#define DBG_PIXMAP(a)
74#endif
75
76#ifndef EXA_MAX_FB
77#define EXA_MAX_FB FB_OVERLAY_MAX
78#endif
79
80/**
81 * This is the list of migration heuristics supported by EXA. See
82 * exaDoMigration() for what their implementations do.
83 */
84enum ExaMigrationHeuristic {
85 ExaMigrationGreedy,
86 ExaMigrationAlways
87};
88
89typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
90typedef struct {
91 ExaDriverPtr info;
92 CreateGCProcPtr SavedCreateGC;
93 CloseScreenProcPtr SavedCloseScreen;
94 GetImageProcPtr SavedGetImage;
95 GetSpansProcPtr SavedGetSpans;
96 PaintWindowBackgroundProcPtr SavedPaintWindowBackground;
97 CreatePixmapProcPtr SavedCreatePixmap;
98 DestroyPixmapProcPtr SavedDestroyPixmap;
99 PaintWindowBorderProcPtr SavedPaintWindowBorder;
100 CopyWindowProcPtr SavedCopyWindow;
101#ifdef RENDER
102 CompositeProcPtr SavedComposite;
103 RasterizeTrapezoidProcPtr SavedRasterizeTrapezoid;
104 AddTrianglesProcPtr SavedAddTriangles;
105 GlyphsProcPtr SavedGlyphs;
106#endif
107 Bool swappedOut;
108 enum ExaMigrationHeuristic migration;
109 Bool hideOffscreenPixmapData;
110} ExaScreenPrivRec, *ExaScreenPrivPtr;
111
112/*
113 * This is the only completely portable way to
114 * compute this info.
115 */
116#ifndef BitsPerPixel
117#define BitsPerPixel(d) (\
118 PixmapWidthPaddingInfo[d].notPower2 ? \
119 (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
120 ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
121 (PixmapWidthPaddingInfo[d].padRoundUp+1)))
122#endif
123
124extern int exaScreenPrivateIndex;
125extern int exaPixmapPrivateIndex;
126#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)(s)->devPrivates[exaScreenPrivateIndex].ptr)
127#define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
128
129/** Align an offset to an arbitrary alignment */
130#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
131 (((offset) + (align) - 1) % (align)))
132/** Align an offset to a power-of-two alignment */
133#define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
134
135/**
136 * Returns TRUE if the given planemask covers all the significant bits in the
137 * pixel values for pDrawable.
138 */
139#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
140 (((_pm) & FbFullMask((_pDrawable)->depth)) == \
141 FbFullMask((_pDrawable)->depth))
142
143#define EXA_PIXMAP_SCORE_MOVE_IN 10
144#define EXA_PIXMAP_SCORE_MAX 20
145#define EXA_PIXMAP_SCORE_MOVE_OUT -10
146#define EXA_PIXMAP_SCORE_MIN -20
147#define EXA_PIXMAP_SCORE_PINNED 1000
148#define EXA_PIXMAP_SCORE_INIT 1001
149
150#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)(p)->devPrivates[exaPixmapPrivateIndex].ptr)
151#define ExaSetPixmapPriv(p,a) ((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a))
152#define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
153
154typedef struct {
155 ExaOffscreenArea *area;
156 int score; /**< score for the move-in vs move-out heuristic */
157
158 CARD8 *sys_ptr; /**< pointer to pixmap data in system memory */
159 int sys_pitch; /**< pitch of pixmap in system memory */
160
161 CARD8 *fb_ptr; /**< pointer to pixmap data in framebuffer memory */
162 int fb_pitch; /**< pitch of pixmap in framebuffer memory */
163 unsigned int fb_size; /**< size of pixmap in framebuffer memory */
164
165 /**
166 * If area is NULL, then dirty == TRUE means that the pixmap has been
167 * modified, so the contents are defined. Used to avoid uploads of
168 * undefined data.
169 *
170 * If area is non-NULL, then dirty == TRUE means that the pixmap data at
171 * pPixmap->devPrivate.ptr (either fb_ptr or sys_ptr) has been changed
172 * compared to the copy in the other location. This is used to avoid
173 * uploads/downloads of unmodified data.
174 */
175 Bool dirty;
176} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
177
178typedef struct _ExaMigrationRec {
179 Bool as_dst;
180 Bool as_src;
181 PixmapPtr pPix;
182} ExaMigrationRec, *ExaMigrationPtr;
183
184/**
185 * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
186 * to set EXA options or hook in screen functions to handle using EXA as the AA.
187 */
188void exaDDXDriverInit (ScreenPtr pScreen);
189
190/* exa_unaccel.c */
191void
192exaPrepareAccessGC(GCPtr pGC);
193
194void
195exaFinishAccessGC(GCPtr pGC);
196
197void
198ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
199 DDXPointPtr ppt, int *pwidth, int fSorted);
200
201void
202ExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
203 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
204
205void
206ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
207 int x, int y, int w, int h, int leftPad, int format,
208 char *bits);
209
210RegionPtr
211ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
212 int srcx, int srcy, int w, int h, int dstx, int dsty);
213
214RegionPtr
215ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
216 int srcx, int srcy, int w, int h, int dstx, int dsty,
217 unsigned long bitPlane);
218
219void
220ExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
221 DDXPointPtr pptInit);
222
223void
224ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
225 int mode, int npt, DDXPointPtr ppt);
226
227void
228ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
229 int nsegInit, xSegment *pSegInit);
230
231void
232ExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
233 int narcs, xArc *pArcs);
234
235void
236ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
237 int nrect, xRectangle *prect);
238
239void
240ExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
241 int x, int y, unsigned int nglyph,
242 CharInfoPtr *ppci, pointer pglyphBase);
243
244void
245ExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
246 int x, int y, unsigned int nglyph,
247 CharInfoPtr *ppci, pointer pglyphBase);
248
249void
250ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
251 DrawablePtr pDrawable,
252 int w, int h, int x, int y);
253
254void
255ExaCheckGetImage (DrawablePtr pDrawable,
256 int x, int y, int w, int h,
257 unsigned int format, unsigned long planeMask,
258 char *d);
259
260void
261ExaCheckGetSpans (DrawablePtr pDrawable,
262 int wMax,
263 DDXPointPtr ppt,
264 int *pwidth,
265 int nspans,
266 char *pdstStart);
267
268void
269ExaCheckSaveAreas (PixmapPtr pPixmap,
270 RegionPtr prgnSave,
271 int xorg,
272 int yorg,
273 WindowPtr pWin);
274
275void
276ExaCheckRestoreAreas (PixmapPtr pPixmap,
277 RegionPtr prgnSave,
278 int xorg,
279 int yorg,
280 WindowPtr pWin);
281
282void
283ExaCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
284
285CARD32
286exaGetPixmapFirstPixel (PixmapPtr pPixmap);
287
288/* exa_accel.c */
289void
290exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
291
292void
293exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
294
295void
296exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
297 unsigned int format, unsigned long planeMask, char *d);
298
299void
300exaGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth,
301 int nspans, char *pdstStart);
302
303extern const GCOps exaOps;
304
305#ifdef RENDER
306void
307ExaCheckComposite (CARD8 op,
308 PicturePtr pSrc,
309 PicturePtr pMask,
310 PicturePtr pDst,
311 INT16 xSrc,
312 INT16 ySrc,
313 INT16 xMask,
314 INT16 yMask,
315 INT16 xDst,
316 INT16 yDst,
317 CARD16 width,
318 CARD16 height);
319#endif
320
321/* exaoffscreen.c */
322void
323ExaOffscreenMarkUsed (PixmapPtr pPixmap);
324
325void
326ExaOffscreenSwapOut (ScreenPtr pScreen);
327
328void
329ExaOffscreenSwapIn (ScreenPtr pScreen);
330
331Bool
332exaOffscreenInit(ScreenPtr pScreen);
333
334void
335ExaOffscreenFini (ScreenPtr pScreen);
336
337/* exa.c */
338void
339exaPrepareAccess(DrawablePtr pDrawable, int index);
340
341void
342exaFinishAccess(DrawablePtr pDrawable, int index);
343
344void
345exaDrawableDirty(DrawablePtr pDrawable);
346
347Bool
348exaDrawableIsOffscreen (DrawablePtr pDrawable);
349
350Bool
351exaPixmapIsOffscreen(PixmapPtr p);
352
353PixmapPtr
354exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
355
356PixmapPtr
357exaGetDrawablePixmap(DrawablePtr pDrawable);
358
359RegionPtr
360exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
361 int srcx, int srcy, int width, int height, int dstx, int dsty);
362
363void
364exaCopyNtoN (DrawablePtr pSrcDrawable,
365 DrawablePtr pDstDrawable,
366 GCPtr pGC,
367 BoxPtr pbox,
368 int nbox,
369 int dx,
370 int dy,
371 Bool reverse,
372 Bool upsidedown,
373 Pixel bitplane,
374 void *closure);
375
376/* exa_render.c */
377void
378exaComposite(CARD8 op,
379 PicturePtr pSrc,
380 PicturePtr pMask,
381 PicturePtr pDst,
382 INT16 xSrc,
383 INT16 ySrc,
384 INT16 xMask,
385 INT16 yMask,
386 INT16 xDst,
387 INT16 yDst,
388 CARD16 width,
389 CARD16 height);
390
391void
392exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
393 int x_off, int y_off);
394
395void
396exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
397 xTriangle *tris);
398
399void
400exaGlyphs (CARD8 op,
401 PicturePtr pSrc,
402 PicturePtr pDst,
403 PictFormatPtr maskFormat,
404 INT16 xSrc,
405 INT16 ySrc,
406 int nlist,
407 GlyphListPtr list,
408 GlyphPtr *glyphs);
409
410/* exa_migration.c */
411void
412exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
413
414void
415exaMoveInPixmap (PixmapPtr pPixmap);
416
417void
418exaMoveOutPixmap (PixmapPtr pPixmap);
419
420#endif /* EXAPRIV_H */
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