From 9a5da84da59e67816e154b95f2b5f2f6a07e8973 Mon Sep 17 00:00:00 2001 From: oga Date: Sat, 18 Jul 2009 15:02:51 +0000 Subject: [PATCH] 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@ --- driver/xf86-video-intel/uxa/uxa-render.c | 53 ++++++++++++++++++++---- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/driver/xf86-video-intel/uxa/uxa-render.c b/driver/xf86-video-intel/uxa/uxa-render.c index edbf0d8c4..057369d22 100644 --- a/driver/xf86-video-intel/uxa/uxa-render.c +++ b/driver/xf86-video-intel/uxa/uxa-render.c @@ -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,