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