VirtualBox

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

Last change on this file was 49174, checked in by vboxsync, 11 years ago

Additions/x11: replace header files for X.Org Server 1.6.0 with those for version 1.6.5 due to an ABI bump in-between.

  • Property svn:eol-style set to native
File size: 13.7 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#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#define DEBUG_GLYPH_CACHE 0
65
66#if DEBUG_TRACE_FALL
67#define EXA_FALLBACK(x) \
68do { \
69 ErrorF("EXA fallback at %s: ", __FUNCTION__); \
70 ErrorF x; \
71} while (0)
72
73char
74exaDrawableLocation(DrawablePtr pDrawable);
75#else
76#define EXA_FALLBACK(x)
77#endif
78
79#if DEBUG_PIXMAP
80#define DBG_PIXMAP(a) ErrorF a
81#else
82#define DBG_PIXMAP(a)
83#endif
84
85#ifndef EXA_MAX_FB
86#define EXA_MAX_FB FB_OVERLAY_MAX
87#endif
88
89/**
90 * This is the list of migration heuristics supported by EXA. See
91 * exaDoMigration() for what their implementations do.
92 */
93enum ExaMigrationHeuristic {
94 ExaMigrationGreedy,
95 ExaMigrationAlways,
96 ExaMigrationSmart
97};
98
99typedef struct {
100 unsigned char sha1[20];
101} ExaCachedGlyphRec, *ExaCachedGlyphPtr;
102
103typedef struct {
104 /* The identity of the cache, statically configured at initialization */
105 unsigned int format;
106 int glyphWidth;
107 int glyphHeight;
108
109 int size; /* Size of cache; eventually this should be dynamically determined */
110
111 /* Hash table mapping from glyph sha1 to position in the glyph; we use
112 * open addressing with a hash table size determined based on size and large
113 * enough so that we always have a good amount of free space, so we can
114 * use linear probing. (Linear probing is preferrable to double hashing
115 * here because it allows us to easily remove entries.)
116 */
117 int *hashEntries;
118 int hashSize;
119
120 ExaCachedGlyphPtr glyphs;
121 int glyphCount; /* Current number of glyphs */
122
123 PicturePtr picture; /* Where the glyphs of the cache are stored */
124 int yOffset; /* y location within the picture where the cache starts */
125 int columns; /* Number of columns the glyphs are layed out in */
126 int evictionPosition; /* Next random position to evict a glyph */
127} ExaGlyphCacheRec, *ExaGlyphCachePtr;
128
129#define EXA_NUM_GLYPH_CACHES 4
130
131typedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
132typedef struct {
133 ExaDriverPtr info;
134 CreateGCProcPtr SavedCreateGC;
135 CloseScreenProcPtr SavedCloseScreen;
136 GetImageProcPtr SavedGetImage;
137 GetSpansProcPtr SavedGetSpans;
138 CreatePixmapProcPtr SavedCreatePixmap;
139 DestroyPixmapProcPtr SavedDestroyPixmap;
140 CopyWindowProcPtr SavedCopyWindow;
141 ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
142 BitmapToRegionProcPtr SavedBitmapToRegion;
143 CreateScreenResourcesProcPtr SavedCreateScreenResources;
144 ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
145#ifdef RENDER
146 CompositeProcPtr SavedComposite;
147 TrianglesProcPtr SavedTriangles;
148 GlyphsProcPtr SavedGlyphs;
149 TrapezoidsProcPtr SavedTrapezoids;
150 AddTrapsProcPtr SavedAddTraps;
151#endif
152
153 Bool swappedOut;
154 enum ExaMigrationHeuristic migration;
155 Bool checkDirtyCorrectness;
156 unsigned disableFbCount;
157 Bool optimize_migration;
158 unsigned offScreenCounter;
159
160 ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES];
161} ExaScreenPrivRec, *ExaScreenPrivPtr;
162
163/*
164 * This is the only completely portable way to
165 * compute this info.
166 */
167#ifndef BitsPerPixel
168#define BitsPerPixel(d) (\
169 PixmapWidthPaddingInfo[d].notPower2 ? \
170 (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
171 ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
172 (PixmapWidthPaddingInfo[d].padRoundUp+1)))
173#endif
174
175extern DevPrivateKey exaScreenPrivateKey;
176extern DevPrivateKey exaPixmapPrivateKey;
177#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
178#define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
179
180/** Align an offset to an arbitrary alignment */
181#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
182 (((offset) + (align) - 1) % (align)))
183/** Align an offset to a power-of-two alignment */
184#define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
185
186#define EXA_PIXMAP_SCORE_MOVE_IN 10
187#define EXA_PIXMAP_SCORE_MAX 20
188#define EXA_PIXMAP_SCORE_MOVE_OUT -10
189#define EXA_PIXMAP_SCORE_MIN -20
190#define EXA_PIXMAP_SCORE_PINNED 1000
191#define EXA_PIXMAP_SCORE_INIT 1001
192
193#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey))
194#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a)
195#define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
196
197#define EXA_RANGE_PITCH (1 << 0)
198#define EXA_RANGE_WIDTH (1 << 1)
199#define EXA_RANGE_HEIGHT (1 << 2)
200
201typedef struct {
202 ExaOffscreenArea *area;
203 int score; /**< score for the move-in vs move-out heuristic */
204 Bool offscreen;
205
206 CARD8 *sys_ptr; /**< pointer to pixmap data in system memory */
207 int sys_pitch; /**< pitch of pixmap in system memory */
208
209 CARD8 *fb_ptr; /**< pointer to pixmap data in framebuffer memory */
210 int fb_pitch; /**< pitch of pixmap in framebuffer memory */
211 unsigned int fb_size; /**< size of pixmap in framebuffer memory */
212
213 /**
214 * Holds information about whether this pixmap can be used for
215 * acceleration (== 0) or not (> 0).
216 *
217 * Contains a OR'ed combination of the following values:
218 * EXA_RANGE_PITCH - set if the pixmap's pitch is out of range
219 * EXA_RANGE_WIDTH - set if the pixmap's width is out of range
220 * EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
221 */
222 unsigned int accel_blocked;
223
224 /**
225 * The damage record contains the areas of the pixmap's current location
226 * (framebuffer or system) that have been damaged compared to the other
227 * location.
228 */
229 DamagePtr pDamage;
230 /**
231 * The valid regions mark the valid bits (at least, as they're derived from
232 * damage, which may be overreported) of a pixmap's system and FB copies.
233 */
234 RegionRec validSys, validFB;
235 /**
236 * Driver private storage per EXA pixmap
237 */
238 void *driverPriv;
239} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
240
241typedef struct _ExaMigrationRec {
242 Bool as_dst;
243 Bool as_src;
244 PixmapPtr pPix;
245 RegionPtr pReg;
246} ExaMigrationRec, *ExaMigrationPtr;
247
248typedef struct {
249 INT16 xSrc;
250 INT16 ySrc;
251 INT16 xDst;
252 INT16 yDst;
253 INT16 width;
254 INT16 height;
255} ExaCompositeRectRec, *ExaCompositeRectPtr;
256
257/**
258 * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
259 * to set EXA options or hook in screen functions to handle using EXA as the AA.
260 */
261void exaDDXDriverInit (ScreenPtr pScreen);
262
263/* exa_unaccel.c */
264void
265exaPrepareAccessGC(GCPtr pGC);
266
267void
268exaFinishAccessGC(GCPtr pGC);
269
270void
271ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
272 DDXPointPtr ppt, int *pwidth, int fSorted);
273
274void
275ExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
276 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
277
278void
279ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
280 int x, int y, int w, int h, int leftPad, int format,
281 char *bits);
282
283RegionPtr
284ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
285 int srcx, int srcy, int w, int h, int dstx, int dsty);
286
287RegionPtr
288ExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
289 int srcx, int srcy, int w, int h, int dstx, int dsty,
290 unsigned long bitPlane);
291
292void
293ExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
294 DDXPointPtr pptInit);
295
296void
297ExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
298 int mode, int npt, DDXPointPtr ppt);
299
300void
301ExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
302 int nsegInit, xSegment *pSegInit);
303
304void
305ExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
306 int narcs, xArc *pArcs);
307
308void
309ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
310 int nrect, xRectangle *prect);
311
312void
313ExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
314 int x, int y, unsigned int nglyph,
315 CharInfoPtr *ppci, pointer pglyphBase);
316
317void
318ExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
319 int x, int y, unsigned int nglyph,
320 CharInfoPtr *ppci, pointer pglyphBase);
321
322void
323ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
324 DrawablePtr pDrawable,
325 int w, int h, int x, int y);
326
327void
328ExaCheckGetSpans (DrawablePtr pDrawable,
329 int wMax,
330 DDXPointPtr ppt,
331 int *pwidth,
332 int nspans,
333 char *pdstStart);
334
335void
336ExaCheckAddTraps (PicturePtr pPicture,
337 INT16 x_off,
338 INT16 y_off,
339 int ntrap,
340 xTrap *traps);
341
342/* exa_accel.c */
343
344static _X_INLINE Bool
345exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
346 unsigned int fillStyle, unsigned char alu,
347 unsigned int clientClipType)
348{
349 return ((alu != GXcopy && alu != GXclear && alu != GXset &&
350 alu != GXcopyInverted) || fillStyle == FillStippled ||
351 clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable, planemask));
352}
353
354void
355exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
356
357Bool
358exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
359 DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
360 unsigned int clientClipType);
361
362void
363exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
364 unsigned int format, unsigned long planeMask, char *d);
365
366extern const GCOps exaOps;
367
368#ifdef RENDER
369void
370ExaCheckComposite (CARD8 op,
371 PicturePtr pSrc,
372 PicturePtr pMask,
373 PicturePtr pDst,
374 INT16 xSrc,
375 INT16 ySrc,
376 INT16 xMask,
377 INT16 yMask,
378 INT16 xDst,
379 INT16 yDst,
380 CARD16 width,
381 CARD16 height);
382#endif
383
384/* exa_offscreen.c */
385void
386ExaOffscreenSwapOut (ScreenPtr pScreen);
387
388void
389ExaOffscreenSwapIn (ScreenPtr pScreen);
390
391Bool
392exaOffscreenInit(ScreenPtr pScreen);
393
394void
395ExaOffscreenFini (ScreenPtr pScreen);
396
397/* exa.c */
398void
399ExaDoPrepareAccess(DrawablePtr pDrawable, int index);
400
401void
402exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg);
403
404void
405exaPrepareAccess(DrawablePtr pDrawable, int index);
406
407void
408exaFinishAccess(DrawablePtr pDrawable, int index);
409
410void
411exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
412
413void
414exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
415 int *xp, int *yp);
416
417Bool
418exaPixmapIsOffscreen(PixmapPtr p);
419
420PixmapPtr
421exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
422
423PixmapPtr
424exaGetDrawablePixmap(DrawablePtr pDrawable);
425
426RegionPtr
427exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
428 int srcx, int srcy, int width, int height, int dstx, int dsty);
429
430void
431exaCopyNtoN (DrawablePtr pSrcDrawable,
432 DrawablePtr pDstDrawable,
433 GCPtr pGC,
434 BoxPtr pbox,
435 int nbox,
436 int dx,
437 int dy,
438 Bool reverse,
439 Bool upsidedown,
440 Pixel bitplane,
441 void *closure);
442
443/* exa_render.c */
444Bool
445exaOpReadsDestination (CARD8 op);
446
447void
448exaComposite(CARD8 op,
449 PicturePtr pSrc,
450 PicturePtr pMask,
451 PicturePtr pDst,
452 INT16 xSrc,
453 INT16 ySrc,
454 INT16 xMask,
455 INT16 yMask,
456 INT16 xDst,
457 INT16 yDst,
458 CARD16 width,
459 CARD16 height);
460
461void
462exaCompositeRects(CARD8 op,
463 PicturePtr Src,
464 PicturePtr pDst,
465 int nrect,
466 ExaCompositeRectPtr rects);
467
468void
469exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
470 PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
471 int ntrap, xTrapezoid *traps);
472
473void
474exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
475 PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
476 int ntri, xTriangle *tris);
477
478/* exa_glyph.c */
479void
480exaGlyphsInit(ScreenPtr pScreen);
481
482void
483exaGlyphsFini (ScreenPtr pScreen);
484
485void
486exaGlyphs (CARD8 op,
487 PicturePtr pSrc,
488 PicturePtr pDst,
489 PictFormatPtr maskFormat,
490 INT16 xSrc,
491 INT16 ySrc,
492 int nlist,
493 GlyphListPtr list,
494 GlyphPtr *glyphs);
495
496/* exa_migration.c */
497void
498exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
499
500void
501exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
502
503#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