diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-10-06 23:45:29 +0000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-10-06 23:45:29 +0000 |
commit | ff258ac2783203ed2a7698894d951391d1aecebc (patch) | |
tree | 8a35691b559db0f08bda3e444a7a49844889d552 | |
parent | e4ed43c3a6c248ba2b82b8bbf29da537a68407e6 (diff) |
Clients tend to set picture->repeat when not necessary. Most HW cannot
accelerate repeat NPOT thus triggering software fallback (this is the
case with gnome desktop for example). This adds a simple optimisation
to exa that removes "repeat" when it's obviously useless, that is, the
single picture instance covers the entire rectangle beeing used
-rw-r--r-- | exa/exa_render.c | 28 | ||||
-rw-r--r-- | hw/xfree86/exa/exa_render.c | 28 | ||||
-rw-r--r-- | hw/xfree86/exa/exapict.c | 28 |
3 files changed, 72 insertions, 12 deletions
diff --git a/exa/exa_render.c b/exa/exa_render.c index 24b59efac..380d5f232 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -453,6 +453,8 @@ exaComposite(CARD8 op, ExaScreenPriv (pDst->pDrawable->pScreen); int ret = -1; ScrnInfoPtr pScrn = XF86SCRNINFO(pDst->pDrawable->pScreen); + Bool saveSrcRepeat = pSrc->repeat; + Bool saveMaskRepeat = pMask ? pMask->repeat : 0; if (!pScrn->vtSema) { exaDrawableDirty(pDst->pDrawable); @@ -479,6 +481,12 @@ exaComposite(CARD8 op, break; } + /* Remove repeat in source if useless */ + if (pSrc->repeat && !pSrc->transform && xSrc >= 0 && + (xSrc + width) <= pSrc->pDrawable->width && ySrc >= 0 && + (ySrc + height) <= pSrc->pDrawable->height) + pSrc->repeat = 0; + if (!pMask && pSrc->pDrawable) { if (op == PictOpSrc) @@ -489,7 +497,7 @@ exaComposite(CARD8 op, ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height); if (ret == 1) - return; + goto bail; } else if (!pSrc->repeat && !pSrc->transform && pSrc->format == pDst->format) @@ -504,7 +512,7 @@ exaComposite(CARD8 op, if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) - return; + goto bail; exaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, NULL, @@ -512,11 +520,18 @@ exaComposite(CARD8 op, xSrc - xDst, ySrc - yDst, FALSE, FALSE, 0, NULL); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return; + goto bail; } } } + /* Remove repeat in mask if useless */ + if (pMask && pMask->repeat && !pMask->transform && xMask >= 0 && + (xMask + width) <= pMask->pDrawable->width && yMask >= 0 && + (yMask + height) <= pMask->pDrawable->height) + pMask->repeat = 0; + + if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && pExaScr->info->accel.PrepareComposite && !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) @@ -524,7 +539,7 @@ exaComposite(CARD8 op, ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); if (ret == 1) - return; + goto bail; } if (ret != 0) { @@ -543,6 +558,11 @@ exaComposite(CARD8 op, ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); + + bail: + pSrc->repeat = saveSrcRepeat; + if (pMask) + pMask->repeat = saveMaskRepeat; } #endif diff --git a/hw/xfree86/exa/exa_render.c b/hw/xfree86/exa/exa_render.c index 24b59efac..380d5f232 100644 --- a/hw/xfree86/exa/exa_render.c +++ b/hw/xfree86/exa/exa_render.c @@ -453,6 +453,8 @@ exaComposite(CARD8 op, ExaScreenPriv (pDst->pDrawable->pScreen); int ret = -1; ScrnInfoPtr pScrn = XF86SCRNINFO(pDst->pDrawable->pScreen); + Bool saveSrcRepeat = pSrc->repeat; + Bool saveMaskRepeat = pMask ? pMask->repeat : 0; if (!pScrn->vtSema) { exaDrawableDirty(pDst->pDrawable); @@ -479,6 +481,12 @@ exaComposite(CARD8 op, break; } + /* Remove repeat in source if useless */ + if (pSrc->repeat && !pSrc->transform && xSrc >= 0 && + (xSrc + width) <= pSrc->pDrawable->width && ySrc >= 0 && + (ySrc + height) <= pSrc->pDrawable->height) + pSrc->repeat = 0; + if (!pMask && pSrc->pDrawable) { if (op == PictOpSrc) @@ -489,7 +497,7 @@ exaComposite(CARD8 op, ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height); if (ret == 1) - return; + goto bail; } else if (!pSrc->repeat && !pSrc->transform && pSrc->format == pDst->format) @@ -504,7 +512,7 @@ exaComposite(CARD8 op, if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) - return; + goto bail; exaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, NULL, @@ -512,11 +520,18 @@ exaComposite(CARD8 op, xSrc - xDst, ySrc - yDst, FALSE, FALSE, 0, NULL); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return; + goto bail; } } } + /* Remove repeat in mask if useless */ + if (pMask && pMask->repeat && !pMask->transform && xMask >= 0 && + (xMask + width) <= pMask->pDrawable->width && yMask >= 0 && + (yMask + height) <= pMask->pDrawable->height) + pMask->repeat = 0; + + if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && pExaScr->info->accel.PrepareComposite && !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) @@ -524,7 +539,7 @@ exaComposite(CARD8 op, ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); if (ret == 1) - return; + goto bail; } if (ret != 0) { @@ -543,6 +558,11 @@ exaComposite(CARD8 op, ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); + + bail: + pSrc->repeat = saveSrcRepeat; + if (pMask) + pMask->repeat = saveMaskRepeat; } #endif diff --git a/hw/xfree86/exa/exapict.c b/hw/xfree86/exa/exapict.c index 24b59efac..380d5f232 100644 --- a/hw/xfree86/exa/exapict.c +++ b/hw/xfree86/exa/exapict.c @@ -453,6 +453,8 @@ exaComposite(CARD8 op, ExaScreenPriv (pDst->pDrawable->pScreen); int ret = -1; ScrnInfoPtr pScrn = XF86SCRNINFO(pDst->pDrawable->pScreen); + Bool saveSrcRepeat = pSrc->repeat; + Bool saveMaskRepeat = pMask ? pMask->repeat : 0; if (!pScrn->vtSema) { exaDrawableDirty(pDst->pDrawable); @@ -479,6 +481,12 @@ exaComposite(CARD8 op, break; } + /* Remove repeat in source if useless */ + if (pSrc->repeat && !pSrc->transform && xSrc >= 0 && + (xSrc + width) <= pSrc->pDrawable->width && ySrc >= 0 && + (ySrc + height) <= pSrc->pDrawable->height) + pSrc->repeat = 0; + if (!pMask && pSrc->pDrawable) { if (op == PictOpSrc) @@ -489,7 +497,7 @@ exaComposite(CARD8 op, ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height); if (ret == 1) - return; + goto bail; } else if (!pSrc->repeat && !pSrc->transform && pSrc->format == pDst->format) @@ -504,7 +512,7 @@ exaComposite(CARD8 op, if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) - return; + goto bail; exaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, NULL, @@ -512,11 +520,18 @@ exaComposite(CARD8 op, xSrc - xDst, ySrc - yDst, FALSE, FALSE, 0, NULL); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return; + goto bail; } } } + /* Remove repeat in mask if useless */ + if (pMask && pMask->repeat && !pMask->transform && xMask >= 0 && + (xMask + width) <= pMask->pDrawable->width && yMask >= 0 && + (yMask + height) <= pMask->pDrawable->height) + pMask->repeat = 0; + + if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && pExaScr->info->accel.PrepareComposite && !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) @@ -524,7 +539,7 @@ exaComposite(CARD8 op, ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); if (ret == 1) - return; + goto bail; } if (ret != 0) { @@ -543,6 +558,11 @@ exaComposite(CARD8 op, ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); + + bail: + pSrc->repeat = saveSrcRepeat; + if (pMask) + pMask->repeat = saveMaskRepeat; } #endif |