[PATCH] EXA: Defragment offscreen memory.

Michel Dänzer michel at daenzer.net
Sat Feb 14 09:38:13 PST 2009


On Sat, 2009-02-14 at 17:42 +0100, Maarten Maathuis wrote:
> You're assuming PrepareCopy succeeds, you need to add a memcpy path.

I think that would be pointless. How about the below on top instead?


diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index d3e015f..8546dc2 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -591,7 +591,18 @@ ExaOffscreenDefragment (ScreenPtr pScreen)
 	pDstPix->drawable.depth = pSrcPix->drawable.depth;
 	pDstPix->drawable.bitsPerPixel = pSrcPix->drawable.bitsPerPixel;
 
-	pExaScr->info->PrepareCopy (pSrcPix, pDstPix, -1, -1, GXcopy, ~0);
+	if (!pExaScr->info->PrepareCopy (pSrcPix, pDstPix, -1, -1, GXcopy, ~0)) {
+	    /* If we can't move the area, just kick it out - apparently it's
+	     * not usable even for trivial acceleration anyway
+	     */
+	    pExaSrcPix->offscreen = save_offscreen;
+	    pSrcPix->devKind = save_pitch;
+
+	    area = ExaOffscreenKickOut(pScreen, area);
+
+	    continue;
+	}
+
 	pExaScr->info->Copy (pDstPix, 0, 0, 0, 0, pDstPix->drawable.width,
 			     pDstPix->drawable.height);
 	pExaScr->info->DoneCopy (pDstPix);


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-devel mailing list