diff --git a/exa/exa_render.c b/exa/exa_render.c index 2187af8..32e058a 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -335,6 +335,7 @@ exaTryDriverComposite(CARD8 op, PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; struct _Pixmap scratch; ExaMigrationRec pixmaps[3]; + Bool srcOK, maskOK; /* Bail if we might exceed coord limits by rendering from/to these. We * should really be making some scratch pixmaps with offsets and coords @@ -399,21 +400,48 @@ exaTryDriverComposite(CARD8 op, return 0; } - if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->UploadToScratch) { + /* + * One pixel repeat pixmaps are considered usable for the + * accelerator regardless of their current whereabouts. + * Currently only via/openChrome implements this optimzation? + */ + + srcOK = (pSrcPix || (pSrc->pDrawable->height == 1 && + pSrc->pDrawable->width == 1 && + pSrc->repeat)); + + maskOK = (!pMask || pMaskPix || ((pMask->pDrawable->height == 1) && + (pMask->pDrawable->width == 1) && + (pMask->repeat))); + + if (!srcOK && maskOK && pExaScr->info->UploadToScratch) { pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); - if ((*pExaScr->info->UploadToScratch) (pSrcPix, &scratch)) + if ((*pExaScr->info->UploadToScratch) (pSrcPix, &scratch)) { pSrcPix = &scratch; - } else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->UploadToScratch) { + srcOK = TRUE; + } else { + pSrcPix = NULL; + } + } else if (srcOK && !maskOK && pExaScr->info->UploadToScratch) { pMaskPix = exaGetDrawablePixmap (pMask->pDrawable); - if ((*pExaScr->info->UploadToScratch) (pMaskPix, &scratch)) + if ((*pExaScr->info->UploadToScratch) (pMaskPix, &scratch)) { pMaskPix = &scratch; + maskOK = TRUE; + } else { + pMaskPix = NULL; + } } - if (!pSrcPix || (pMask && !pMaskPix)) { + if (!srcOK || !maskOK) { REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return 0; } + if (!pMaskPix) + pMaskPix = exaGetDrawablePixmap (pMask->pDrawable); + if (!pSrcPix) + pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); + if (!(*pExaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix, pMaskPix, pDstPix)) {