a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Copyright (C) 2000 Keith Packard
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * 2004 Eric Anholt
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * 2005 Zack Rusin
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Permission to use, copy, modify, distribute, and sell this software and its
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * documentation for any purpose is hereby granted without fee, provided that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the above copyright notice appear in all copies and that both that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * copyright notice and this permission notice appear in supporting
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * documentation, and that the name of copyright holders not be used in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * advertising or publicity pertaining to distribution of the software without
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * specific, written prior permission. Copyright holders make no
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * representations about the suitability of this software for any purpose. It
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * is provided "as is" without express or implied warranty.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * SOFTWARE.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** @file
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This is the header containing the public API of EXA for exa drivers.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#ifndef EXA_H
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_H
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "scrnintstr.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "pixmapstr.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "windowstr.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "gcstruct.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "picturestr.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "fb.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_VERSION_MAJOR 2
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_VERSION_MINOR 6
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_VERSION_RELEASE 0
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct _ExaOffscreenArea ExaOffscreenArea;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenArea * area);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef enum _ExaOffscreenState {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenAvail,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenRemovable,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenLocked
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync} ExaOffscreenState;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstruct _ExaOffscreenArea {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int base_offset; /* allocation base */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int offset; /* aligned offset */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int size; /* total allocation size */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned last_use;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync pointer privData;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenSaveProc save;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenState state;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenArea *next;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned eviction_cost;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenArea *prev; /* Double-linked list for defragmentation */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int align; /* required alignment */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync};
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The ExaDriver structure is allocated through exaDriverAlloc(), and then
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * fllled in by drivers.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct _ExaDriver {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * exa_major and exa_minor should be set by the driver to the version of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA which the driver was compiled for (or configures itself at runtime
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to support). This allows EXA to extend the structure for new features
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * without breaking ABI for drivers compiled against older versions.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int exa_major, exa_minor;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * memoryBase is the address of the beginning of framebuffer memory.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The visible screen should be within memoryBase to memoryBase +
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * memorySize.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync CARD8 *memoryBase;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * offScreenBase is the offset from memoryBase of the beginning of the area
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to be managed by EXA's linear offscreen memory manager.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * In XFree86 DDX drivers, this is probably:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (pScrn->displayWidth * cpp * pScrn->virtualY)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned long offScreenBase;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * memorySize is the length (in bytes) of framebuffer memory beginning
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * from memoryBase.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The offscreen memory manager will manage the area beginning at
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (memoryBase + offScreenBase), with a length of (memorySize -
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * offScreenBase)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned long memorySize;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * within framebuffer.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Hardware typically has a required alignment of offsets, which may or may
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * not be a power of two. EXA will ensure that pixmaps managed by the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * offscreen memory manager meet this alignment requirement.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int pixmapOffsetAlign;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmapPitchAlign is the byte alignment necessary for pixmap pitches
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * within the framebuffer.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Hardware typically has a required alignment of pitches for acceleration.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * For 3D hardware, Composite acceleration often requires that source and
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * mask pixmaps (textures) have a power-of-two pitch, which can be demanded
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmaps managed by the offscreen memory manager. Thus, it is up to the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * driver to ensure that the visible screen has an appropriate pitch for
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * acceleration.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int pixmapPitchAlign;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The flags field is bitfield of boolean values controlling EXA's behavior.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_TWO_BITBLT_DIRECTIONS.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int flags;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @{ */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * maxX controls the X coordinate limitation for rendering from the card.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The driver should never receive a request for rendering beyond maxX
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in the X direction from the origin of a pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int maxX;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * maxY controls the Y coordinate limitation for rendering from the card.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The driver should never receive a request for rendering beyond maxY
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in the Y direction from the origin of a pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int maxY;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /* private */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenArea *offScreenAreas;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool needsSync;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int lastMarker;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @name Solid
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @{
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareSolid() sets up the driver for doing a solid fill.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPixmap Destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param alu raster operation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param planemask write mask for the fill
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param fg "foreground" color for the fill
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call should set up the driver for doing a series of solid fills
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * through the Solid() call. The alu raster op is one of the GX*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * graphics functions listed in X.h, and typically maps to a similar
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * single-byte "ROP" setting in all hardware. The planemask controls
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * which bits of the destination should be affected, and will only represent
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the bits up to the depth of pPixmap. The fg is the pixel value of the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * foreground color referred to in ROP descriptions.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Note that many drivers will need to store some of the data in the driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * private record, for sending to the hardware with each drawing command.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The PrepareSolid() call is required of all drivers, but it may fail for any
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * reason. Failure results in a fallback to software rendering.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*PrepareSolid) (PixmapPtr pPixmap,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int alu, Pixel planemask, Pixel fg);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Solid() performs a solid fill set up in the last PrepareSolid() call.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPixmap destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param x1 left coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param y1 top coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param x2 right coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param y2 bottom coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Performs the fill set up by the last PrepareSolid() call, covering the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in the coordinate space of the destination pixmap, so the driver will
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * need to set up the hardware's offset and pitch for the destination
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * coordinates according to the pixmap's offset and pitch within
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * framebuffer. This likely means using exaGetPixmapOffset() and
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * exaGetPixmapPitch().
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call is required if PrepareSolid() ever succeeds.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DoneSolid() finishes a set of solid fills.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPixmap destination pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The DoneSolid() call is called at the end of a series of consecutive
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Solid() calls following a successful PrepareSolid(). This allows drivers
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to finish up emitting drawing commands that were buffered, or clean up
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * state from PrepareSolid().
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call is required if PrepareSolid() ever succeeds.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*DoneSolid) (PixmapPtr pPixmap);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @name Copy
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @{
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareCopy() sets up the driver for doing a copy within video
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * memory.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pSrcPixmap source pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDstPixmap destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dx X copy direction
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dy Y copy direction
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param alu raster operation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param planemask write mask for the fill
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call should set up the driver for doing a series of copies from the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * hardware should do the copy from the left to the right, and dy will be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * positive if the copy should be done from the top to the bottom. This
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If your hardware can only support blits that are (left to right, top to
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * bottom) or (right to left, bottom to top), then you should set
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * ones that meet those requirements. The alu raster op is one of the GX*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * graphics functions listed in X.h, and typically maps to a similar
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * single-byte "ROP" setting in all hardware. The planemask controls which
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * bits of the destination should be affected, and will only represent the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * bits up to the depth of pPixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Note that many drivers will need to store some of the data in the driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * private record, for sending to the hardware with each drawing command.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The PrepareCopy() call is required of all drivers, but it may fail for any
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * reason. Failure results in a fallback to software rendering.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PixmapPtr pDstPixmap,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int dx, int dy, int alu, Pixel planemask);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Copy() performs a copy set up in the last PrepareCopy call.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDstPixmap destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param srcX source X coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param srcY source Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dstX destination X coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dstY destination Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param width width of the rectangle to be copied
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param height height of the rectangle to be copied.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Performs the copy set up by the last PrepareCopy() call, copying the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmap to the same-sized rectangle at (dstX, dstY) in the destination
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmap. Those rectangles may overlap in memory, if
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pSrcPixmap == pDstPixmap. Note that this call does not receive the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pSrcPixmap as an argument -- if it's needed in this function, it should
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * be stored in the driver private during PrepareCopy(). As with Solid(),
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the coordinates are in the coordinate space of each pixmap, so the driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * will need to set up source and destination pitches and offsets from those
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch().
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call is required if PrepareCopy ever succeeds.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*Copy) (PixmapPtr pDstPixmap,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int srcX,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int srcY, int dstX, int dstY, int width, int height);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DoneCopy() finishes a set of copies.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPixmap destination pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The DoneCopy() call is called at the end of a series of consecutive
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Copy() calls following a successful PrepareCopy(). This allows drivers
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to finish up emitting drawing commands that were buffered, or clean up
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * state from PrepareCopy().
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call is required if PrepareCopy() ever succeeds.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*DoneCopy) (PixmapPtr pDstPixmap);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @name Composite
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @{
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * CheckComposite() checks to see if a composite operation could be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * accelerated.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param op Render operation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pSrcPicture source Picture
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pMaskPicture mask picture
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDstPicture destination Picture
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The CheckComposite() call checks if the driver could handle acceleration
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * of op with the given source, mask, and destination pictures. This allows
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * drivers to check source and destination formats, supported operations,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * transformations, and component alpha state, and send operations it can't
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * support to software rendering early on. This avoids costly pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * migration to the wrong places when the driver can't accelerate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * operations. Note that because migration hasn't happened, the driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * can't know during CheckComposite() what the offsets and pitches of the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmaps are going to be.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * See PrepareComposite() for more details on likely issues that drivers
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * will have in accelerating Composite operations.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The CheckComposite() call is recommended if PrepareComposite() is
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * implemented, but is not required.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*CheckComposite) (int op,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PicturePtr pSrcPicture,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PicturePtr pMaskPicture, PicturePtr pDstPicture);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareComposite() sets up the driver for doing a Composite operation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * described in the Render extension protocol spec.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param op Render operation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pSrcPicture source Picture
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pMaskPicture mask picture
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDstPicture destination Picture
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pSrc source pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pMask mask pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDst destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call should set up the driver for doing a series of Composite
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * operations, as described in the Render protocol spec, with the given
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pDst are the pixmaps containing the pixel data, and should be used for
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * setting the offset and pitch used for the coordinate spaces for each of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the Pictures.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Notes on interpreting Picture structures:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - The Picture structures will always have a valid pDrawable.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - The Picture structures will never have alphaMap set.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - The mask Picture (and therefore pMask) may be NULL, in which case the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * operation is simply src OP dst instead of src IN mask OP dst, and
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * mask coordinates should be ignored.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - pMarkPicture may have componentAlpha set, which greatly changes
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the behavior of the Composite operation. componentAlpha has no effect
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * when set on pSrcPicture or pDstPicture.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - The source and mask Pictures may have a transformation set
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (Picture->transform != NULL), which means that the source coordinates
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * should be transformed by that transformation, resulting in scaling,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * rotation, etc. The PictureTransformPoint() call can transform
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * coordinates for you. Transforms have no effect on Pictures when used
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * as a destination.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - The source and mask pictures may have a filter set. PictFilterNearest
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * and PictFilterBilinear are defined in the Render protocol, but others
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * may be encountered, and must be handled correctly (usually by
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareComposite failing, and falling back to software). Filters have
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * no effect on Pictures when used as a destination.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * - The source and mask Pictures may have repeating set, which must be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * respected. Many chipsets will be unable to support repeating on
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmaps that have a width or height that is not a power of two.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If your hardware can't support source pictures (textures) with
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Note that many drivers will need to store some of the data in the driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * private record, for sending to the hardware with each drawing command.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The PrepareComposite() call is not required. However, it is highly
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * recommended for performance of antialiased font rendering and performance
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * of cairo applications. Failure results in a fallback to software
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * rendering.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*PrepareComposite) (int op,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PicturePtr pSrcPicture,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PicturePtr pMaskPicture,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PicturePtr pDstPicture,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Composite() performs a Composite operation set up in the last
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareComposite() call.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDstPixmap destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param srcX source X coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param srcY source Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param maskX source X coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param maskY source Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dstX destination X coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dstY destination Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param width destination rectangle width
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param height destination rectangle height
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Performs the Composite operation set up by the last PrepareComposite()
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in the destination Pixmap. Note that if a transformation was set on
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the source or mask Pictures, the source rectangles may not be the same
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * size as the destination rectangles and filtering. Getting the coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * transformation right at the subpixel level can be tricky, and rendercheck
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * can test this for you.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call is required if PrepareComposite() ever succeeds.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*Composite) (PixmapPtr pDst,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int srcX,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int srcY,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int maskX,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int maskY, int dstX, int dstY, int width, int height);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DoneComposite() finishes a set of Composite operations.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPixmap destination pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The DoneComposite() call is called at the end of a series of consecutive
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Composite() calls following a successful PrepareComposite(). This allows
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * drivers to finish up emitting drawing commands that were buffered, or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * clean up state from PrepareComposite().
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This call is required if PrepareComposite() ever succeeds.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*DoneComposite) (PixmapPtr pDst);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * UploadToScreen() loads a rectangle of data from src into pDst.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pDst destination pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param x destination X coordinate.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param y destination Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param width width of the rectangle to be copied
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param height height of the rectangle to be copied
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param src pointer to the beginning of the source data
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param src_pitch pitch (in bytes) of the lines of source data.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * UploadToScreen() copies data in system memory beginning at src (with
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pitch src_pitch) into the destination pixmap from (x, y) to
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (x + width, y + height). This is typically done with hostdata uploads,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * where the CPU sets up a blit command on the hardware with instructions
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * that the blit data will be fed through some sort of aperture on the card.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If UploadToScreen() is performed asynchronously, it is up to the driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to call exaMarkSync(). This is in contrast to most other acceleration
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * calls in EXA.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * UploadToScreen() can aid in pixmap migration, but is most important for
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the performance of exaGlyphs() (antialiased font drawing) by allowing
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pipelining of data uploads, avoiding a sync of the card after each glyph.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @return TRUE if the driver successfully uploaded the data. FALSE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * indicates that EXA should fall back to doing the upload in software.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * UploadToScreen() is not required, but is recommended if Composite
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * acceleration is supported.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*UploadToScreen) (PixmapPtr pDst,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int x,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int y, int w, int h, char *src, int src_pitch);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * UploadToScratch() is no longer used and will be removed next time the EXA
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * major version needs to be bumped.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*UploadToScratch) (PixmapPtr pSrc, PixmapPtr pDst);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DownloadFromScreen() loads a rectangle of data from pSrc into dst
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pSrc source pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param x source X coordinate.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param y source Y coordinate
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param width width of the rectangle to be copied
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param height height of the rectangle to be copied
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dst pointer to the beginning of the destination data
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param dst_pitch pitch (in bytes) of the lines of destination data.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DownloadFromScreen() copies data from offscreen memory in pSrc from
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (x, y) to (x + width, y + height), to system memory starting at
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * dst (with pitch dst_pitch). This would usually be done
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * and then synchronously reading from AGP. Because the implementation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * might be synchronous, EXA leaves it up to the driver to call
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * contrast to most other acceleration calls in EXA.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DownloadFromScreen() can aid in the largest bottleneck in pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * migration, which is the read from framebuffer when evicting pixmaps from
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * framebuffer memory. Thus, it is highly recommended, even though
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * implementations are typically complicated.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @return TRUE if the driver successfully downloaded the data. FALSE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * indicates that EXA should fall back to doing the download in software.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DownloadFromScreen() is not required, but is highly recommended.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*DownloadFromScreen) (PixmapPtr pSrc,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int x, int y,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int w, int h, char *dst, int dst_pitch);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * MarkSync() requests that the driver mark a synchronization point,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * returning an driver-defined integer marker which could be requested for
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * synchronization to later in WaitMarker(). This might be used in the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * future to avoid waiting for full hardware stalls before accessing pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * data with the CPU, but is not important in the current incarnation of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Note that drivers should call exaMarkSync() when they have done some
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * acceleration, rather than their own MarkSync() handler, as otherwise EXA
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * will be unaware of the driver's acceleration and not sync to it during
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * fallbacks.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * MarkSync() is optional.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int (*MarkSync) (ScreenPtr pScreen);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * WaitMarker() waits for all rendering before the given marker to have
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * completed. If the driver does not implement MarkSync(), marker is
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * meaningless, and all rendering by the hardware should be completed before
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * WaitMarker() returns.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Note that drivers should call exaWaitSync() to wait for all acceleration
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to finish, as otherwise EXA will be unaware of the driver having
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * synchronized, resulting in excessive WaitMarker() calls.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * WaitMarker() is required of all drivers.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*WaitMarker) (ScreenPtr pScreen, int marker);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @{ */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareAccess() is called before CPU access to an offscreen pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPix the pixmap being accessed
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param index the index of the pixmap being accessed.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareAccess() will be called before CPU access to an offscreen pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This can be used to set up hardware surfaces for byteswapping or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * making CPU access use a different aperture.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * will have PrepareAccess() called on them per operation, drivers can have
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * a small, statically-allocated space to maintain state for PrepareAccess()
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * and FinishAccess() in. Note that PrepareAccess() is only called once per
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmap and operation, regardless of whether the pixmap is used as a
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * destination and/or source, and the index may not reflect the usage.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PrepareAccess() may fail. An example might be the case of hardware that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess()
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * fails, EXA will migrate the pixmap to system memory.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DownloadFromScreen() must be implemented and must not fail if a driver
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pPix is the visible screen, because the visible screen can not be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * migrated.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * drawing.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @return FALSE if PrepareAccess() is unsuccessful and EXA should use
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * DownloadFromScreen() to migate the pixmap out.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*PrepareAccess) (PixmapPtr pPix, int index);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * FinishAccess() is called after CPU access to an offscreen pixmap.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPix the pixmap being accessed
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param index the index of the pixmap being accessed.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * FinishAccess() will be called after finishing CPU access of an offscreen
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * called if PrepareAccess() failed and the pixmap was migrated out.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*FinishAccess) (PixmapPtr pPix, int index);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PixmapIsOffscreen() is an optional driver replacement to
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * of exaPixmapHasGpuCopy().
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @param pPix the pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @return TRUE if the given drawable is in framebuffer memory.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * memory, meaning that acceleration could probably be done to it, and that it
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * with the CPU.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*PixmapIsOffscreen) (PixmapPtr pPix);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @name PrepareAccess() and FinishAccess() indices
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @{
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * read from.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PREPARE_DEST 0
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_PREPARE_SRC is the index for a pixmap that may be read from
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PREPARE_SRC 1
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_PREPARE_SRC is the index for a second pixmap that may be read
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * from.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PREPARE_MASK 2
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_PREPARE_AUX* are additional indices for other purposes, e.g.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * separate alpha maps with Composite operations.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PREPARE_AUX_DEST 3
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PREPARE_AUX_SRC 4
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PREPARE_AUX_MASK 5
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_NUM_PREPARE_INDICES 6
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * maxPitchPixels controls the pitch limitation for rendering from
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the card.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The driver should never receive a request for rendering a pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * that has a pitch (in pixels) beyond maxPitchPixels.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Setting this field is optional -- if your hardware doesn't have
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * a pitch limitation in pixels, don't set this. If neither this value
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * nor maxPitchBytes is set, then maxPitchPixels is set to maxX.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If set, it must not be smaller than maxX.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @sa maxPitchBytes
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int maxPitchPixels;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * maxPitchBytes controls the pitch limitation for rendering from
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the card.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The driver should never receive a request for rendering a pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * that has a pitch (in bytes) beyond maxPitchBytes.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Setting this field is optional -- if your hardware doesn't have
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * a pitch limitation in bytes, don't set this.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If set, it must not be smaller than maxX * 4.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * There's no default value for maxPitchBytes.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @sa maxPitchPixels
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int maxPitchBytes;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /* Hooks to allow driver to its own pixmap memory management */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void *(*CreatePixmap) (ScreenPtr pScreen, int size, int align);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void (*DestroyPixmap) (ScreenPtr pScreen, void *driverPriv);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * not offscreen, which will never be accelerated and Prepare/FinishAccess won't
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * be called.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int depth, int bitsPerPixel, int devKind,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync pointer pPixData);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /* hooks for drivers with tiling support:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * driver MUST fill out new_fb_pitch with valid pitch of pixmap
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync void *(*CreatePixmap2) (ScreenPtr pScreen, int width, int height,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int depth, int usage_hint, int bitsPerPixel,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int *new_fb_pitch);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*SharePixmapBacking)(PixmapPtr pPixmap, ScreenPtr slave, void **handle_p);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool (*SetSharedPixmapBacking)(PixmapPtr pPixmap, void *handle);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync} ExaDriverRec, *ExaDriverPtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** @name EXA driver flags
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * @{
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * offscreen pixmaps.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to have a power-of-two pitch.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * support copies that are (left-to-right, top-to-bottom) or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (right-to-left, bottom-to-top).
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_TWO_BITBLT_DIRECTIONS (1 << 2)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * all pixmap addressing and migration.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_HANDLES_PIXMAPS (1 << 3)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * such hooks, this flag has no effect.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_SUPPORTS_PREPARE_AUX (1 << 4)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * can handle the source and destination occupying overlapping offscreen memory
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * areas. This allows the offscreen memory defragmentation code to defragment
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * areas where the defragmented position overlaps the fragmented position.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Typically this is supported by traditional 2D engines but not by 3D engines.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * problem known software fallbacks like trapezoids. This only migrates pixmaps one way
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * into a driver pixmap and then pins it.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_MIXED_PIXMAPS (1 << 6)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/** @} */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* in exa.c */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT ExaDriverPtr exaDriverAlloc(void);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaDriverFini(ScreenPtr pScreen);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaMarkSync(ScreenPtr pScreen);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaWaitSync(ScreenPtr pScreen);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT unsigned long
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaGetPixmapOffset(PixmapPtr pPix);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT unsigned long
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaGetPixmapPitch(PixmapPtr pPix);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT unsigned long
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaGetPixmapSize(PixmapPtr pPix);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void *exaGetPixmapDriverPrivate(PixmapPtr p);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* in exa_offscreen.c */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int size, int align,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Bool locked,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenSaveProc save,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync pointer privData);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenArea * area);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ExaOffscreenMarkUsed(PixmapPtr pPixmap);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaEnableDisableFBAccess(ScreenPtr pScreen, Bool enable);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaDrawableIsOffscreen(DrawablePtr pDrawable);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* in exa.c */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaMoveInPixmap(PixmapPtr pPixmap);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaMoveOutPixmap(PixmapPtr pPixmap);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* in exa_unaccel.c */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT CARD32
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync exaGetPixmapFirstPixel(PixmapPtr pPixmap);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Returns TRUE if the given planemask covers all the significant bits in the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * pixel values for pDrawable.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (((_pm) & FbFullMask((_pDrawable)->depth)) == \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync FbFullMask((_pDrawable)->depth))
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* EXA_H */