VirtualBox

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

最後變更 在這個檔案從37801是 17471,由 vboxsync 提交於 16 年 前

export to OSE

  • 屬性 svn:eol-style 設為 native
檔案大小: 12.0 KB
 
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#ifdef MITSHM
39#include "shmint.h"
40#endif
41#include "scrnintstr.h"
42#include "pixmapstr.h"
43#include "windowstr.h"
44#include "servermd.h"
45#include "mibstore.h"
46#include "colormapst.h"
47#include "gcstruct.h"
48#include "input.h"
49#include "mipointer.h"
50#include "mi.h"
51#include "dix.h"
52#include "fb.h"
53#include "fboverlay.h"
54#ifdef RENDER
55#include "fbpict.h"
56#include "glyphstr.h"
57#endif
58#include "damage.h"
59
60#define DEBUG_TRACE_FALL 0
61#define DEBUG_MIGRATE 0
62#define DEBUG_PIXMAP 0
63#define DEBUG_OFFSCREEN 0
64
65#if DEBUG_TRACE_FALL
66#define EXA_FALLBACK(x) \
67do { \
68 ErrorF("EXA fallback at %s: ", __FUNCTION__); \
69 ErrorF x; \
70} while (0)
71
72char
73exaDrawableLocation(DrawablePtr pDrawable);
74#else
75#define EXA_FALLBACK(x)
76#endif
77
78#if DEBUG_PIXMAP
79#define DBG_PIXMAP(a) ErrorF a
80#else
81#define DBG_PIXMAP(a)
82#endif
83
84#ifndef EXA_MAX_FB
85#define EXA_MAX_FB FB_OVERLAY_MAX
86#endif
87
88/**
89 * This is the list of migration heuristics supported by EXA. See
90 * exaDoMigration() for what their implementations do.
91 */
92enum ExaMigrationHeuristic {
93 ExaMigrationGreedy,
94 ExaMigrationAlways,
95 ExaMigrationSmart
96};
97
98typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
99typedef struct {
100 ExaDriverPtr info;
101 CreateGCProcPtr SavedCreateGC;
102 CloseScreenProcPtr SavedCloseScreen;
103 GetImageProcPtr SavedGetImage;
104 GetSpansProcPtr SavedGetSpans;
105 CreatePixmapProcPtr SavedCreatePixmap;
106 DestroyPixmapProcPtr SavedDestroyPixmap;
107 CopyWindowProcPtr SavedCopyWindow;
108 ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
109 BitmapToRegionProcPtr SavedBitmapToRegion;
110 CreateScreenResourcesProcPtr SavedCreateScreenResources;
111 ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
112#ifdef RENDER
113 CompositeProcPtr SavedComposite;
114 TrianglesProcPtr SavedTriangles;
115 GlyphsProcPtr SavedGlyphs;
116 TrapezoidsProcPtr SavedTrapezoids;
117 AddTrapsProcPtr SavedAddTraps;
118#endif
119
120 Bool swappedOut;
121 enum ExaMigrationHeuristic migration;
122 Bool checkDirtyCorrectness;
123 unsigned disableFbCount;
124 Bool optimize_migration;
125 unsigned offScreenCounter;
126} ExaScreenPrivRec, *ExaScreenPrivPtr;
127
128/*
129 * This is the only completely portable way to
130 * compute this info.
131 */
132#ifndef BitsPerPixel
133#define BitsPerPixel(d) (\
134 PixmapWidthPaddingInfo[d].notPower2 ? \
135 (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
136 ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
137 (PixmapWidthPaddingInfo[d].padRoundUp+1)))
138#endif
139
140extern DevPrivateKey exaScreenPrivateKey;
141extern DevPrivateKey exaPixmapPrivateKey;
142#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
143#define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
144
145/** Align an offset to an arbitrary alignment */
146#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
147 (((offset) + (align) - 1) % (align)))
148/** Align an offset to a power-of-two alignment */
149#define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
150
151#define EXA_PIXMAP_SCORE_MOVE_IN 10
152#define EXA_PIXMAP_SCORE_MAX 20
153#define EXA_PIXMAP_SCORE_MOVE_OUT -10
154#define EXA_PIXMAP_SCORE_MIN -20
155#define EXA_PIXMAP_SCORE_PINNED 1000
156#define EXA_PIXMAP_SCORE_INIT 1001
157
158#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey))
159#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a)
160#define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
161
162#define EXA_RANGE_PITCH (1 << 0)
163#define EXA_RANGE_WIDTH (1 << 1)
164#define EXA_RANGE_HEIGHT (1 << 2)
165
166typedef struct {
167 ExaOffscreenArea *area;
168 int score; /**< score for the move-in vs move-out heuristic */
169 Bool offscreen;
170
171 CARD8 *sys_ptr; /**< pointer to pixmap data in system memory */
172 int sys_pitch; /**< pitch of pixmap in system memory */
173
174 CARD8 *fb_ptr; /**< pointer to pixmap data in framebuffer memory */
175 int fb_pitch; /**< pitch of pixmap in framebuffer memory */
176 unsigned int fb_size; /**< size of pixmap in framebuffer memory */
177
178 /**
179 * Holds information about whether this pixmap can be used for
180 * acceleration (== 0) or not (> 0).
181 *
182 * Contains a OR'ed combination of the following values:
183 * EXA_RANGE_PITCH - set if the pixmap's pitch is out of range
184 * EXA_RANGE_WIDTH - set if the pixmap's width is out of range
185 * EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
186 */
187 unsigned int accel_blocked;
188
189 /**
190 * The damage record contains the areas of the pixmap's current location
191 * (framebuffer or system) that have been damaged compared to the other
192 * location.
193 */
194 DamagePtr pDamage;
195 /**
196 * The valid regions mark the valid bits (at least, as they're derived from
197 * damage, which may be overreported) of a pixmap's system and FB copies.
198 */
199 RegionRec validSys, validFB;
200 /**
201 * Driver private storage per EXA pixmap
202 */
203 void *driverPriv;
204} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
205
206typedef struct _ExaMigrationRec {
207 Bool as_dst;
208 Bool as_src;
209 PixmapPtr pPix;
210 RegionPtr pReg;
211} ExaMigrationRec, *ExaMigrationPtr;
212
213/**
214 * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
215 * to set EXA options or hook in screen functions to handle using EXA as the AA.
216 */
217void exaDDXDriverInit (ScreenPtr pScreen);
218
219void
220exaPrepareAccessWindow(WindowPtr pWin);
221
222void
223exaFinishAccessWindow(WindowPtr pWin);
224
225/* exa_unaccel.c */
226void
227exaPrepareAccessGC(GCPtr pGC);
228
229void
230exaFinishAccessGC(GCPtr pGC);
231
232void
233ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
234 DDXPointPtr ppt, int *pwidth, int fSorted);
235
236void
237ExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
238 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
239
240void
241ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
242 int x, int y, int w, int h, int leftPad, int format,
243 char *bits);
244
245RegionPtr
246ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
247 int srcx, int srcy, int w, int h, int dstx, int dsty);
248
249RegionPtr
250ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
251 int srcx, int srcy, int w, int h, int dstx, int dsty,
252 unsigned long bitPlane);
253
254void
255ExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
256 DDXPointPtr pptInit);
257
258void
259ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
260 int mode, int npt, DDXPointPtr ppt);
261
262void
263ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
264 int nsegInit, xSegment *pSegInit);
265
266void
267ExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
268 int narcs, xArc *pArcs);
269
270void
271ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
272 int nrect, xRectangle *prect);
273
274void
275ExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
276 int x, int y, unsigned int nglyph,
277 CharInfoPtr *ppci, pointer pglyphBase);
278
279void
280ExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
281 int x, int y, unsigned int nglyph,
282 CharInfoPtr *ppci, pointer pglyphBase);
283
284void
285ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
286 DrawablePtr pDrawable,
287 int w, int h, int x, int y);
288
289void
290ExaCheckGetSpans (DrawablePtr pDrawable,
291 int wMax,
292 DDXPointPtr ppt,
293 int *pwidth,
294 int nspans,
295 char *pdstStart);
296
297void
298ExaCheckAddTraps (PicturePtr pPicture,
299 INT16 x_off,
300 INT16 y_off,
301 int ntrap,
302 xTrap *traps);
303
304/* exa_accel.c */
305
306static _X_INLINE Bool
307exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
308 unsigned int fillStyle, unsigned char alu)
309{
310 return ((alu != GXcopy && alu != GXclear &&alu != GXset &&
311 alu != GXcopyInverted) || fillStyle == FillStippled ||
312 !EXA_PM_IS_SOLID(pDrawable, planemask));
313}
314
315void
316exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
317
318Bool
319exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
320 DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu);
321
322void
323exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
324 unsigned int format, unsigned long planeMask, char *d);
325
326extern const GCOps exaOps;
327
328#ifdef RENDER
329void
330ExaCheckComposite (CARD8 op,
331 PicturePtr pSrc,
332 PicturePtr pMask,
333 PicturePtr pDst,
334 INT16 xSrc,
335 INT16 ySrc,
336 INT16 xMask,
337 INT16 yMask,
338 INT16 xDst,
339 INT16 yDst,
340 CARD16 width,
341 CARD16 height);
342#endif
343
344/* exa_offscreen.c */
345void
346ExaOffscreenSwapOut (ScreenPtr pScreen);
347
348void
349ExaOffscreenSwapIn (ScreenPtr pScreen);
350
351Bool
352exaOffscreenInit(ScreenPtr pScreen);
353
354void
355ExaOffscreenFini (ScreenPtr pScreen);
356
357/* exa.c */
358void
359ExaDoPrepareAccess(DrawablePtr pDrawable, int index);
360
361void
362exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg);
363
364void
365exaPrepareAccess(DrawablePtr pDrawable, int index);
366
367void
368exaFinishAccess(DrawablePtr pDrawable, int index);
369
370void
371exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
372
373void
374exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
375 int *xp, int *yp);
376
377Bool
378exaPixmapIsOffscreen(PixmapPtr p);
379
380PixmapPtr
381exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
382
383PixmapPtr
384exaGetDrawablePixmap(DrawablePtr pDrawable);
385
386RegionPtr
387exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
388 int srcx, int srcy, int width, int height, int dstx, int dsty);
389
390void
391exaCopyNtoN (DrawablePtr pSrcDrawable,
392 DrawablePtr pDstDrawable,
393 GCPtr pGC,
394 BoxPtr pbox,
395 int nbox,
396 int dx,
397 int dy,
398 Bool reverse,
399 Bool upsidedown,
400 Pixel bitplane,
401 void *closure);
402
403/* exa_render.c */
404Bool
405exaOpReadsDestination (CARD8 op);
406
407void
408exaComposite(CARD8 op,
409 PicturePtr pSrc,
410 PicturePtr pMask,
411 PicturePtr pDst,
412 INT16 xSrc,
413 INT16 ySrc,
414 INT16 xMask,
415 INT16 yMask,
416 INT16 xDst,
417 INT16 yDst,
418 CARD16 width,
419 CARD16 height);
420
421void
422exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
423 PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
424 int ntrap, xTrapezoid *traps);
425
426void
427exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
428 PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
429 int ntri, xTriangle *tris);
430
431void
432exaGlyphs (CARD8 op,
433 PicturePtr pSrc,
434 PicturePtr pDst,
435 PictFormatPtr maskFormat,
436 INT16 xSrc,
437 INT16 ySrc,
438 int nlist,
439 GlyphListPtr list,
440 GlyphPtr *glyphs);
441
442/* exa_migration.c */
443void
444exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
445
446void
447exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
448
449#endif /* EXAPRIV_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette