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