xserver/hw/xgl xglarea.c,1.1,1.2

David Reveman xserver-commit at pdx.freedesktop.org
Tue Mar 8 00:48:24 PST 2005


Committed by: davidr

Update of /cvs/xserver/xserver/hw/xgl
In directory gabe:/tmp/cvs-serv13762/hw/xgl

Modified Files:
	xglarea.c 
Log Message:
Improve Xgl offscreen memory manager

Index: xglarea.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglarea.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xglarea.c	26 Jan 2005 10:58:52 -0000	1.1
+++ xglarea.c	8 Mar 2005 08:48:22 -0000	1.2
@@ -40,7 +40,8 @@
 {
     (*pArea->pRoot->funcs->MoveOut) (pArea, pArea->closure);
 
-    pArea->state = xglAreaAvailable;
+    pArea->closure = (pointer) 0;
+    pArea->state   = xglAreaAvailable;
 }
 
 static xglAreaPtr
@@ -58,14 +59,14 @@
     if (!pArea)
 	return NULL;
 
-    pArea->level      = level;
-    pArea->x	      = x;
-    pArea->y	      = y;
-    pArea->width      = width;
-    pArea->height     = height;
-    pArea->pRoot      = pRoot;
-    pArea->closure    = (pointer) 0;
-    pArea->state      = xglAreaAvailable;
+    pArea->level   = level;
+    pArea->x	   = x;
+    pArea->y	   = y;
+    pArea->width   = width;
+    pArea->height  = height;
+    pArea->pRoot   = pRoot;
+    pArea->closure = (pointer) 0;
+    pArea->state   = xglAreaAvailable;
     
     while (n--)
 	pArea->pArea[n] = NULL;
@@ -108,34 +109,37 @@
 static xglAreaPtr
 xglAreaGetTopScoredSubArea (xglAreaPtr pArea)
 {
+    if (!pArea)
+	return NULL;
+		
     switch (pArea->state) {
     case xglAreaOccupied:
 	return pArea;
     case xglAreaAvailable:
 	break;
-    case xglAreaDivided:
-    {
+    case xglAreaDivided: {
 	xglAreaPtr tmp, top = NULL;
 	int	   i;
 	
 	for (i = 0; i < 4; i++)
 	{
-	    if (pArea->pArea[i])
+	    tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
+	    if (tmp && top)
 	    {
-		tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
-		if (!tmp)
-		    break;
-		    
-		if ((!top) ||
-		    (*pArea->pRoot->funcs->CompareScore) (tmp,
+		if ((*pArea->pRoot->funcs->CompareScore) (tmp,
 							  tmp->closure,
 							  top->closure) > 0)
 		    top = tmp;
 	    }
+	    else if (tmp)
+	    {
+		top = tmp;
+	    }
 	}
 	return top;
     }
     }
+    
     return NULL;
 }
 
@@ -254,7 +258,8 @@
 	    pArea->pArea[i] = NULL;
 	}
 	
-	pArea->state = xglAreaAvailable;
+	pArea->closure = (pointer) 0;
+	pArea->state   = xglAreaAvailable;
 	if (xglFindArea (pArea, width, height, TRUE, closure))
 	    return TRUE;
 	    



More information about the xserver-commit mailing list