105b261ecSmrg/*
205b261ecSmrg *
305b261ecSmrg * Copyright (C) 2000 Keith Packard, member of The XFree86 Project, Inc.
405b261ecSmrg *               2005 Zack Rusin, Trolltech
505b261ecSmrg *
605b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
705b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
805b261ecSmrg * the above copyright notice appear in all copies and that both that
905b261ecSmrg * copyright notice and this permission notice appear in supporting
1005b261ecSmrg * documentation, and that the name of Keith Packard not be used in
1105b261ecSmrg * advertising or publicity pertaining to distribution of the software without
1205b261ecSmrg * specific, written prior permission.  Keith Packard makes no
1305b261ecSmrg * representations about the suitability of this software for any purpose.  It
1405b261ecSmrg * is provided "as is" without express or implied warranty.
1505b261ecSmrg *
1605b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
1705b261ecSmrg * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1805b261ecSmrg * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
1905b261ecSmrg * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2005b261ecSmrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
2105b261ecSmrg * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
2205b261ecSmrg * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2305b261ecSmrg * SOFTWARE.
2405b261ecSmrg */
2505b261ecSmrg
2605b261ecSmrg#ifndef EXAPRIV_H
2705b261ecSmrg#define EXAPRIV_H
2805b261ecSmrg
2905b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
3005b261ecSmrg#include <dix-config.h>
3105b261ecSmrg#endif
3205b261ecSmrg
3305b261ecSmrg#include "exa.h"
3405b261ecSmrg
3505b261ecSmrg#include <X11/X.h>
3605b261ecSmrg#include <X11/Xproto.h>
374642e01fSmrg#ifdef MITSHM
384642e01fSmrg#include "shmint.h"
394642e01fSmrg#endif
4005b261ecSmrg#include "scrnintstr.h"
4105b261ecSmrg#include "pixmapstr.h"
4205b261ecSmrg#include "windowstr.h"
4305b261ecSmrg#include "servermd.h"
4405b261ecSmrg#include "colormapst.h"
4505b261ecSmrg#include "gcstruct.h"
4605b261ecSmrg#include "input.h"
4705b261ecSmrg#include "mipointer.h"
4805b261ecSmrg#include "mi.h"
4905b261ecSmrg#include "dix.h"
5005b261ecSmrg#include "fb.h"
5105b261ecSmrg#include "fboverlay.h"
5205b261ecSmrg#include "fbpict.h"
534642e01fSmrg#include "glyphstr.h"
5405b261ecSmrg#include "damage.h"
5505b261ecSmrg
5605b261ecSmrg#define DEBUG_TRACE_FALL	0
5705b261ecSmrg#define DEBUG_MIGRATE		0
5805b261ecSmrg#define DEBUG_PIXMAP		0
5905b261ecSmrg#define DEBUG_OFFSCREEN		0
604642e01fSmrg#define DEBUG_GLYPH_CACHE	0
6105b261ecSmrg
6205b261ecSmrg#if DEBUG_TRACE_FALL
6305b261ecSmrg#define EXA_FALLBACK(x)     					\
6405b261ecSmrgdo {								\
6505b261ecSmrg	ErrorF("EXA fallback at %s: ", __FUNCTION__);		\
6605b261ecSmrg	ErrorF x;						\
6705b261ecSmrg} while (0)
6805b261ecSmrg
6905b261ecSmrgchar
70f7df2e56Smrg exaDrawableLocation(DrawablePtr pDrawable);
7105b261ecSmrg#else
7205b261ecSmrg#define EXA_FALLBACK(x)
7305b261ecSmrg#endif
7405b261ecSmrg
7505b261ecSmrg#if DEBUG_PIXMAP
7605b261ecSmrg#define DBG_PIXMAP(a) ErrorF a
7705b261ecSmrg#else
7805b261ecSmrg#define DBG_PIXMAP(a)
7905b261ecSmrg#endif
8005b261ecSmrg
8105b261ecSmrg#ifndef EXA_MAX_FB
8205b261ecSmrg#define EXA_MAX_FB   FB_OVERLAY_MAX
8305b261ecSmrg#endif
8405b261ecSmrg
856747b715Smrg#ifdef DEBUG
866747b715Smrg#define EXA_FatalErrorDebug(x) FatalError x
876747b715Smrg#define EXA_FatalErrorDebugWithRet(x, ret) FatalError x
886747b715Smrg#else
896747b715Smrg#define EXA_FatalErrorDebug(x) ErrorF x
906747b715Smrg#define EXA_FatalErrorDebugWithRet(x, ret) \
916747b715Smrgdo { \
926747b715Smrg    ErrorF x; \
936747b715Smrg    return ret; \
946747b715Smrg} while (0)
956747b715Smrg#endif
966747b715Smrg
9705b261ecSmrg/**
9805b261ecSmrg * This is the list of migration heuristics supported by EXA.  See
9905b261ecSmrg * exaDoMigration() for what their implementations do.
10005b261ecSmrg */
10105b261ecSmrgenum ExaMigrationHeuristic {
10205b261ecSmrg    ExaMigrationGreedy,
10305b261ecSmrg    ExaMigrationAlways,
10405b261ecSmrg    ExaMigrationSmart
10505b261ecSmrg};
10605b261ecSmrg
1074642e01fSmrgtypedef struct {
1084642e01fSmrg    unsigned char sha1[20];
1094642e01fSmrg} ExaCachedGlyphRec, *ExaCachedGlyphPtr;
1104642e01fSmrg
1114642e01fSmrgtypedef struct {
1124642e01fSmrg    /* The identity of the cache, statically configured at initialization */
1134642e01fSmrg    unsigned int format;
1144642e01fSmrg    int glyphWidth;
1154642e01fSmrg    int glyphHeight;
1164642e01fSmrg
117f7df2e56Smrg    int size;                   /* Size of cache; eventually this should be dynamically determined */
1184642e01fSmrg
1194642e01fSmrg    /* Hash table mapping from glyph sha1 to position in the glyph; we use
1204642e01fSmrg     * open addressing with a hash table size determined based on size and large
1214642e01fSmrg     * enough so that we always have a good amount of free space, so we can
1225a112b11Smrg     * use linear probing. (Linear probing is preferable to double hashing
1234642e01fSmrg     * here because it allows us to easily remove entries.)
1244642e01fSmrg     */
1254642e01fSmrg    int *hashEntries;
1264642e01fSmrg    int hashSize;
127f7df2e56Smrg
1284642e01fSmrg    ExaCachedGlyphPtr glyphs;
129f7df2e56Smrg    int glyphCount;             /* Current number of glyphs */
130f7df2e56Smrg
131f7df2e56Smrg    PicturePtr picture;         /* Where the glyphs of the cache are stored */
132f7df2e56Smrg    int yOffset;                /* y location within the picture where the cache starts */
1335a112b11Smrg    int columns;                /* Number of columns the glyphs are laid out in */
134f7df2e56Smrg    int evictionPosition;       /* Next random position to evict a glyph */
1354642e01fSmrg} ExaGlyphCacheRec, *ExaGlyphCachePtr;
1364642e01fSmrg
1374642e01fSmrg#define EXA_NUM_GLYPH_CACHES 4
1384642e01fSmrg
1396747b715Smrg#define EXA_FALLBACK_COPYWINDOW (1 << 0)
1406747b715Smrg#define EXA_ACCEL_COPYWINDOW (1 << 1)
1416747b715Smrg
1426747b715Smrgtypedef struct _ExaMigrationRec {
1436747b715Smrg    Bool as_dst;
1446747b715Smrg    Bool as_src;
1456747b715Smrg    PixmapPtr pPix;
1466747b715Smrg    RegionPtr pReg;
1476747b715Smrg} ExaMigrationRec, *ExaMigrationPtr;
1486747b715Smrg
149f7df2e56Smrgtypedef void (*EnableDisableFBAccessProcPtr) (ScreenPtr, Bool);
15005b261ecSmrgtypedef struct {
15105b261ecSmrg    ExaDriverPtr info;
152f7df2e56Smrg    ScreenBlockHandlerProcPtr SavedBlockHandler;
153f7df2e56Smrg    ScreenWakeupHandlerProcPtr SavedWakeupHandler;
154f7df2e56Smrg    CreateGCProcPtr SavedCreateGC;
155f7df2e56Smrg    CloseScreenProcPtr SavedCloseScreen;
156f7df2e56Smrg    GetImageProcPtr SavedGetImage;
157f7df2e56Smrg    GetSpansProcPtr SavedGetSpans;
158f7df2e56Smrg    CreatePixmapProcPtr SavedCreatePixmap;
159f7df2e56Smrg    DestroyPixmapProcPtr SavedDestroyPixmap;
160f7df2e56Smrg    CopyWindowProcPtr SavedCopyWindow;
1614642e01fSmrg    ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
162f7df2e56Smrg    BitmapToRegionProcPtr SavedBitmapToRegion;
1634642e01fSmrg    CreateScreenResourcesProcPtr SavedCreateScreenResources;
164f7df2e56Smrg    ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
165f7df2e56Smrg    SharePixmapBackingProcPtr SavedSharePixmapBacking;
166f7df2e56Smrg    SetSharedPixmapBackingProcPtr SavedSetSharedPixmapBacking;
167f7df2e56Smrg    SourceValidateProcPtr SavedSourceValidate;
168f7df2e56Smrg    CompositeProcPtr SavedComposite;
169f7df2e56Smrg    TrianglesProcPtr SavedTriangles;
170f7df2e56Smrg    GlyphsProcPtr SavedGlyphs;
171f7df2e56Smrg    TrapezoidsProcPtr SavedTrapezoids;
172f7df2e56Smrg    AddTrapsProcPtr SavedAddTraps;
173f7df2e56Smrg    void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps,
174f7df2e56Smrg                          Bool can_accel);
1756747b715Smrg    Bool (*pixmap_has_gpu_copy) (PixmapPtr pPixmap);
1766747b715Smrg    void (*do_move_in_pixmap) (PixmapPtr pPixmap);
1776747b715Smrg    void (*do_move_out_pixmap) (PixmapPtr pPixmap);
178f7df2e56Smrg    void (*prepare_access_reg) (PixmapPtr pPixmap, int index, RegionPtr pReg);
179f7df2e56Smrg
180f7df2e56Smrg    Bool swappedOut;
181f7df2e56Smrg    enum ExaMigrationHeuristic migration;
182f7df2e56Smrg    Bool checkDirtyCorrectness;
183f7df2e56Smrg    unsigned disableFbCount;
184f7df2e56Smrg    Bool optimize_migration;
185f7df2e56Smrg    unsigned offScreenCounter;
186f7df2e56Smrg    unsigned numOffscreenAvailable;
187f7df2e56Smrg    CARD32 lastDefragment;
188f7df2e56Smrg    CARD32 nextDefragment;
189f7df2e56Smrg    PixmapPtr deferred_mixed_pixmap;
1906747b715Smrg
1916747b715Smrg    /* Reference counting for accessed pixmaps */
1926747b715Smrg    struct {
193f7df2e56Smrg        PixmapPtr pixmap;
194f7df2e56Smrg        int count;
195f7df2e56Smrg        Bool retval;
1966747b715Smrg    } access[EXA_NUM_PREPARE_INDICES];
1976747b715Smrg
1986747b715Smrg    /* Holds information on fallbacks that cannot be relayed otherwise. */
1996747b715Smrg    unsigned int fallback_flags;
2006747b715Smrg    unsigned int fallback_counter;
2014642e01fSmrg
202f7df2e56Smrg    ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES];
2036747b715Smrg
2046747b715Smrg    /**
2056747b715Smrg     * Regions affected by fallback composite source / mask operations.
2066747b715Smrg     */
2076747b715Smrg
2086747b715Smrg    RegionRec srcReg;
2096747b715Smrg    RegionRec maskReg;
2106747b715Smrg    PixmapPtr srcPix;
211792ba0eaSabs    PixmapPtr maskPix;
2126747b715Smrg
213f7df2e56Smrg    DevPrivateKeyRec pixmapPrivateKeyRec;
214f7df2e56Smrg    DevPrivateKeyRec gcPrivateKeyRec;
21505b261ecSmrg} ExaScreenPrivRec, *ExaScreenPrivPtr;
21605b261ecSmrg
2176747b715Smrgextern DevPrivateKeyRec exaScreenPrivateKeyRec;
218f7df2e56Smrg
2196747b715Smrg#define exaScreenPrivateKey (&exaScreenPrivateKeyRec)
2206747b715Smrg
221f7df2e56Smrg#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixGetPrivate(&(s)->devPrivates, exaScreenPrivateKey))
22205b261ecSmrg#define ExaScreenPriv(s)	ExaScreenPrivPtr    pExaScr = ExaGetScreenPriv(s)
22305b261ecSmrg
224f7df2e56Smrg#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixGetPrivateAddr(&(gc)->devPrivates, &ExaGetScreenPriv(gc->pScreen)->gcPrivateKeyRec))
2256747b715Smrg#define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc)
2266747b715Smrg
2276747b715Smrg/*
2286747b715Smrg * Some macros to deal with function wrapping.
2296747b715Smrg */
2306747b715Smrg#define wrap(priv, real, mem, func) {\
2316747b715Smrg    priv->Saved##mem = real->mem; \
2326747b715Smrg    real->mem = func; \
2336747b715Smrg}
2346747b715Smrg
2356747b715Smrg#define unwrap(priv, real, mem) {\
2366747b715Smrg    real->mem = priv->Saved##mem; \
2376747b715Smrg}
2386747b715Smrg
239f7df2e56Smrg#ifdef HAVE_TYPEOF
240f7df2e56Smrg#define swap(priv, real, mem) {\
241f7df2e56Smrg    typeof(real->mem) tmp = priv->Saved##mem; \
242f7df2e56Smrg    priv->Saved##mem = real->mem; \
243f7df2e56Smrg    real->mem = tmp; \
244f7df2e56Smrg}
245f7df2e56Smrg#else
2466747b715Smrg#define swap(priv, real, mem) {\
2477e31ba66Smrg    const void *tmp = priv->Saved##mem; \
2486747b715Smrg    priv->Saved##mem = real->mem; \
2496747b715Smrg    real->mem = tmp; \
2506747b715Smrg}
251f7df2e56Smrg#endif
2526747b715Smrg
2536747b715Smrg#define EXA_PRE_FALLBACK(_screen_) \
2546747b715Smrg    ExaScreenPriv(_screen_); \
2556747b715Smrg    pExaScr->fallback_counter++;
2566747b715Smrg
2576747b715Smrg#define EXA_POST_FALLBACK(_screen_) \
2586747b715Smrg    pExaScr->fallback_counter--;
2596747b715Smrg
2606747b715Smrg#define EXA_PRE_FALLBACK_GC(_gc_) \
2616747b715Smrg    ExaScreenPriv(_gc_->pScreen); \
2626747b715Smrg    ExaGCPriv(_gc_); \
2636747b715Smrg    pExaScr->fallback_counter++; \
2646747b715Smrg    swap(pExaGC, _gc_, ops);
2656747b715Smrg
2666747b715Smrg#define EXA_POST_FALLBACK_GC(_gc_) \
2676747b715Smrg    pExaScr->fallback_counter--; \
2686747b715Smrg    swap(pExaGC, _gc_, ops);
2696747b715Smrg
27005b261ecSmrg/** Align an offset to an arbitrary alignment */
27105b261ecSmrg#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
27205b261ecSmrg	(((offset) + (align) - 1) % (align)))
27305b261ecSmrg/** Align an offset to a power-of-two alignment */
27405b261ecSmrg#define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
27505b261ecSmrg
27605b261ecSmrg#define EXA_PIXMAP_SCORE_MOVE_IN    10
27705b261ecSmrg#define EXA_PIXMAP_SCORE_MAX	    20
27805b261ecSmrg#define EXA_PIXMAP_SCORE_MOVE_OUT   -10
27905b261ecSmrg#define EXA_PIXMAP_SCORE_MIN	    -20
28005b261ecSmrg#define EXA_PIXMAP_SCORE_PINNED	    1000
28105b261ecSmrg#define EXA_PIXMAP_SCORE_INIT	    1001
28205b261ecSmrg
283f7df2e56Smrg#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &ExaGetScreenPriv((p)->drawable.pScreen)->pixmapPrivateKeyRec))
28405b261ecSmrg#define ExaPixmapPriv(p)	ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
28505b261ecSmrg
2864642e01fSmrg#define EXA_RANGE_PITCH (1 << 0)
2874642e01fSmrg#define EXA_RANGE_WIDTH (1 << 1)
2884642e01fSmrg#define EXA_RANGE_HEIGHT (1 << 2)
2894642e01fSmrg
29005b261ecSmrgtypedef struct {
29105b261ecSmrg    ExaOffscreenArea *area;
292f7df2e56Smrg    int score;                  /**< score for the move-in vs move-out heuristic */
293f7df2e56Smrg    Bool use_gpu_copy;
29405b261ecSmrg
295f7df2e56Smrg    CARD8 *sys_ptr;             /**< pointer to pixmap data in system memory */
296f7df2e56Smrg    int sys_pitch;              /**< pitch of pixmap in system memory */
29705b261ecSmrg
298f7df2e56Smrg    CARD8 *fb_ptr;              /**< pointer to pixmap data in framebuffer memory */
299f7df2e56Smrg    int fb_pitch;               /**< pitch of pixmap in framebuffer memory */
300f7df2e56Smrg    unsigned int fb_size;       /**< size of pixmap in framebuffer memory */
30105b261ecSmrg
3024642e01fSmrg    /**
3034642e01fSmrg     * Holds information about whether this pixmap can be used for
3044642e01fSmrg     * acceleration (== 0) or not (> 0).
3054642e01fSmrg     *
3064642e01fSmrg     * Contains a OR'ed combination of the following values:
3074642e01fSmrg     * EXA_RANGE_PITCH - set if the pixmap's pitch is out of range
3084642e01fSmrg     * EXA_RANGE_WIDTH - set if the pixmap's width is out of range
3094642e01fSmrg     * EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
3104642e01fSmrg     */
311f7df2e56Smrg    unsigned int accel_blocked;
3124642e01fSmrg
31305b261ecSmrg    /**
31405b261ecSmrg     * The damage record contains the areas of the pixmap's current location
31505b261ecSmrg     * (framebuffer or system) that have been damaged compared to the other
31605b261ecSmrg     * location.
31705b261ecSmrg     */
318f7df2e56Smrg    DamagePtr pDamage;
31905b261ecSmrg    /**
3204642e01fSmrg     * The valid regions mark the valid bits (at least, as they're derived from
3214642e01fSmrg     * damage, which may be overreported) of a pixmap's system and FB copies.
3224642e01fSmrg     */
323f7df2e56Smrg    RegionRec validSys, validFB;
3244642e01fSmrg    /**
3254642e01fSmrg     * Driver private storage per EXA pixmap
32605b261ecSmrg     */
3274642e01fSmrg    void *driverPriv;
32805b261ecSmrg} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
32905b261ecSmrg
3304642e01fSmrgtypedef struct {
3316747b715Smrg    /* GC values from the layer below. */
332f7df2e56Smrg    const GCOps *Savedops;
333f7df2e56Smrg    const GCFuncs *Savedfuncs;
3346747b715Smrg} ExaGCPrivRec, *ExaGCPrivPtr;
3356747b715Smrg
3366747b715Smrgtypedef struct {
3376747b715Smrg    PicturePtr pDst;
3384642e01fSmrg    INT16 xSrc;
3394642e01fSmrg    INT16 ySrc;
3406747b715Smrg    INT16 xMask;
3416747b715Smrg    INT16 yMask;
3424642e01fSmrg    INT16 xDst;
3434642e01fSmrg    INT16 yDst;
3444642e01fSmrg    INT16 width;
3454642e01fSmrg    INT16 height;
3464642e01fSmrg} ExaCompositeRectRec, *ExaCompositeRectPtr;
3474642e01fSmrg
34805b261ecSmrg/**
34905b261ecSmrg * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
35005b261ecSmrg * to set EXA options or hook in screen functions to handle using EXA as the AA.
35105b261ecSmrg  */
352f7df2e56Smrgvoid exaDDXDriverInit(ScreenPtr pScreen);
35305b261ecSmrg
35405b261ecSmrg/* exa_unaccel.c */
35505b261ecSmrgvoid
356f7df2e56Smrg exaPrepareAccessGC(GCPtr pGC);
35705b261ecSmrg
35805b261ecSmrgvoid
359f7df2e56Smrg exaFinishAccessGC(GCPtr pGC);
36005b261ecSmrg
36105b261ecSmrgvoid
362f7df2e56Smrg
363f7df2e56SmrgExaCheckFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nspans,
364f7df2e56Smrg                  DDXPointPtr ppt, int *pwidth, int fSorted);
36505b261ecSmrg
36605b261ecSmrgvoid
367f7df2e56Smrg
368f7df2e56SmrgExaCheckSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
369f7df2e56Smrg                 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
37005b261ecSmrg
37105b261ecSmrgvoid
372f7df2e56Smrg
373f7df2e56SmrgExaCheckPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
374f7df2e56Smrg                 int x, int y, int w, int h, int leftPad, int format,
375f7df2e56Smrg                 char *bits);
37605b261ecSmrg
3776747b715Smrgvoid
378f7df2e56Smrg
379f7df2e56SmrgExaCheckCopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
380f7df2e56Smrg                 BoxPtr pbox, int nbox, int dx, int dy, Bool reverse,
381f7df2e56Smrg                 Bool upsidedown, Pixel bitplane, void *closure);
3826747b715Smrg
38305b261ecSmrgRegionPtr
384f7df2e56Smrg
385f7df2e56SmrgExaCheckCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
386f7df2e56Smrg                 int srcx, int srcy, int w, int h, int dstx, int dsty);
38705b261ecSmrg
38805b261ecSmrgRegionPtr
389f7df2e56Smrg
390f7df2e56SmrgExaCheckCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
391f7df2e56Smrg                  int srcx, int srcy, int w, int h, int dstx, int dsty,
392f7df2e56Smrg                  unsigned long bitPlane);
39305b261ecSmrg
39405b261ecSmrgvoid
395f7df2e56Smrg
396f7df2e56SmrgExaCheckPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
397f7df2e56Smrg                  DDXPointPtr pptInit);
39805b261ecSmrg
39905b261ecSmrgvoid
400f7df2e56Smrg
401f7df2e56SmrgExaCheckPolylines(DrawablePtr pDrawable, GCPtr pGC,
402f7df2e56Smrg                  int mode, int npt, DDXPointPtr ppt);
40305b261ecSmrg
40405b261ecSmrgvoid
405f7df2e56Smrg
406f7df2e56SmrgExaCheckPolySegment(DrawablePtr pDrawable, GCPtr pGC,
407f7df2e56Smrg                    int nsegInit, xSegment * pSegInit);
40805b261ecSmrg
40905b261ecSmrgvoid
410f7df2e56Smrg ExaCheckPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * pArcs);
41105b261ecSmrg
41205b261ecSmrgvoid
413f7df2e56Smrg
414f7df2e56SmrgExaCheckPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
415f7df2e56Smrg                     int nrect, xRectangle *prect);
41605b261ecSmrg
41705b261ecSmrgvoid
418f7df2e56Smrg
419f7df2e56SmrgExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
420f7df2e56Smrg                      int x, int y, unsigned int nglyph,
421f7df2e56Smrg                      CharInfoPtr * ppci, void *pglyphBase);
42205b261ecSmrg
42305b261ecSmrgvoid
424f7df2e56Smrg
425f7df2e56SmrgExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
426f7df2e56Smrg                     int x, int y, unsigned int nglyph,
427f7df2e56Smrg                     CharInfoPtr * ppci, void *pglyphBase);
42805b261ecSmrg
42905b261ecSmrgvoid
430f7df2e56Smrg
431f7df2e56SmrgExaCheckPushPixels(GCPtr pGC, PixmapPtr pBitmap,
432f7df2e56Smrg                   DrawablePtr pDrawable, int w, int h, int x, int y);
43305b261ecSmrg
4346747b715Smrgvoid
435f7df2e56Smrg ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
4366747b715Smrg
4376747b715Smrgvoid
438f7df2e56Smrg
4396747b715SmrgExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
440f7df2e56Smrg                 unsigned int format, unsigned long planeMask, char *d);
4416747b715Smrg
44205b261ecSmrgvoid
443f7df2e56Smrg
444f7df2e56SmrgExaCheckGetSpans(DrawablePtr pDrawable,
445f7df2e56Smrg                 int wMax,
446f7df2e56Smrg                 DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart);
44705b261ecSmrg
44805b261ecSmrgvoid
449f7df2e56Smrg
450f7df2e56SmrgExaCheckAddTraps(PicturePtr pPicture,
451f7df2e56Smrg                 INT16 x_off, INT16 y_off, int ntrap, xTrap * traps);
45205b261ecSmrg
4534642e01fSmrg/* exa_accel.c */
45405b261ecSmrg
4554642e01fSmrgstatic _X_INLINE Bool
4564642e01fSmrgexaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
457f7df2e56Smrg                      unsigned int fillStyle, unsigned char alu,
458f7df2e56Smrg                      Bool clientClip)
4594642e01fSmrg{
46052397711Smrg    return ((alu != GXcopy && alu != GXclear && alu != GXset &&
461f7df2e56Smrg             alu != GXcopyInverted) || fillStyle == FillStippled ||
462f7df2e56Smrg            clientClip != FALSE || !EXA_PM_IS_SOLID(pDrawable, planemask));
4634642e01fSmrg}
46405b261ecSmrg
46505b261ecSmrgvoid
466f7df2e56Smrg exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
46705b261ecSmrg
46805b261ecSmrgBool
469f7df2e56Smrg
470f7df2e56SmrgexaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
471f7df2e56Smrg                   DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
472f7df2e56Smrg                   Bool clientClip);
47305b261ecSmrg
47405b261ecSmrgvoid
475f7df2e56Smrg
476f7df2e56SmrgexaGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
477f7df2e56Smrg            unsigned int format, unsigned long planeMask, char *d);
47805b261ecSmrg
4796747b715SmrgRegionPtr
480f7df2e56Smrg
4816747b715SmrgexaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
482f7df2e56Smrg            int srcx, int srcy, int width, int height, int dstx, int dsty);
4836747b715Smrg
4846747b715SmrgBool
485f7df2e56Smrg
486f7df2e56SmrgexaHWCopyNtoN(DrawablePtr pSrcDrawable,
487f7df2e56Smrg              DrawablePtr pDstDrawable,
488f7df2e56Smrg              GCPtr pGC,
489f7df2e56Smrg              BoxPtr pbox,
490f7df2e56Smrg              int nbox, int dx, int dy, Bool reverse, Bool upsidedown);
491f7df2e56Smrg
492f7df2e56Smrgvoid
493f7df2e56Smrg
494f7df2e56SmrgexaCopyNtoN(DrawablePtr pSrcDrawable,
495f7df2e56Smrg            DrawablePtr pDstDrawable,
496f7df2e56Smrg            GCPtr pGC,
497f7df2e56Smrg            BoxPtr pbox,
498f7df2e56Smrg            int nbox,
499f7df2e56Smrg            int dx,
500f7df2e56Smrg            int dy,
501f7df2e56Smrg            Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
5026747b715Smrg
50305b261ecSmrgextern const GCOps exaOps;
50405b261ecSmrg
50505b261ecSmrgvoid
506f7df2e56Smrg
507f7df2e56SmrgExaCheckComposite(CARD8 op,
508f7df2e56Smrg                  PicturePtr pSrc,
509f7df2e56Smrg                  PicturePtr pMask,
510f7df2e56Smrg                  PicturePtr pDst,
511f7df2e56Smrg                  INT16 xSrc,
512f7df2e56Smrg                  INT16 ySrc,
513f7df2e56Smrg                  INT16 xMask,
514f7df2e56Smrg                  INT16 yMask,
515f7df2e56Smrg                  INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
516f7df2e56Smrg
517f7df2e56Smrgvoid
518f7df2e56Smrg
519f7df2e56SmrgExaCheckGlyphs(CARD8 op,
520f7df2e56Smrg               PicturePtr pSrc,
521f7df2e56Smrg               PicturePtr pDst,
522f7df2e56Smrg               PictFormatPtr maskFormat,
523f7df2e56Smrg               INT16 xSrc,
524f7df2e56Smrg               INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
52505b261ecSmrg
52605b261ecSmrg/* exa_offscreen.c */
52705b261ecSmrgvoid
528f7df2e56Smrg ExaOffscreenSwapOut(ScreenPtr pScreen);
52905b261ecSmrg
53005b261ecSmrgvoid
531f7df2e56Smrg ExaOffscreenSwapIn(ScreenPtr pScreen);
53205b261ecSmrg
533f7df2e56SmrgExaOffscreenArea *ExaOffscreenDefragment(ScreenPtr pScreen);
5346747b715Smrg
53505b261ecSmrgBool
536f7df2e56Smrg exaOffscreenInit(ScreenPtr pScreen);
53705b261ecSmrg
53805b261ecSmrgvoid
539f7df2e56Smrg ExaOffscreenFini(ScreenPtr pScreen);
54005b261ecSmrg
54105b261ecSmrg/* exa.c */
5426747b715SmrgBool
543f7df2e56Smrg ExaDoPrepareAccess(PixmapPtr pPixmap, int index);
5444642e01fSmrg
54505b261ecSmrgvoid
546f7df2e56Smrg exaPrepareAccess(DrawablePtr pDrawable, int index);
54705b261ecSmrg
54805b261ecSmrgvoid
549f7df2e56Smrg exaFinishAccess(DrawablePtr pDrawable, int index);
55005b261ecSmrg
5516747b715Smrgvoid
552f7df2e56Smrg exaDestroyPixmap(PixmapPtr pPixmap);
5536747b715Smrg
55405b261ecSmrgvoid
555f7df2e56Smrg exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
55605b261ecSmrg
55705b261ecSmrgvoid
558f7df2e56Smrg
559f7df2e56SmrgexaGetDrawableDeltas(DrawablePtr pDrawable, PixmapPtr pPixmap,
560f7df2e56Smrg                     int *xp, int *yp);
56105b261ecSmrg
56205b261ecSmrgBool
563f7df2e56Smrg exaPixmapHasGpuCopy(PixmapPtr p);
56405b261ecSmrg
56505b261ecSmrgPixmapPtr
566f7df2e56Smrg exaGetOffscreenPixmap(DrawablePtr pDrawable, int *xp, int *yp);
56705b261ecSmrg
56805b261ecSmrgPixmapPtr
569f7df2e56Smrg exaGetDrawablePixmap(DrawablePtr pDrawable);
57005b261ecSmrg
5716747b715Smrgvoid
572f7df2e56Smrg
5736747b715SmrgexaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
5746747b715Smrg              int w, int h, int bpp);
57505b261ecSmrg
57605b261ecSmrgvoid
577f7df2e56Smrg
5786747b715SmrgexaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
5796747b715Smrg                 int w, int h, int bpp);
5806747b715Smrg
5816747b715Smrgvoid
582f7df2e56Smrg exaDoMigration(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
5836747b715Smrg
5846747b715SmrgBool
585f7df2e56Smrg exaPixmapIsPinned(PixmapPtr pPix);
5866747b715Smrg
5876747b715Smrgextern const GCFuncs exaGCFuncs;
5886747b715Smrg
5896747b715Smrg/* exa_classic.c */
5906747b715SmrgPixmapPtr
591f7df2e56Smrg
5926747b715SmrgexaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
593f7df2e56Smrg                        unsigned usage_hint);
5946747b715Smrg
5956747b715SmrgBool
596f7df2e56Smrg
597f7df2e56SmrgexaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
598f7df2e56Smrg                              int depth, int bitsPerPixel, int devKind,
599f7df2e56Smrg                              void *pPixData);
6006747b715Smrg
6016747b715SmrgBool
602f7df2e56Smrg exaDestroyPixmap_classic(PixmapPtr pPixmap);
6036747b715Smrg
6046747b715SmrgBool
605f7df2e56Smrg exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
6066747b715Smrg
6076747b715Smrg/* exa_driver.c */
6086747b715SmrgPixmapPtr
609f7df2e56Smrg
6106747b715SmrgexaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
611f7df2e56Smrg                       unsigned usage_hint);
6126747b715Smrg
6136747b715SmrgBool
614f7df2e56Smrg
615f7df2e56SmrgexaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
616f7df2e56Smrg                             int depth, int bitsPerPixel, int devKind,
617f7df2e56Smrg                             void *pPixData);
6186747b715Smrg
6196747b715SmrgBool
620f7df2e56Smrg exaDestroyPixmap_driver(PixmapPtr pPixmap);
6216747b715Smrg
6226747b715SmrgBool
623f7df2e56Smrg exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
6246747b715Smrg
6256747b715Smrg/* exa_mixed.c */
6266747b715SmrgPixmapPtr
627f7df2e56Smrg
6286747b715SmrgexaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
629f7df2e56Smrg                      unsigned usage_hint);
6306747b715Smrg
6316747b715SmrgBool
632f7df2e56Smrg
6336747b715SmrgexaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
634f7df2e56Smrg                            int bitsPerPixel, int devKind, void *pPixData);
6356747b715Smrg
6366747b715SmrgBool
637f7df2e56Smrg exaDestroyPixmap_mixed(PixmapPtr pPixmap);
6386747b715Smrg
6396747b715SmrgBool
640f7df2e56Smrg exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
6416747b715Smrg
6426747b715Smrg/* exa_migration_mixed.c */
6436747b715Smrgvoid
644f7df2e56Smrg exaCreateDriverPixmap_mixed(PixmapPtr pPixmap);
6456747b715Smrg
6466747b715Smrgvoid
647f7df2e56Smrg exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
6486747b715Smrg
6496747b715Smrgvoid
650f7df2e56Smrg exaMoveInPixmap_mixed(PixmapPtr pPixmap);
6516747b715Smrg
6526747b715Smrgvoid
653f7df2e56Smrg exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure);
6546747b715Smrg
6556747b715Smrgvoid
656f7df2e56Smrg exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
657f7df2e56Smrg
658f7df2e56SmrgBool
659f7df2e56SmrgexaSetSharedPixmapBacking_mixed(PixmapPtr pPixmap, void *handle);
660f7df2e56SmrgBool
6615a112b11SmrgexaSharePixmapBacking_mixed(PixmapPtr pPixmap, ScreenPtr secondary, void **handle_p);
66205b261ecSmrg
66305b261ecSmrg/* exa_render.c */
6644642e01fSmrgBool
665f7df2e56Smrg exaOpReadsDestination(CARD8 op);
6664642e01fSmrg
66705b261ecSmrgvoid
668f7df2e56Smrg
669f7df2e56SmrgexaComposite(CARD8 op,
670f7df2e56Smrg             PicturePtr pSrc,
671f7df2e56Smrg             PicturePtr pMask,
672f7df2e56Smrg             PicturePtr pDst,
673f7df2e56Smrg             INT16 xSrc,
674f7df2e56Smrg             INT16 ySrc,
675f7df2e56Smrg             INT16 xMask,
676f7df2e56Smrg             INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
67705b261ecSmrg
6784642e01fSmrgvoid
679f7df2e56Smrg
680f7df2e56SmrgexaCompositeRects(CARD8 op,
681f7df2e56Smrg                  PicturePtr Src,
682f7df2e56Smrg                  PicturePtr pMask,
683f7df2e56Smrg                  PicturePtr pDst, int nrect, ExaCompositeRectPtr rects);
6844642e01fSmrg
68505b261ecSmrgvoid
686f7df2e56Smrg
687f7df2e56SmrgexaTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
688f7df2e56Smrg              PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
689f7df2e56Smrg              int ntrap, xTrapezoid * traps);
69005b261ecSmrg
69105b261ecSmrgvoid
692f7df2e56Smrg
693f7df2e56SmrgexaTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
694f7df2e56Smrg             PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
695f7df2e56Smrg             int ntri, xTriangle * tris);
6964642e01fSmrg
6974642e01fSmrg/* exa_glyph.c */
6984642e01fSmrgvoid
699f7df2e56Smrg exaGlyphsInit(ScreenPtr pScreen);
70005b261ecSmrg
70105b261ecSmrgvoid
702f7df2e56Smrg exaGlyphsFini(ScreenPtr pScreen);
70305b261ecSmrg
70405b261ecSmrgvoid
705f7df2e56Smrg
706f7df2e56SmrgexaGlyphs(CARD8 op,
707f7df2e56Smrg          PicturePtr pSrc,
708f7df2e56Smrg          PicturePtr pDst,
709f7df2e56Smrg          PictFormatPtr maskFormat,
710f7df2e56Smrg          INT16 xSrc,
711f7df2e56Smrg          INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
71205b261ecSmrg
7136747b715Smrg/* exa_migration_classic.c */
71405b261ecSmrgvoid
715f7df2e56Smrg exaCopyDirtyToSys(ExaMigrationPtr migrate);
7166747b715Smrg
7176747b715Smrgvoid
718f7df2e56Smrg exaCopyDirtyToFb(ExaMigrationPtr migrate);
7196747b715Smrg
7206747b715Smrgvoid
721f7df2e56Smrg exaDoMigration_classic(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
72205b261ecSmrg
72305b261ecSmrgvoid
724f7df2e56Smrg exaPixmapSave(ScreenPtr pScreen, ExaOffscreenArea * area);
72505b261ecSmrg
7266747b715Smrgvoid
727f7df2e56Smrg exaMoveOutPixmap_classic(PixmapPtr pPixmap);
7286747b715Smrg
7296747b715Smrgvoid
730f7df2e56Smrg exaMoveInPixmap_classic(PixmapPtr pPixmap);
7316747b715Smrg
7326747b715Smrgvoid
733f7df2e56Smrg exaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg);
7346747b715Smrg
735f7df2e56Smrg#endif                          /* EXAPRIV_H */
736