From c085b091ec8604f6a6b43f3d6514ebe8b1393356 Mon Sep 17 00:00:00 2001 From: Thomas Hellström Date: Wed, 29 Oct 2008 11:11:18 +0000 Subject: Sw fallbacks for NPOT repeat composite operations --- src/via_accel.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/via_accel.c b/src/via_accel.c index 632991e..3095839 100644 --- a/src/via_accel.c +++ b/src/via_accel.c @@ -1112,6 +1112,13 @@ viaExaUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst) return FALSE; } +static Bool +viaIsPot(unsigned int val) +{ + return ((val & (val - 1)) == 0); +} + + static Bool viaExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) @@ -1138,6 +1145,19 @@ viaExaCheckComposite(int op, PicturePtr pSrcPicture, #endif return FALSE; } + + if (pSrcPicture->repeat && + (!viaIsPot(pSrcPicture->pDrawable->width) || + !viaIsPot(pSrcPicture->pDrawable->height))) + return FALSE; + + + if (pMaskPicture && pMaskPicture->repeat && + (!viaIsPot(pMaskPicture->pDrawable->width) || + !viaIsPot(pMaskPicture->pDrawable->height))) + return FALSE; + + if (pSrcPicture->transform || (pMaskPicture && pMaskPicture->transform)) { #ifdef VIA_DEBUG_COMPOSITE @@ -1214,10 +1234,10 @@ viaExaPrepareComposite(int op, PicturePtr pSrcPicture, v3d->setDestination(v3d, buf, delta, exaGetPixmapPitch(pDst), pDstPicture->format); v3d->setCompositeOperator(v3d, op); - v3d->setDrawing(v3d, 0x0c, 0xFFFFFFFF, 0x000000FF, 0xFF); - - viaOrder(pSrc->drawable.width, &width); - viaOrder(pSrc->drawable.height, &height); + v3d->setDrawing(v3d, 0x0c, 0xFFFFFFFF, 0x000000FF, 0xFF); + + viaOrder(pSrcPicture->pDrawable->width, &width); + viaOrder(pSrcPicture->pDrawable->height, &height); /* * For one-pixel repeat mask pictures we avoid using multitexturing by -- cgit v1.2.3