[PATCH 2/3] EXA: Don't defragment offscreen memory at allocation time.

Michel Dänzer michel at daenzer.net
Mon Nov 30 04:17:52 PST 2009


From: Michel Dänzer <daenzer at vmware.com>

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=24300 .

Offscreen memory allocation can occur from various places, and apparently
doing defragmentation from at least some of them can confuse some driver
acceleration code.

There's still the regular background defragmentation in the WakeupHandler,
which should manage to keep fragmentation at a reasonable level.

Signed-off-by: Michel Dänzer <daenzer at vmware.com>
---
 exa/exa_offscreen.c |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index acdf439..e3a9ab2 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -169,7 +169,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
 {
     ExaOffscreenArea *area;
     ExaScreenPriv (pScreen);
-    int real_size = 0, free_total = 0, largest_avail = 0;
+    int real_size = 0, largest_avail = 0;
 #if DEBUG_OFFSCREEN
     static int number = 0;
     ErrorF("================= ============ allocating a new pixmap %d\n", ++number);
@@ -208,33 +208,10 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
 	if (real_size <= area->size)
 	    break;
 
-	free_total += area->size;
-
 	if (area->size > largest_avail)
 	    largest_avail = area->size;
     }
 
-    if (!area && free_total >= size) {
-	CARD32 now = GetTimeInMillis();
-
-	/* Don't defragment more than once per second, to avoid adding more
-	 * overhead than we're trying to prevent
-	 */
-	if (abs((INT32) (now - pExaScr->lastDefragment)) > 1000) {
-	    area = ExaOffscreenDefragment(pScreen);
-	    pExaScr->lastDefragment = now;
-
-	    if (area) {
-		/* adjust size to match alignment requirement */
-		real_size = size + (area->base_offset + area->size - size) % align;
-
-		/* does it fit? */
-		if (real_size > area->size)
-		    area = NULL;
-	    }
-	}
-    }
-
     if (!area)
     {
 	area = exaFindAreaToEvict(pExaScr, size, align);
-- 
1.6.5.3



More information about the xorg-devel mailing list