105b261ecSmrg/*
205b261ecSmrg *
305b261ecSmrg * Copyright (C) 2000 Keith Packard
405b261ecSmrg *               2004 Eric Anholt
505b261ecSmrg *               2005 Zack Rusin
605b261ecSmrg *
705b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
805b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
905b261ecSmrg * the above copyright notice appear in all copies and that both that
1005b261ecSmrg * copyright notice and this permission notice appear in supporting
1105b261ecSmrg * documentation, and that the name of copyright holders not be used in
1205b261ecSmrg * advertising or publicity pertaining to distribution of the software without
1305b261ecSmrg * specific, written prior permission. Copyright holders make no
1405b261ecSmrg * representations about the suitability of this software for any purpose.  It
1505b261ecSmrg * is provided "as is" without express or implied warranty.
1605b261ecSmrg *
1705b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
1805b261ecSmrg * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1905b261ecSmrg * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
2005b261ecSmrg * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2105b261ecSmrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
2205b261ecSmrg * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
2305b261ecSmrg * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2405b261ecSmrg * SOFTWARE.
2505b261ecSmrg */
2605b261ecSmrg
2705b261ecSmrg/** @file
2805b261ecSmrg * This is the header containing the public API of EXA for exa drivers.
2905b261ecSmrg */
3005b261ecSmrg
3105b261ecSmrg#ifndef EXA_H
3205b261ecSmrg#define EXA_H
3305b261ecSmrg
3405b261ecSmrg#include "scrnintstr.h"
3505b261ecSmrg#include "pixmapstr.h"
3605b261ecSmrg#include "windowstr.h"
3705b261ecSmrg#include "gcstruct.h"
3805b261ecSmrg#include "picturestr.h"
3905b261ecSmrg#include "fb.h"
4005b261ecSmrg
4105b261ecSmrg#define EXA_VERSION_MAJOR   2
4235c4bbdfSmrg#define EXA_VERSION_MINOR   6
4305b261ecSmrg#define EXA_VERSION_RELEASE 0
4405b261ecSmrg
4505b261ecSmrgtypedef struct _ExaOffscreenArea ExaOffscreenArea;
4605b261ecSmrg
4735c4bbdfSmrgtypedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen,
4835c4bbdfSmrg                                      ExaOffscreenArea * area);
4905b261ecSmrg
5005b261ecSmrgtypedef enum _ExaOffscreenState {
5105b261ecSmrg    ExaOffscreenAvail,
5205b261ecSmrg    ExaOffscreenRemovable,
5305b261ecSmrg    ExaOffscreenLocked
5405b261ecSmrg} ExaOffscreenState;
5505b261ecSmrg
5605b261ecSmrgstruct _ExaOffscreenArea {
5735c4bbdfSmrg    int base_offset;            /* allocation base */
5835c4bbdfSmrg    int offset;                 /* aligned offset */
5935c4bbdfSmrg    int size;                   /* total allocation size */
6035c4bbdfSmrg    unsigned last_use;
6135c4bbdfSmrg    void *privData;
6205b261ecSmrg
6305b261ecSmrg    ExaOffscreenSaveProc save;
6405b261ecSmrg
6535c4bbdfSmrg    ExaOffscreenState state;
6605b261ecSmrg
6735c4bbdfSmrg    ExaOffscreenArea *next;
684642e01fSmrg
6935c4bbdfSmrg    unsigned eviction_cost;
706747b715Smrg
7135c4bbdfSmrg    ExaOffscreenArea *prev;     /* Double-linked list for defragmentation */
7235c4bbdfSmrg    int align;                  /* required alignment */
7305b261ecSmrg};
7405b261ecSmrg
7505b261ecSmrg/**
7605b261ecSmrg * The ExaDriver structure is allocated through exaDriverAlloc(), and then
7705b261ecSmrg * fllled in by drivers.
7805b261ecSmrg */
7905b261ecSmrgtypedef struct _ExaDriver {
8005b261ecSmrg    /**
8105b261ecSmrg     * exa_major and exa_minor should be set by the driver to the version of
8205b261ecSmrg     * EXA which the driver was compiled for (or configures itself at runtime
8305b261ecSmrg     * to support).  This allows EXA to extend the structure for new features
8405b261ecSmrg     * without breaking ABI for drivers compiled against older versions.
8505b261ecSmrg     */
8605b261ecSmrg    int exa_major, exa_minor;
8705b261ecSmrg
8805b261ecSmrg    /**
8905b261ecSmrg     * memoryBase is the address of the beginning of framebuffer memory.
9005b261ecSmrg     * The visible screen should be within memoryBase to memoryBase +
9105b261ecSmrg     * memorySize.
9205b261ecSmrg     */
9335c4bbdfSmrg    CARD8 *memoryBase;
9405b261ecSmrg
9505b261ecSmrg    /**
9605b261ecSmrg     * offScreenBase is the offset from memoryBase of the beginning of the area
9705b261ecSmrg     * to be managed by EXA's linear offscreen memory manager.
9805b261ecSmrg     *
9905b261ecSmrg     * In XFree86 DDX drivers, this is probably:
10005b261ecSmrg     *   (pScrn->displayWidth * cpp * pScrn->virtualY)
10105b261ecSmrg     */
10235c4bbdfSmrg    unsigned long offScreenBase;
10305b261ecSmrg
10405b261ecSmrg    /**
10505b261ecSmrg     * memorySize is the length (in bytes) of framebuffer memory beginning
10605b261ecSmrg     * from memoryBase.
10705b261ecSmrg     *
10805b261ecSmrg     * The offscreen memory manager will manage the area beginning at
10905b261ecSmrg     * (memoryBase + offScreenBase), with a length of (memorySize -
11005b261ecSmrg     * offScreenBase)
11105b261ecSmrg     *
11205b261ecSmrg     * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
11305b261ecSmrg     */
11405b261ecSmrg    unsigned long memorySize;
11505b261ecSmrg
11605b261ecSmrg    /**
11705b261ecSmrg     * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
11805b261ecSmrg     * within framebuffer.
11905b261ecSmrg     *
12005b261ecSmrg     * Hardware typically has a required alignment of offsets, which may or may
12105b261ecSmrg     * not be a power of two.  EXA will ensure that pixmaps managed by the
12205b261ecSmrg     * offscreen memory manager meet this alignment requirement.
12305b261ecSmrg     */
12405b261ecSmrg    int pixmapOffsetAlign;
12505b261ecSmrg
12605b261ecSmrg    /**
12705b261ecSmrg     * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
12805b261ecSmrg     * within the framebuffer.
12905b261ecSmrg     *
13005b261ecSmrg     * Hardware typically has a required alignment of pitches for acceleration.
13105b261ecSmrg     * For 3D hardware, Composite acceleration often requires that source and
13205b261ecSmrg     * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
13305b261ecSmrg     * using EXA_OFFSCREEN_ALIGN_POT.  These pitch requirements only apply to
13405b261ecSmrg     * pixmaps managed by the offscreen memory manager.  Thus, it is up to the
13505b261ecSmrg     * driver to ensure that the visible screen has an appropriate pitch for
13605b261ecSmrg     * acceleration.
13705b261ecSmrg     */
13805b261ecSmrg    int pixmapPitchAlign;
13905b261ecSmrg
14005b261ecSmrg    /**
14105b261ecSmrg     * The flags field is bitfield of boolean values controlling EXA's behavior.
14205b261ecSmrg     *
143ed6184dfSmrg     * The flags include EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
14405b261ecSmrg     * EXA_TWO_BITBLT_DIRECTIONS.
14505b261ecSmrg     */
14605b261ecSmrg    int flags;
14705b261ecSmrg
14805b261ecSmrg    /** @{ */
14905b261ecSmrg    /**
15005b261ecSmrg     * maxX controls the X coordinate limitation for rendering from the card.
15105b261ecSmrg     * The driver should never receive a request for rendering beyond maxX
15205b261ecSmrg     * in the X direction from the origin of a pixmap.
15305b261ecSmrg     */
15405b261ecSmrg    int maxX;
15505b261ecSmrg
15605b261ecSmrg    /**
15705b261ecSmrg     * maxY controls the Y coordinate limitation for rendering from the card.
15805b261ecSmrg     * The driver should never receive a request for rendering beyond maxY
15905b261ecSmrg     * in the Y direction from the origin of a pixmap.
16005b261ecSmrg     */
16105b261ecSmrg    int maxY;
16205b261ecSmrg    /** @} */
16305b261ecSmrg
16405b261ecSmrg    /* private */
16505b261ecSmrg    ExaOffscreenArea *offScreenAreas;
16635c4bbdfSmrg    Bool needsSync;
16735c4bbdfSmrg    int lastMarker;
16805b261ecSmrg
16905b261ecSmrg    /** @name Solid
17005b261ecSmrg     * @{
17105b261ecSmrg     */
17205b261ecSmrg    /**
17305b261ecSmrg     * PrepareSolid() sets up the driver for doing a solid fill.
17405b261ecSmrg     * @param pPixmap Destination pixmap
17505b261ecSmrg     * @param alu raster operation
17605b261ecSmrg     * @param planemask write mask for the fill
17705b261ecSmrg     * @param fg "foreground" color for the fill
17805b261ecSmrg     *
17905b261ecSmrg     * This call should set up the driver for doing a series of solid fills
18005b261ecSmrg     * through the Solid() call.  The alu raster op is one of the GX*
18105b261ecSmrg     * graphics functions listed in X.h, and typically maps to a similar
18205b261ecSmrg     * single-byte "ROP" setting in all hardware.  The planemask controls
18305b261ecSmrg     * which bits of the destination should be affected, and will only represent
18405b261ecSmrg     * the bits up to the depth of pPixmap.  The fg is the pixel value of the
18505b261ecSmrg     * foreground color referred to in ROP descriptions.
18605b261ecSmrg     *
18705b261ecSmrg     * Note that many drivers will need to store some of the data in the driver
18805b261ecSmrg     * private record, for sending to the hardware with each drawing command.
18905b261ecSmrg     *
19005b261ecSmrg     * The PrepareSolid() call is required of all drivers, but it may fail for any
19105b261ecSmrg     * reason.  Failure results in a fallback to software rendering.
19205b261ecSmrg     */
19335c4bbdfSmrg    Bool (*PrepareSolid) (PixmapPtr pPixmap,
19435c4bbdfSmrg                          int alu, Pixel planemask, Pixel fg);
19505b261ecSmrg
19605b261ecSmrg    /**
19705b261ecSmrg     * Solid() performs a solid fill set up in the last PrepareSolid() call.
19805b261ecSmrg     *
19905b261ecSmrg     * @param pPixmap destination pixmap
20005b261ecSmrg     * @param x1 left coordinate
20105b261ecSmrg     * @param y1 top coordinate
20205b261ecSmrg     * @param x2 right coordinate
20305b261ecSmrg     * @param y2 bottom coordinate
20405b261ecSmrg     *
20505b261ecSmrg     * Performs the fill set up by the last PrepareSolid() call, covering the
20605b261ecSmrg     * area from (x1,y1) to (x2,y2) in pPixmap.  Note that the coordinates are
20705b261ecSmrg     * in the coordinate space of the destination pixmap, so the driver will
20805b261ecSmrg     * need to set up the hardware's offset and pitch for the destination
20905b261ecSmrg     * coordinates according to the pixmap's offset and pitch within
21005b261ecSmrg     * framebuffer.  This likely means using exaGetPixmapOffset() and
21105b261ecSmrg     * exaGetPixmapPitch().
21205b261ecSmrg     *
21305b261ecSmrg     * This call is required if PrepareSolid() ever succeeds.
21405b261ecSmrg     */
21535c4bbdfSmrg    void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
21605b261ecSmrg
21705b261ecSmrg    /**
21805b261ecSmrg     * DoneSolid() finishes a set of solid fills.
21905b261ecSmrg     *
22005b261ecSmrg     * @param pPixmap destination pixmap.
22105b261ecSmrg     *
22205b261ecSmrg     * The DoneSolid() call is called at the end of a series of consecutive
22305b261ecSmrg     * Solid() calls following a successful PrepareSolid().  This allows drivers
22405b261ecSmrg     * to finish up emitting drawing commands that were buffered, or clean up
22505b261ecSmrg     * state from PrepareSolid().
22605b261ecSmrg     *
22705b261ecSmrg     * This call is required if PrepareSolid() ever succeeds.
22805b261ecSmrg     */
22935c4bbdfSmrg    void (*DoneSolid) (PixmapPtr pPixmap);
23005b261ecSmrg    /** @} */
23105b261ecSmrg
23205b261ecSmrg    /** @name Copy
23305b261ecSmrg     * @{
23405b261ecSmrg     */
23505b261ecSmrg    /**
23635c4bbdfSmrg     * PrepareCopy() sets up the driver for doing a copy within video
23705b261ecSmrg     * memory.
23805b261ecSmrg     *
23905b261ecSmrg     * @param pSrcPixmap source pixmap
24005b261ecSmrg     * @param pDstPixmap destination pixmap
24105b261ecSmrg     * @param dx X copy direction
24205b261ecSmrg     * @param dy Y copy direction
24305b261ecSmrg     * @param alu raster operation
24405b261ecSmrg     * @param planemask write mask for the fill
24505b261ecSmrg     *
24605b261ecSmrg     * This call should set up the driver for doing a series of copies from the
24705b261ecSmrg     * the pSrcPixmap to the pDstPixmap.  The dx flag will be positive if the
24805b261ecSmrg     * hardware should do the copy from the left to the right, and dy will be
24905b261ecSmrg     * positive if the copy should be done from the top to the bottom.  This
25005b261ecSmrg     * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
25105b261ecSmrg     * If your hardware can only support blits that are (left to right, top to
25205b261ecSmrg     * bottom) or (right to left, bottom to top), then you should set
25305b261ecSmrg     * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
25405b261ecSmrg     * ones that meet those requirements.  The alu raster op is one of the GX*
25505b261ecSmrg     * graphics functions listed in X.h, and typically maps to a similar
25605b261ecSmrg     * single-byte "ROP" setting in all hardware.  The planemask controls which
25705b261ecSmrg     * bits of the destination should be affected, and will only represent the
25805b261ecSmrg     * bits up to the depth of pPixmap.
25905b261ecSmrg     *
26005b261ecSmrg     * Note that many drivers will need to store some of the data in the driver
26105b261ecSmrg     * private record, for sending to the hardware with each drawing command.
26205b261ecSmrg     *
26305b261ecSmrg     * The PrepareCopy() call is required of all drivers, but it may fail for any
26405b261ecSmrg     * reason.  Failure results in a fallback to software rendering.
26505b261ecSmrg     */
26635c4bbdfSmrg    Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
26735c4bbdfSmrg                         PixmapPtr pDstPixmap,
26835c4bbdfSmrg                         int dx, int dy, int alu, Pixel planemask);
26905b261ecSmrg
27005b261ecSmrg    /**
27105b261ecSmrg     * Copy() performs a copy set up in the last PrepareCopy call.
27205b261ecSmrg     *
27305b261ecSmrg     * @param pDstPixmap destination pixmap
27405b261ecSmrg     * @param srcX source X coordinate
27505b261ecSmrg     * @param srcY source Y coordinate
27605b261ecSmrg     * @param dstX destination X coordinate
27705b261ecSmrg     * @param dstY destination Y coordinate
27805b261ecSmrg     * @param width width of the rectangle to be copied
27905b261ecSmrg     * @param height height of the rectangle to be copied.
28005b261ecSmrg     *
28105b261ecSmrg     * Performs the copy set up by the last PrepareCopy() call, copying the
28205b261ecSmrg     * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
28305b261ecSmrg     * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
28405b261ecSmrg     * pixmap.  Those rectangles may overlap in memory, if
28505b261ecSmrg     * pSrcPixmap == pDstPixmap.  Note that this call does not receive the
28605b261ecSmrg     * pSrcPixmap as an argument -- if it's needed in this function, it should
28705b261ecSmrg     * be stored in the driver private during PrepareCopy().  As with Solid(),
28805b261ecSmrg     * the coordinates are in the coordinate space of each pixmap, so the driver
28905b261ecSmrg     * will need to set up source and destination pitches and offsets from those
29005b261ecSmrg     * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
29105b261ecSmrg     *
29205b261ecSmrg     * This call is required if PrepareCopy ever succeeds.
29305b261ecSmrg     */
29435c4bbdfSmrg    void (*Copy) (PixmapPtr pDstPixmap,
29535c4bbdfSmrg                  int srcX,
29635c4bbdfSmrg                  int srcY, int dstX, int dstY, int width, int height);
29705b261ecSmrg
29805b261ecSmrg    /**
29905b261ecSmrg     * DoneCopy() finishes a set of copies.
30005b261ecSmrg     *
30105b261ecSmrg     * @param pPixmap destination pixmap.
30205b261ecSmrg     *
30305b261ecSmrg     * The DoneCopy() call is called at the end of a series of consecutive
30405b261ecSmrg     * Copy() calls following a successful PrepareCopy().  This allows drivers
30505b261ecSmrg     * to finish up emitting drawing commands that were buffered, or clean up
30605b261ecSmrg     * state from PrepareCopy().
30705b261ecSmrg     *
30805b261ecSmrg     * This call is required if PrepareCopy() ever succeeds.
30905b261ecSmrg     */
31035c4bbdfSmrg    void (*DoneCopy) (PixmapPtr pDstPixmap);
31105b261ecSmrg    /** @} */
31205b261ecSmrg
31305b261ecSmrg    /** @name Composite
31405b261ecSmrg     * @{
31505b261ecSmrg     */
31605b261ecSmrg    /**
31705b261ecSmrg     * CheckComposite() checks to see if a composite operation could be
31805b261ecSmrg     * accelerated.
31905b261ecSmrg     *
32005b261ecSmrg     * @param op Render operation
32105b261ecSmrg     * @param pSrcPicture source Picture
32205b261ecSmrg     * @param pMaskPicture mask picture
32305b261ecSmrg     * @param pDstPicture destination Picture
32405b261ecSmrg     *
32505b261ecSmrg     * The CheckComposite() call checks if the driver could handle acceleration
32605b261ecSmrg     * of op with the given source, mask, and destination pictures.  This allows
32705b261ecSmrg     * drivers to check source and destination formats, supported operations,
32805b261ecSmrg     * transformations, and component alpha state, and send operations it can't
32905b261ecSmrg     * support to software rendering early on.  This avoids costly pixmap
33005b261ecSmrg     * migration to the wrong places when the driver can't accelerate
33105b261ecSmrg     * operations.  Note that because migration hasn't happened, the driver
33205b261ecSmrg     * can't know during CheckComposite() what the offsets and pitches of the
33305b261ecSmrg     * pixmaps are going to be.
33405b261ecSmrg     *
33505b261ecSmrg     * See PrepareComposite() for more details on likely issues that drivers
33605b261ecSmrg     * will have in accelerating Composite operations.
33705b261ecSmrg     *
33805b261ecSmrg     * The CheckComposite() call is recommended if PrepareComposite() is
33905b261ecSmrg     * implemented, but is not required.
34005b261ecSmrg     */
34135c4bbdfSmrg    Bool (*CheckComposite) (int op,
34235c4bbdfSmrg                            PicturePtr pSrcPicture,
34335c4bbdfSmrg                            PicturePtr pMaskPicture, PicturePtr pDstPicture);
34405b261ecSmrg
34505b261ecSmrg    /**
34605b261ecSmrg     * PrepareComposite() sets up the driver for doing a Composite operation
34705b261ecSmrg     * described in the Render extension protocol spec.
34805b261ecSmrg     *
34905b261ecSmrg     * @param op Render operation
35005b261ecSmrg     * @param pSrcPicture source Picture
35105b261ecSmrg     * @param pMaskPicture mask picture
35205b261ecSmrg     * @param pDstPicture destination Picture
35305b261ecSmrg     * @param pSrc source pixmap
35405b261ecSmrg     * @param pMask mask pixmap
35505b261ecSmrg     * @param pDst destination pixmap
35605b261ecSmrg     *
35705b261ecSmrg     * This call should set up the driver for doing a series of Composite
35805b261ecSmrg     * operations, as described in the Render protocol spec, with the given
35905b261ecSmrg     * pSrcPicture, pMaskPicture, and pDstPicture.  The pSrc, pMask, and
36005b261ecSmrg     * pDst are the pixmaps containing the pixel data, and should be used for
36105b261ecSmrg     * setting the offset and pitch used for the coordinate spaces for each of
36205b261ecSmrg     * the Pictures.
36305b261ecSmrg     *
36405b261ecSmrg     * Notes on interpreting Picture structures:
36505b261ecSmrg     * - The Picture structures will always have a valid pDrawable.
36605b261ecSmrg     * - The Picture structures will never have alphaMap set.
36705b261ecSmrg     * - The mask Picture (and therefore pMask) may be NULL, in which case the
36805b261ecSmrg     *   operation is simply src OP dst instead of src IN mask OP dst, and
36905b261ecSmrg     *   mask coordinates should be ignored.
37005b261ecSmrg     * - pMarkPicture may have componentAlpha set, which greatly changes
37105b261ecSmrg     *   the behavior of the Composite operation.  componentAlpha has no effect
37205b261ecSmrg     *   when set on pSrcPicture or pDstPicture.
37305b261ecSmrg     * - The source and mask Pictures may have a transformation set
37405b261ecSmrg     *   (Picture->transform != NULL), which means that the source coordinates
37505b261ecSmrg     *   should be transformed by that transformation, resulting in scaling,
37605b261ecSmrg     *   rotation, etc.  The PictureTransformPoint() call can transform
37705b261ecSmrg     *   coordinates for you.  Transforms have no effect on Pictures when used
37805b261ecSmrg     *   as a destination.
37905b261ecSmrg     * - The source and mask pictures may have a filter set.  PictFilterNearest
38005b261ecSmrg     *   and PictFilterBilinear are defined in the Render protocol, but others
38105b261ecSmrg     *   may be encountered, and must be handled correctly (usually by
38205b261ecSmrg     *   PrepareComposite failing, and falling back to software).  Filters have
38305b261ecSmrg     *   no effect on Pictures when used as a destination.
38405b261ecSmrg     * - The source and mask Pictures may have repeating set, which must be
38505b261ecSmrg     *   respected.  Many chipsets will be unable to support repeating on
38605b261ecSmrg     *   pixmaps that have a width or height that is not a power of two.
38705b261ecSmrg     *
38805b261ecSmrg     * If your hardware can't support source pictures (textures) with
38905b261ecSmrg     * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
39005b261ecSmrg     *
39105b261ecSmrg     * Note that many drivers will need to store some of the data in the driver
39205b261ecSmrg     * private record, for sending to the hardware with each drawing command.
39305b261ecSmrg     *
39405b261ecSmrg     * The PrepareComposite() call is not required.  However, it is highly
39505b261ecSmrg     * recommended for performance of antialiased font rendering and performance
39605b261ecSmrg     * of cairo applications.  Failure results in a fallback to software
39705b261ecSmrg     * rendering.
39805b261ecSmrg     */
39935c4bbdfSmrg    Bool (*PrepareComposite) (int op,
40035c4bbdfSmrg                              PicturePtr pSrcPicture,
40135c4bbdfSmrg                              PicturePtr pMaskPicture,
40235c4bbdfSmrg                              PicturePtr pDstPicture,
40335c4bbdfSmrg                              PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
40405b261ecSmrg
40505b261ecSmrg    /**
40605b261ecSmrg     * Composite() performs a Composite operation set up in the last
40705b261ecSmrg     * PrepareComposite() call.
40805b261ecSmrg     *
40905b261ecSmrg     * @param pDstPixmap destination pixmap
41005b261ecSmrg     * @param srcX source X coordinate
41105b261ecSmrg     * @param srcY source Y coordinate
41205b261ecSmrg     * @param maskX source X coordinate
41305b261ecSmrg     * @param maskY source Y coordinate
41405b261ecSmrg     * @param dstX destination X coordinate
41505b261ecSmrg     * @param dstY destination Y coordinate
41605b261ecSmrg     * @param width destination rectangle width
41705b261ecSmrg     * @param height destination rectangle height
41805b261ecSmrg     *
41905b261ecSmrg     * Performs the Composite operation set up by the last PrepareComposite()
42005b261ecSmrg     * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
42105b261ecSmrg     * in the destination Pixmap.  Note that if a transformation was set on
42205b261ecSmrg     * the source or mask Pictures, the source rectangles may not be the same
42305b261ecSmrg     * size as the destination rectangles and filtering.  Getting the coordinate
42405b261ecSmrg     * transformation right at the subpixel level can be tricky, and rendercheck
42505b261ecSmrg     * can test this for you.
42605b261ecSmrg     *
42705b261ecSmrg     * This call is required if PrepareComposite() ever succeeds.
42805b261ecSmrg     */
42935c4bbdfSmrg    void (*Composite) (PixmapPtr pDst,
43035c4bbdfSmrg                       int srcX,
43135c4bbdfSmrg                       int srcY,
43235c4bbdfSmrg                       int maskX,
43335c4bbdfSmrg                       int maskY, int dstX, int dstY, int width, int height);
43405b261ecSmrg
43505b261ecSmrg    /**
43605b261ecSmrg     * DoneComposite() finishes a set of Composite operations.
43705b261ecSmrg     *
43805b261ecSmrg     * @param pPixmap destination pixmap.
43905b261ecSmrg     *
44005b261ecSmrg     * The DoneComposite() call is called at the end of a series of consecutive
44105b261ecSmrg     * Composite() calls following a successful PrepareComposite().  This allows
44205b261ecSmrg     * drivers to finish up emitting drawing commands that were buffered, or
44305b261ecSmrg     * clean up state from PrepareComposite().
44405b261ecSmrg     *
44505b261ecSmrg     * This call is required if PrepareComposite() ever succeeds.
44605b261ecSmrg     */
44735c4bbdfSmrg    void (*DoneComposite) (PixmapPtr pDst);
44805b261ecSmrg    /** @} */
44905b261ecSmrg
45005b261ecSmrg    /**
45105b261ecSmrg     * UploadToScreen() loads a rectangle of data from src into pDst.
45205b261ecSmrg     *
45305b261ecSmrg     * @param pDst destination pixmap
45405b261ecSmrg     * @param x destination X coordinate.
45505b261ecSmrg     * @param y destination Y coordinate
45605b261ecSmrg     * @param width width of the rectangle to be copied
45705b261ecSmrg     * @param height height of the rectangle to be copied
45805b261ecSmrg     * @param src pointer to the beginning of the source data
45905b261ecSmrg     * @param src_pitch pitch (in bytes) of the lines of source data.
46005b261ecSmrg     *
46105b261ecSmrg     * UploadToScreen() copies data in system memory beginning at src (with
46205b261ecSmrg     * pitch src_pitch) into the destination pixmap from (x, y) to
46305b261ecSmrg     * (x + width, y + height).  This is typically done with hostdata uploads,
46405b261ecSmrg     * where the CPU sets up a blit command on the hardware with instructions
46505b261ecSmrg     * that the blit data will be fed through some sort of aperture on the card.
46605b261ecSmrg     *
46705b261ecSmrg     * If UploadToScreen() is performed asynchronously, it is up to the driver
46805b261ecSmrg     * to call exaMarkSync().  This is in contrast to most other acceleration
46905b261ecSmrg     * calls in EXA.
47005b261ecSmrg     *
47105b261ecSmrg     * UploadToScreen() can aid in pixmap migration, but is most important for
47205b261ecSmrg     * the performance of exaGlyphs() (antialiased font drawing) by allowing
47305b261ecSmrg     * pipelining of data uploads, avoiding a sync of the card after each glyph.
47435c4bbdfSmrg     *
47505b261ecSmrg     * @return TRUE if the driver successfully uploaded the data.  FALSE
47605b261ecSmrg     * indicates that EXA should fall back to doing the upload in software.
47705b261ecSmrg     *
47805b261ecSmrg     * UploadToScreen() is not required, but is recommended if Composite
47905b261ecSmrg     * acceleration is supported.
48005b261ecSmrg     */
48135c4bbdfSmrg    Bool (*UploadToScreen) (PixmapPtr pDst,
48235c4bbdfSmrg                            int x,
48335c4bbdfSmrg                            int y, int w, int h, char *src, int src_pitch);
48405b261ecSmrg
48505b261ecSmrg    /**
4866747b715Smrg     * UploadToScratch() is no longer used and will be removed next time the EXA
4876747b715Smrg     * major version needs to be bumped.
48805b261ecSmrg     */
48935c4bbdfSmrg    Bool (*UploadToScratch) (PixmapPtr pSrc, PixmapPtr pDst);
49005b261ecSmrg
49105b261ecSmrg    /**
49205b261ecSmrg     * DownloadFromScreen() loads a rectangle of data from pSrc into dst
49305b261ecSmrg     *
49405b261ecSmrg     * @param pSrc source pixmap
49505b261ecSmrg     * @param x source X coordinate.
49605b261ecSmrg     * @param y source Y coordinate
49705b261ecSmrg     * @param width width of the rectangle to be copied
49805b261ecSmrg     * @param height height of the rectangle to be copied
49905b261ecSmrg     * @param dst pointer to the beginning of the destination data
50005b261ecSmrg     * @param dst_pitch pitch (in bytes) of the lines of destination data.
50105b261ecSmrg     *
50205b261ecSmrg     * DownloadFromScreen() copies data from offscreen memory in pSrc from
50305b261ecSmrg     * (x, y) to (x + width, y + height), to system memory starting at
50405b261ecSmrg     * dst (with pitch dst_pitch).  This would usually be done
50505b261ecSmrg     * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
50605b261ecSmrg     * and then synchronously reading from AGP.  Because the implementation
50705b261ecSmrg     * might be synchronous, EXA leaves it up to the driver to call
50805b261ecSmrg     * exaMarkSync() if DownloadFromScreen() was asynchronous.  This is in
50905b261ecSmrg     * contrast to most other acceleration calls in EXA.
51005b261ecSmrg     *
51105b261ecSmrg     * DownloadFromScreen() can aid in the largest bottleneck in pixmap
51205b261ecSmrg     * migration, which is the read from framebuffer when evicting pixmaps from
51305b261ecSmrg     * framebuffer memory.  Thus, it is highly recommended, even though
51405b261ecSmrg     * implementations are typically complicated.
51535c4bbdfSmrg     *
51605b261ecSmrg     * @return TRUE if the driver successfully downloaded the data.  FALSE
51705b261ecSmrg     * indicates that EXA should fall back to doing the download in software.
51805b261ecSmrg     *
51905b261ecSmrg     * DownloadFromScreen() is not required, but is highly recommended.
52005b261ecSmrg     */
52135c4bbdfSmrg    Bool (*DownloadFromScreen) (PixmapPtr pSrc,
52235c4bbdfSmrg                                int x, int y,
52335c4bbdfSmrg                                int w, int h, char *dst, int dst_pitch);
52405b261ecSmrg
52505b261ecSmrg    /**
52605b261ecSmrg     * MarkSync() requests that the driver mark a synchronization point,
52705b261ecSmrg     * returning an driver-defined integer marker which could be requested for
52805b261ecSmrg     * synchronization to later in WaitMarker().  This might be used in the
52905b261ecSmrg     * future to avoid waiting for full hardware stalls before accessing pixmap
53005b261ecSmrg     * data with the CPU, but is not important in the current incarnation of
53105b261ecSmrg     * EXA.
53205b261ecSmrg     *
53305b261ecSmrg     * Note that drivers should call exaMarkSync() when they have done some
53405b261ecSmrg     * acceleration, rather than their own MarkSync() handler, as otherwise EXA
53505b261ecSmrg     * will be unaware of the driver's acceleration and not sync to it during
53605b261ecSmrg     * fallbacks.
53705b261ecSmrg     *
53805b261ecSmrg     * MarkSync() is optional.
53905b261ecSmrg     */
54035c4bbdfSmrg    int (*MarkSync) (ScreenPtr pScreen);
54105b261ecSmrg
54205b261ecSmrg    /**
54305b261ecSmrg     * WaitMarker() waits for all rendering before the given marker to have
54405b261ecSmrg     * completed.  If the driver does not implement MarkSync(), marker is
54505b261ecSmrg     * meaningless, and all rendering by the hardware should be completed before
54605b261ecSmrg     * WaitMarker() returns.
54705b261ecSmrg     *
54805b261ecSmrg     * Note that drivers should call exaWaitSync() to wait for all acceleration
54905b261ecSmrg     * to finish, as otherwise EXA will be unaware of the driver having
55005b261ecSmrg     * synchronized, resulting in excessive WaitMarker() calls.
55105b261ecSmrg     *
55205b261ecSmrg     * WaitMarker() is required of all drivers.
55305b261ecSmrg     */
55435c4bbdfSmrg    void (*WaitMarker) (ScreenPtr pScreen, int marker);
55505b261ecSmrg
55605b261ecSmrg    /** @{ */
55705b261ecSmrg    /**
55805b261ecSmrg     * PrepareAccess() is called before CPU access to an offscreen pixmap.
55905b261ecSmrg     *
56005b261ecSmrg     * @param pPix the pixmap being accessed
56105b261ecSmrg     * @param index the index of the pixmap being accessed.
56205b261ecSmrg     *
56305b261ecSmrg     * PrepareAccess() will be called before CPU access to an offscreen pixmap.
56405b261ecSmrg     * This can be used to set up hardware surfaces for byteswapping or
56505b261ecSmrg     * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
56605b261ecSmrg     * making CPU access use a different aperture.
56705b261ecSmrg     *
5686747b715Smrg     * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
5696747b715Smrg     * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
5706747b715Smrg     * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
5716747b715Smrg     * will have PrepareAccess() called on them per operation, drivers can have
5726747b715Smrg     * a small, statically-allocated space to maintain state for PrepareAccess()
5736747b715Smrg     * and FinishAccess() in.  Note that PrepareAccess() is only called once per
5746747b715Smrg     * pixmap and operation, regardless of whether the pixmap is used as a
5756747b715Smrg     * destination and/or source, and the index may not reflect the usage.
57605b261ecSmrg     *
57705b261ecSmrg     * PrepareAccess() may fail.  An example might be the case of hardware that
57805b261ecSmrg     * can set up 1 or 2 surfaces for CPU access, but not 3.  If PrepareAccess()
57905b261ecSmrg     * fails, EXA will migrate the pixmap to system memory.
58005b261ecSmrg     * DownloadFromScreen() must be implemented and must not fail if a driver
58105b261ecSmrg     * wishes to fail in PrepareAccess().  PrepareAccess() must not fail when
58205b261ecSmrg     * pPix is the visible screen, because the visible screen can not be
58305b261ecSmrg     * migrated.
58405b261ecSmrg     *
58505b261ecSmrg     * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
58605b261ecSmrg     * drawing.
58705b261ecSmrg     * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
58805b261ecSmrg     * DownloadFromScreen() to migate the pixmap out.
58905b261ecSmrg     */
59035c4bbdfSmrg    Bool (*PrepareAccess) (PixmapPtr pPix, int index);
59105b261ecSmrg
59205b261ecSmrg    /**
59305b261ecSmrg     * FinishAccess() is called after CPU access to an offscreen pixmap.
59405b261ecSmrg     *
59505b261ecSmrg     * @param pPix the pixmap being accessed
59605b261ecSmrg     * @param index the index of the pixmap being accessed.
59705b261ecSmrg     *
59805b261ecSmrg     * FinishAccess() will be called after finishing CPU access of an offscreen
59905b261ecSmrg     * pixmap set up by PrepareAccess().  Note that the FinishAccess() will not be
60005b261ecSmrg     * called if PrepareAccess() failed and the pixmap was migrated out.
60105b261ecSmrg     */
60235c4bbdfSmrg    void (*FinishAccess) (PixmapPtr pPix, int index);
60305b261ecSmrg
60405b261ecSmrg    /**
60505b261ecSmrg     * PixmapIsOffscreen() is an optional driver replacement to
6066747b715Smrg     * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
6076747b715Smrg     * of exaPixmapHasGpuCopy().
60805b261ecSmrg     *
60905b261ecSmrg     * @param pPix the pixmap
61005b261ecSmrg     * @return TRUE if the given drawable is in framebuffer memory.
61105b261ecSmrg     *
6126747b715Smrg     * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
61305b261ecSmrg     * memory, meaning that acceleration could probably be done to it, and that it
61405b261ecSmrg     * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
61505b261ecSmrg     * with the CPU.
61605b261ecSmrg     *
61705b261ecSmrg     *
61805b261ecSmrg     */
61935c4bbdfSmrg    Bool (*PixmapIsOffscreen) (PixmapPtr pPix);
62005b261ecSmrg
62135c4bbdfSmrg        /** @name PrepareAccess() and FinishAccess() indices
62205b261ecSmrg	 * @{
62305b261ecSmrg	 */
62435c4bbdfSmrg        /**
62505b261ecSmrg	 * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
62605b261ecSmrg	 * read from.
62735c4bbdfSmrg	 */
62835c4bbdfSmrg#define EXA_PREPARE_DEST	0
62935c4bbdfSmrg        /**
63005b261ecSmrg	 * EXA_PREPARE_SRC is the index for a pixmap that may be read from
63105b261ecSmrg	 */
63235c4bbdfSmrg#define EXA_PREPARE_SRC		1
63335c4bbdfSmrg        /**
63405b261ecSmrg	 * EXA_PREPARE_SRC is the index for a second pixmap that may be read
63505b261ecSmrg	 * from.
63605b261ecSmrg	 */
63735c4bbdfSmrg#define EXA_PREPARE_MASK	2
63835c4bbdfSmrg        /**
6394642e01fSmrg	 * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
6404642e01fSmrg	 * separate alpha maps with Composite operations.
6414642e01fSmrg	 */
64235c4bbdfSmrg#define EXA_PREPARE_AUX_DEST	3
64335c4bbdfSmrg#define EXA_PREPARE_AUX_SRC	4
64435c4bbdfSmrg#define EXA_PREPARE_AUX_MASK	5
64535c4bbdfSmrg#define EXA_NUM_PREPARE_INDICES	6
64635c4bbdfSmrg        /** @} */
6474642e01fSmrg
6484642e01fSmrg    /**
6494642e01fSmrg     * maxPitchPixels controls the pitch limitation for rendering from
6504642e01fSmrg     * the card.
6514642e01fSmrg     * The driver should never receive a request for rendering a pixmap
6524642e01fSmrg     * that has a pitch (in pixels) beyond maxPitchPixels.
6534642e01fSmrg     *
6544642e01fSmrg     * Setting this field is optional -- if your hardware doesn't have
6554642e01fSmrg     * a pitch limitation in pixels, don't set this. If neither this value
6564642e01fSmrg     * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
6574642e01fSmrg     * If set, it must not be smaller than maxX.
6584642e01fSmrg     *
6594642e01fSmrg     * @sa maxPitchBytes
6604642e01fSmrg     */
6614642e01fSmrg    int maxPitchPixels;
6624642e01fSmrg
6634642e01fSmrg    /**
6644642e01fSmrg     * maxPitchBytes controls the pitch limitation for rendering from
6654642e01fSmrg     * the card.
6664642e01fSmrg     * The driver should never receive a request for rendering a pixmap
6674642e01fSmrg     * that has a pitch (in bytes) beyond maxPitchBytes.
6684642e01fSmrg     *
6694642e01fSmrg     * Setting this field is optional -- if your hardware doesn't have
6704642e01fSmrg     * a pitch limitation in bytes, don't set this.
6714642e01fSmrg     * If set, it must not be smaller than maxX * 4.
6724642e01fSmrg     * There's no default value for maxPitchBytes.
6734642e01fSmrg     *
6744642e01fSmrg     * @sa maxPitchPixels
6754642e01fSmrg     */
6764642e01fSmrg    int maxPitchBytes;
6774642e01fSmrg
6784642e01fSmrg    /* Hooks to allow driver to its own pixmap memory management */
67935c4bbdfSmrg    void *(*CreatePixmap) (ScreenPtr pScreen, int size, int align);
68035c4bbdfSmrg    void (*DestroyPixmap) (ScreenPtr pScreen, void *driverPriv);
6816747b715Smrg    /**
6826747b715Smrg     * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
6836747b715Smrg     * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
6846747b715Smrg     * be called.
6856747b715Smrg     */
68635c4bbdfSmrg    Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height,
68735c4bbdfSmrg                                int depth, int bitsPerPixel, int devKind,
68835c4bbdfSmrg                                void *pPixData);
6894642e01fSmrg
6906747b715Smrg    /* hooks for drivers with tiling support:
6916747b715Smrg     * driver MUST fill out new_fb_pitch with valid pitch of pixmap
6926747b715Smrg     */
69335c4bbdfSmrg    void *(*CreatePixmap2) (ScreenPtr pScreen, int width, int height,
69435c4bbdfSmrg                            int depth, int usage_hint, int bitsPerPixel,
69535c4bbdfSmrg                            int *new_fb_pitch);
69605b261ecSmrg    /** @} */
697ed6184dfSmrg    Bool (*SharePixmapBacking)(PixmapPtr pPixmap, ScreenPtr secondary, void **handle_p);
69835c4bbdfSmrg
69935c4bbdfSmrg    Bool (*SetSharedPixmapBacking)(PixmapPtr pPixmap, void *handle);
70035c4bbdfSmrg
70105b261ecSmrg} ExaDriverRec, *ExaDriverPtr;
70205b261ecSmrg
70305b261ecSmrg/** @name EXA driver flags
70405b261ecSmrg * @{
70505b261ecSmrg */
70605b261ecSmrg/**
70735c4bbdfSmrg * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
70805b261ecSmrg * offscreen pixmaps.
70905b261ecSmrg */
71005b261ecSmrg#define EXA_OFFSCREEN_PIXMAPS		(1 << 0)
71105b261ecSmrg
71205b261ecSmrg/**
71305b261ecSmrg * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
71405b261ecSmrg * to have a power-of-two pitch.
71505b261ecSmrg */
71605b261ecSmrg#define EXA_OFFSCREEN_ALIGN_POT		(1 << 1)
71705b261ecSmrg
71805b261ecSmrg/**
71905b261ecSmrg * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
72005b261ecSmrg * support copies that are (left-to-right, top-to-bottom) or
72105b261ecSmrg * (right-to-left, bottom-to-top).
72205b261ecSmrg */
72305b261ecSmrg#define EXA_TWO_BITBLT_DIRECTIONS	(1 << 2)
7244642e01fSmrg
7254642e01fSmrg/**
7264642e01fSmrg * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
7274642e01fSmrg * all pixmap addressing and migration.
7284642e01fSmrg */
7294642e01fSmrg#define EXA_HANDLES_PIXMAPS             (1 << 3)
7304642e01fSmrg
7314642e01fSmrg/**
7324642e01fSmrg * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
7334642e01fSmrg * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
7344642e01fSmrg * such hooks, this flag has no effect.
7354642e01fSmrg */
7364642e01fSmrg#define EXA_SUPPORTS_PREPARE_AUX        (1 << 4)
7374642e01fSmrg
7386747b715Smrg/**
7396747b715Smrg * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
7406747b715Smrg * can handle the source and destination occupying overlapping offscreen memory
7416747b715Smrg * areas. This allows the offscreen memory defragmentation code to defragment
7426747b715Smrg * areas where the defragmented position overlaps the fragmented position.
7436747b715Smrg *
7446747b715Smrg * Typically this is supported by traditional 2D engines but not by 3D engines.
7456747b715Smrg */
7466747b715Smrg#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
7476747b715Smrg
7486747b715Smrg/**
7496747b715Smrg * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
7506747b715Smrg * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
7516747b715Smrg * into a driver pixmap and then pins it.
7526747b715Smrg */
7536747b715Smrg#define EXA_MIXED_PIXMAPS (1 << 6)
7546747b715Smrg
75505b261ecSmrg/** @} */
75605b261ecSmrg
7574642e01fSmrg/* in exa.c */
75835c4bbdfSmrgextern _X_EXPORT ExaDriverPtr exaDriverAlloc(void);
75905b261ecSmrg
7606747b715Smrgextern _X_EXPORT Bool
76135c4bbdfSmrg exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo);
76205b261ecSmrg
7636747b715Smrgextern _X_EXPORT void
76435c4bbdfSmrg exaDriverFini(ScreenPtr pScreen);
76505b261ecSmrg
7666747b715Smrgextern _X_EXPORT void
76735c4bbdfSmrg exaMarkSync(ScreenPtr pScreen);
7686747b715Smrgextern _X_EXPORT void
76935c4bbdfSmrg exaWaitSync(ScreenPtr pScreen);
77005b261ecSmrg
7716747b715Smrgextern _X_EXPORT unsigned long
77235c4bbdfSmrg exaGetPixmapOffset(PixmapPtr pPix);
7734642e01fSmrg
7746747b715Smrgextern _X_EXPORT unsigned long
77535c4bbdfSmrg exaGetPixmapPitch(PixmapPtr pPix);
7764642e01fSmrg
7776747b715Smrgextern _X_EXPORT unsigned long
77835c4bbdfSmrg exaGetPixmapSize(PixmapPtr pPix);
7794642e01fSmrg
78035c4bbdfSmrgextern _X_EXPORT void *exaGetPixmapDriverPrivate(PixmapPtr p);
7814642e01fSmrg
7824642e01fSmrg/* in exa_offscreen.c */
78335c4bbdfSmrgextern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen,
78435c4bbdfSmrg                                                     int size, int align,
78535c4bbdfSmrg                                                     Bool locked,
78635c4bbdfSmrg                                                     ExaOffscreenSaveProc save,
78735c4bbdfSmrg                                                     void *privData);
78805b261ecSmrg
78935c4bbdfSmrgextern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen,
79035c4bbdfSmrg                                                    ExaOffscreenArea * area);
79105b261ecSmrg
7926747b715Smrgextern _X_EXPORT void
79335c4bbdfSmrg ExaOffscreenMarkUsed(PixmapPtr pPixmap);
79405b261ecSmrg
7956747b715Smrgextern _X_EXPORT void
79635c4bbdfSmrg exaEnableDisableFBAccess(ScreenPtr pScreen, Bool enable);
79705b261ecSmrg
7986747b715Smrgextern _X_EXPORT Bool
79935c4bbdfSmrg exaDrawableIsOffscreen(DrawablePtr pDrawable);
8004642e01fSmrg
8016747b715Smrg/* in exa.c */
8026747b715Smrgextern _X_EXPORT void
80335c4bbdfSmrg exaMoveInPixmap(PixmapPtr pPixmap);
80405b261ecSmrg
8056747b715Smrgextern _X_EXPORT void
80635c4bbdfSmrg exaMoveOutPixmap(PixmapPtr pPixmap);
8074642e01fSmrg
8084642e01fSmrg/* in exa_unaccel.c */
8096747b715Smrgextern _X_EXPORT CARD32
81035c4bbdfSmrg exaGetPixmapFirstPixel(PixmapPtr pPixmap);
8114642e01fSmrg
81205b261ecSmrg/**
81305b261ecSmrg * Returns TRUE if the given planemask covers all the significant bits in the
81405b261ecSmrg * pixel values for pDrawable.
81505b261ecSmrg */
81605b261ecSmrg#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
81705b261ecSmrg	(((_pm) & FbFullMask((_pDrawable)->depth)) == \
81805b261ecSmrg	 FbFullMask((_pDrawable)->depth))
81905b261ecSmrg
82035c4bbdfSmrg#endif                          /* EXA_H */
821