[PATCH] exa: fix performance regression from 736b6fbd2c941b6276066cd1503523edebe7bf3d

Maarten Maathuis madman2003 at gmail.com
Mon Feb 16 08:20:16 PST 2009


- 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.
---
 exa/exa.c           |   15 ++++++++++++---
 exa/exa_migration.c |    7 -------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/exa/exa.c b/exa/exa.c
index a770332..09b2943 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -285,6 +285,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
 {
     PixmapPtr		pPixmap;
     ExaPixmapPrivPtr	pExaPixmap;
+    BoxRec box;
     int                 driver_alloc = 0;
     int			bpp;
     ExaScreenPriv(pScreen);
@@ -390,9 +391,17 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
 
     pExaPixmap->area = NULL;
 
-    /* None of the pixmap bits are valid initially */
-    REGION_NULL(pScreen, &pExaPixmap->validSys);
-    REGION_NULL(pScreen, &pExaPixmap->validFB);
+    /* We set the initial pixmap as completely valid for a simple reason.
+     * Imagine a 1000x1000 pixmap, it has 1 million pixels, 250000 of which
+     * could form single pixel rects as part of a region. Setting the complete region
+     * as valid is a natural defragmention 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,
                      w, h, bpp);
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 861ff23..59db25b 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -257,13 +257,6 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
     pExaPixmap->offscreen = save_offscreen;
     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 */
     REGION_UNION(pScreen, pValidDst, pValidDst, &CopyReg);
 
-- 
1.6.1.3



More information about the xorg-devel mailing list