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

Maarten Maathuis madman2003 at gmail.com
Wed Dec 2 11:24:04 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           |    8 ++++++--
 exa/exa_migration_mixed.c |   19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 1d88acb..e17021e 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -508,9 +508,13 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 	 *
 	 * 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.
+	 * DownloadFromScreen later on. This applies only to the situation where
+	 * the driver prefers DFS, in that case PrepareAccess is failed.
+	 * In situations where a gpu pixmap is directly accessable, pDamage and
+	 * sys_ptr is NULL.
 	 */
-	} else if (!(pExaScr->info->flags & EXA_MIXED_PIXMAPS)) {
+	} else if (!(pExaScr->info->flags & EXA_MIXED_PIXMAPS) ||
+		!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 274fde3..5970de6 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -140,8 +140,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];
 
@@ -202,6 +203,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