Since we don't accelerate trapesoid rendering under uxa yet anyway
software rasterise them THEN put them into buffer objects. read-modify-write of graphics memory is expensive. 2.5x speed increase under heavy trap rendering measured. Another upstream backport. ok matthieu@
This commit is contained in:
parent
2b56f07bde
commit
9a5da84da5
@ -902,23 +902,62 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
|
||||
PicturePtr pPicture;
|
||||
INT16 xDst, yDst;
|
||||
INT16 xRel, yRel;
|
||||
int width, height, stride;
|
||||
PixmapPtr pPixmap;
|
||||
GCPtr pGC;
|
||||
pixman_image_t *image;
|
||||
|
||||
xDst = traps[0].left.p1.x >> 16;
|
||||
yDst = traps[0].left.p1.y >> 16;
|
||||
|
||||
width = bounds.x2 - bounds.x1;
|
||||
height = bounds.y2 - bounds.y1;
|
||||
stride = (width * BitsPerPixel (maskFormat->depth) + 7) / 8;
|
||||
|
||||
pPicture = uxa_create_alpha_picture (pScreen, pDst, maskFormat,
|
||||
bounds.x2 - bounds.x1,
|
||||
bounds.y2 - bounds.y1);
|
||||
width, height);
|
||||
if (!pPicture)
|
||||
return;
|
||||
|
||||
if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) {
|
||||
for (; ntrap; ntrap--, traps++)
|
||||
(*ps->RasterizeTrapezoid) (pPicture, traps,
|
||||
-bounds.x1, -bounds.y1);
|
||||
uxa_finish_access(pPicture->pDrawable);
|
||||
image = pixman_image_create_bits (pPicture->format,
|
||||
width, height,
|
||||
NULL, stride);
|
||||
if (!image) {
|
||||
FreePicture (pPicture, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
for (; ntrap; ntrap--, traps++)
|
||||
pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *) traps,
|
||||
-bounds.x1, -bounds.y1);
|
||||
|
||||
pPixmap = GetScratchPixmapHeader(pScreen, width, height,
|
||||
maskFormat->depth,
|
||||
BitsPerPixel (maskFormat->depth),
|
||||
PixmapBytePad (width, maskFormat->depth),
|
||||
pixman_image_get_data (image));
|
||||
if (!pPixmap) {
|
||||
FreePicture (pPicture, 0);
|
||||
pixman_image_unref (image);
|
||||
return;
|
||||
}
|
||||
|
||||
pGC = GetScratchGC (pPicture->pDrawable->depth, pScreen);
|
||||
if (!pGC)
|
||||
{
|
||||
FreeScratchPixmapHeader (pPixmap);
|
||||
pixman_image_unref (image);
|
||||
FreePicture (pPicture, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
(*pGC->ops->CopyArea) (&pPixmap->drawable, pPicture->pDrawable,
|
||||
pGC, 0, 0, width, height, 0, 0);
|
||||
|
||||
FreeScratchGC (pGC);
|
||||
FreeScratchPixmapHeader (pPixmap);
|
||||
pixman_image_unref (image);
|
||||
|
||||
xRel = bounds.x1 + xSrc - xDst;
|
||||
yRel = bounds.y1 + ySrc - yDst;
|
||||
CompositePicture (op, pSrc, pPicture, pDst,
|
||||
|
Loading…
Reference in New Issue
Block a user