exa: fix performance regression from 736b6fbd2c

- The src optimisation is more aggressive and possibly harmful in light of the new initial state of pixmaps.
- There is now actually a performance improvement by almost always keeping the number of rects low.
This commit is contained in:
Maarten Maathuis 2009-02-16 17:17:14 +01:00
parent 6198373ff2
commit 46eeaf82e2
2 changed files with 12 additions and 10 deletions

View File

@ -285,6 +285,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
{ {
PixmapPtr pPixmap; PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap; ExaPixmapPrivPtr pExaPixmap;
BoxRec box;
int driver_alloc = 0; int driver_alloc = 0;
int bpp; int bpp;
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
@ -390,9 +391,17 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->area = NULL; pExaPixmap->area = NULL;
/* None of the pixmap bits are valid initially */ /* We set the initial pixmap as completely valid for a simple reason.
REGION_NULL(pScreen, &pExaPixmap->validSys); * Imagine a 1000x1000 pixmap, it has 1 million pixels, 250000 of which
REGION_NULL(pScreen, &pExaPixmap->validFB); * could form single pixel rects as part of a region. Setting the complete region
* as valid is a natural defragmentation of the region.
*/
box.x1 = 0;
box.y1 = 0;
box.x2 = w;
box.y2 = h;
REGION_INIT(pScreen, &pExaPixmap->validSys, &box, 0);
REGION_INIT(pScreen, &pExaPixmap->validFB, &box, 0);
exaSetAccelBlock(pExaScr, pExaPixmap, exaSetAccelBlock(pExaScr, pExaPixmap,
w, h, bpp); w, h, bpp);

View File

@ -257,13 +257,6 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
pExaPixmap->offscreen = save_offscreen; pExaPixmap->offscreen = save_offscreen;
pPixmap->devKind = save_pitch; pPixmap->devKind = save_pitch;
/* Try to prevent source valid region from growing too many rects by
* removing parts of it which are also in the destination valid region.
* Removing anything beyond that would lead to data loss.
*/
if (REGION_NUM_RECTS(pValidSrc) > 10)
REGION_SUBTRACT(pScreen, pValidSrc, pValidSrc, pValidDst);
/* The copied bits are now valid in destination */ /* The copied bits are now valid in destination */
REGION_UNION(pScreen, pValidDst, pValidDst, &CopyReg); REGION_UNION(pScreen, pValidDst, pValidDst, &CopyReg);