This is a discussion on an XAA replacement. A start at a "Shiny" API. feel free to comment and add, discuss, change, etc.
The Shiny layer aims to replace XAA, in the absence of a full OpenGL driver capable of Xegl, and in the meantime while Xegl isn't ready. The aim is to allow efficient implementation of drivers like KAA does, without the overhead of the complicated core rendering (lines, stipples, etc) that is rarely used on modern systems.
Remaining to be dealt with in this description:
XV? XV likely requires a few hooks from Shiny for the driver to use, but no implementation in the ShinyDriver interface.
- Primitives? (lines, polygons etc.) does x really have to always reduce them to scanline lists? Answer: lines are not worth accelerating in a modern desktop, and similarly polygons (point to one, right now!). It doesn't appear to be possible to accelerate the trapezoid rasterization necessary for cairo while implementing the Render spec.
Differences between this interface and current KAA:
- KAA lacks versioning, due to the AA being built into each driver.
KAA lacks DownloadFromScreen
The KAA UploadToScreen is different and simpler.
- KAA still has the Trapezoids interface that never worked.
KAA still has the Blend interface which ended up not being useful after CheckComposite was added.
- KAA has the init/enable/disable/fini hooks in the screen private rather than the AA info struct.
- KAA is unaware of coordinate limitations.
/* Shiny proposed API snippets */
typedef struct _ShinyDriver ShinyDriver;
struct _ShinyDriver
{
int ver_major; /* 1 */
int ver_minor; /* 0 */
/* Whether pixmap areas in framebuffer must be power-of-two pitch to accelerate. */
Bool requires_pot;
/* Minimum power-of-two alignment of pitch and offset from beginning of framebuffer. */
int pitchAlign;
int offsetAlign;
/* The coordinate limitations for rendering for this hardware.
* Shiny should break larger pixmaps into smaller pieces and call Prepare multiple times
* to handle larger pixmaps
*/
int max_x;
int max_y;
Bool (*initAccel) (ScreenPtr); /* Acceleration initialization on server startup. False to fall back entirely */
void (*enableAccel) (ScreenPtr); /* Called on VT switch in. Must not fail. */
void (*disableAccel) (ScreenPtr); /* Called on VT switch out. */
void (*finiAccel) (ScreenPtr); /* Clean up acceleration on shutdown */
/* markSync, if set, returns an integer marker representing the
* current position in the command stream. It may be NULL, in which
* case waitSync needs to idle the hardware on any marker passed.
*/
int (*markSync) (ScreenPtr);
/* waitSync ensures that the hardware has completed past the given marker. */
void (*waitSync) (ScreenPtr, int mark);
/* PrepareSolid may fail if the pixmaps can't accelerated to/from.
* This is an important feature for handling strange corner cases
* in hardware that are poorly expressed through flags.
*/
Bool (*PrepareSolid) (PixmapPtr pPixmap,
int alu,
Pixel planemask,
Pixel fg);
void (*Solid) (int x1, int y1, int x2, int y2);
void (*DoneSolid) (void);
/* PrepareSolid may fail if the pixmaps can't accelerated to/from.
* This is an important feature for handling strange corner cases
* in hardware that are poorly expressed through flags.
*/
Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
PixmapPtr pDstPixmap,
Bool upsidedown,
Bool reverse,
int alu,
Pixel planemask);
void (*Copy) (int srcX,
int srcY,
int dstX,
int dstY,
int width,
int height);
void (*DoneCopy) (void);
/* The Composite hooks are a wrapper around the Composite operation. The CheckComposite
* occurs before pixmap migration occurs, and may fail for many hardware-dependent reasons.
* PrepareComposite the should not fail, and the Bool return may not be necessary if we can
* adequately represent pixmap location/pitch limitations (this seems reasonable).
*/
Bool (*CheckComposite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture);
Bool (*PrepareComposite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture,
PixmapPtr pSrc,
PixmapPtr pMask,
PixmapPtr pDst);
void (*Composite) (int srcX,
int srcY,
int maskX,
int maskY,
int dstX,
int dstY,
int width,
int height);
void (*DoneComposite) (void);
/* Attempt to upload the data from src into the rectangle of the
* in-framebuffer pDst beginning at x,y and of width w,h. May fail.
*/
Bool (*UploadToScreen)(PixmapPtr pDst,
int x, int y,
int w, int h,
char *src, int src_pitch);
/* Attempt to download the rectangle from the in-framebuffer pSrc into
* dst, given the pitch. May fail. Since it is likely
* accelerated, a markSync will follow it as with other acceleration
* hooks.
*/
Bool (*DownloadFromScreen)(PixmapPtr pSrc,
int x, int y,
int w, int h,
char *dst, int dst_pitch);
};

