[PATCH] exa/mixed: Partially restore deferred pixmap handling for frontbuffer.

Maarten Maathuis madman2003 at gmail.com
Wed Feb 9 12:09:30 PST 2011


- It turns out that part of the problem was actually on the driver side.
- The performance loss is not worth the small visual improvement.
- This should ensure low latency at low throughput.
- Performance loss seems less than 10% instead of the previous 33%.

Signed-off-by: Maarten Maathuis <madman2003 at gmail.com>
---
 exa/exa_migration_mixed.c |   24 +++++++++++++++++++-----
 exa/exa_priv.h            |    1 +
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 4f49905..08839a3 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -150,12 +150,26 @@ exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
     if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) {
 	ExaScreenPriv(pPixmap->drawable.pScreen);
 
-	/* Front buffer: Don't wait for the block handler to copy back the data.
-	 * This avoids annoying latency if you encounter a lot of software rendering.
+	/* Front buffer: Don't wait for the block handler to copy back the data, unless
+	 * it has been moved back in the last 50 ms. This avoids high latency when
+	 * the xserver is busy, while maintaining a decent troughput.
 	 */
-	if (pPixmap == pScreen->GetScreenPixmap(pScreen))
-		exaMoveInPixmap_mixed(pPixmap);
-	else {
+	if (pPixmap == pScreen->GetScreenPixmap(pScreen)) {
+		CARD32 now = GetTimeInMillis();
+		if ((now - pExaScr->last_time_front_mixed_pixmap) > 50) {
+			pExaScr->last_time_front_mixed_pixmap = now;
+			exaMoveInPixmap_mixed(pPixmap);
+
+			if (pExaScr->deferred_mixed_pixmap == pPixmap)
+				pExaScr->deferred_mixed_pixmap = NULL;
+		} else {
+			if (pExaScr->deferred_mixed_pixmap &&
+			    pExaScr->deferred_mixed_pixmap != pPixmap)
+			    exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
+
+			pExaScr->deferred_mixed_pixmap = pPixmap;
+		}
+	} else {
 		if (pExaScr->deferred_mixed_pixmap &&
 		    pExaScr->deferred_mixed_pixmap != pPixmap)
 		    exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index e5d90d4..cb58a02 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -185,6 +185,7 @@ typedef struct {
     CARD32			 lastDefragment;
     CARD32			 nextDefragment;
     PixmapPtr			 deferred_mixed_pixmap;
+    CARD32			 last_time_front_mixed_pixmap;
 
     /* Reference counting for accessed pixmaps */
     struct {
-- 
1.7.4



More information about the xorg-devel mailing list