[PATCH 2/2] exa/mixed: pixmaps that succeed prepare access have no need for a cpu copy

Maarten Maathuis madman2003 at gmail.com
Thu Dec 3 10:52:38 PST 2009


- When they have a gpu copy ofcource.
- Use the presence of a cpu copy as a hint to fall back instead of UTS'ing in
exaHWCopyNtoN.

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

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 1d88acb..0f6e5f7 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -506,11 +506,9 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 	    exaMarkSync (pDstDrawable->pScreen);
 	/* UTS: mainly for SHM PutImage's secondary path.
 	 *
-	 * Not taking this path for mixed pixmaps: It could only save one CPU
-	 * copy between cached memory and risks causing a more expensive
-	 * DownloadFromScreen later on.
+	 * Only taking this path for directly accessible pixmaps.
 	 */
-	} else if (!(pExaScr->info->flags & EXA_MIXED_PIXMAPS)) {
+	} else if (!pDstExaPixmap->pDamage) {
 	    int bpp = pSrcDrawable->bitsPerPixel;
 	    int src_stride = exaGetPixmapPitch(pSrcPixmap);
 	    CARD8 *src = NULL;
diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 9587ea2..b755b83 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -141,8 +141,9 @@ exaMoveInPixmap_mixed(PixmapPtr pPixmap)
 void
 exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 {
+    ExaPixmapPriv(pPixmap);
+
     if (!ExaDoPrepareAccess(pPixmap, index)) {
-	ExaPixmapPriv(pPixmap);
 	Bool has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
 	ExaMigrationRec pixmaps[1];
 
@@ -203,6 +204,22 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
 	pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
 	pPixmap->devKind = pExaPixmap->sys_pitch;
 	pExaPixmap->use_gpu_copy = FALSE;
+    /* We have a gpu pixmap that can be accessed, we don't need the cpu copy
+     * anymore. Drivers that prefer DFS, should fail prepare access. */
+    } else if (pExaPixmap->pDamage && exaPixmapHasGpuCopy(pPixmap)) {
+	ExaScreenPriv(pPixmap->drawable.pScreen);
+
+	/* Copy back any deferred content if needed. */
+	if (pExaScr->deferred_mixed_pixmap &&
+	    pExaScr->deferred_mixed_pixmap == pPixmap)
+	    exaMoveInPixmap_mixed(pPixmap);
+
+	DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+	DamageDestroy(pExaPixmap->pDamage);
+	pExaPixmap->pDamage = NULL;
+
+	free(pExaPixmap->sys_ptr);
+	pExaPixmap->sys_ptr = NULL;
     }
 }
 
-- 
1.6.5.3



More information about the xorg-devel mailing list