diff options
author | Thomas Hellström <thomas@shipmail.org> | 2008-10-29 11:11:18 +0000 |
---|---|---|
committer | Thomas Hellström <thomas@shipmail.org> | 2008-10-29 11:11:18 +0000 |
commit | c085b091ec8604f6a6b43f3d6514ebe8b1393356 (patch) | |
tree | c91e3da2a6f1efe837be512d9cceecd20f118092 | |
parent | e95448318869323a82e31327e5f1c946ba13f703 (diff) |
Sw fallbacks for NPOT repeat composite operations
-rw-r--r-- | src/via_accel.c | 28 |
1 files 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 @@ -1113,6 +1113,13 @@ viaExaUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst) } 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 |