xserver/hw/kdrive/src kaa.c, 1.26, 1.27 kdrive.h, 1.52, 1.53 koffscreen.c, 1.14, 1.15

Keith Packard xserver-commit at pdx.freedesktop.org
Wed May 19 19:42:22 PDT 2004


Committed by: keithp

Update of /cvs/xserver/xserver/hw/kdrive/src
In directory pdx:/tmp/cvs-serv14268/hw/kdrive/src

Modified Files:
	kaa.c kdrive.h koffscreen.c 
Log Message:
2004-05-19  Keith Packard  <keithp at keithp.com>

	* hw/kdrive/src/kaa.c: (kaaPixmapUseScreen), (kaaPixmapUseMemory),
	(kaaCreatePixmap):
	Pin header-only pixmaps in memory.
	
	* hw/kdrive/src/kdrive.h:
	* hw/kdrive/src/koffscreen.c: (KdOffscreenKickOut),
	(KdOffscreenAlloc), (KdOffscreenSwapOut), (KdOffscreenFree):
	Off-screen reallocation could have used a stale pointer.

	* hw/kdrive/vesa/vesa.c: (vesaScreenInitialize),
	(vesaComputeFramebufferMapping), (vesaMapFramebuffer),
	(vesaUnmapFramebuffer), (vesaRandRSetConfig), (vesaEnable):
	* hw/kdrive/vesa/vesa.h:
	Separate framebuffer mapping computation from actual
	frame buffer mapping.  Now map the frame buffer from
	vesaEnable so that VT switch shares the same
	mapping code.  This makes sure any shadow framebuffer
	is allocated again.


Index: kaa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- a/kaa.c	17 May 2004 07:19:48 -0000	1.26
+++ b/kaa.c	20 May 2004 02:42:19 -0000	1.27
@@ -51,8 +51,10 @@
 
 #define KAA_PIXMAP_SCORE_MOVE_IN    10
 #define KAA_PIXMAP_SCORE_MAX	    20
+#define KAA_PIXMAP_SCORE_INIT	    0
 #define KAA_PIXMAP_SCORE_MOVE_OUT   -10
 #define KAA_PIXMAP_SCORE_MIN	    -20
+#define KAA_PIXMAP_SCORE_PINNED	    1000
 
 #define MIN_OFFPIX_SIZE		(4096)
 
@@ -212,6 +214,9 @@
 {
     KaaPixmapPriv (pPixmap);
 
+    if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
+	return;
+
     if (pKaaPixmap->score < KAA_PIXMAP_SCORE_MAX)
     {
 	pKaaPixmap->score++;
@@ -226,6 +231,9 @@
 {
     KaaPixmapPriv (pPixmap);
 
+    if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
+	return;
+
     if (pKaaPixmap->score > KAA_PIXMAP_SCORE_MIN)
     {
 	pKaaPixmap->score--;
@@ -282,10 +290,15 @@
     if (!pPixmap)
 	return NULL;
     pKaaPixmap = KaaGetPixmapPriv(pPixmap);
-    pKaaPixmap->score = 0;
+    if (!w || !h)
+	pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED;
+    else
+	pKaaPixmap->score = KAA_PIXMAP_SCORE_INIT;
+    
     pKaaPixmap->area = NULL;
     
-    if ((pPixmap->devKind * h) >= MIN_OFFPIX_SIZE)
+    if (pKaaPixmap->score != KAA_PIXMAP_SCORE_PINNED &&
+	(pPixmap->devKind * h) >= MIN_OFFPIX_SIZE)
 	kaaPixmapAllocArea (pPixmap);
     return pPixmap;
 }

Index: kdrive.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kdrive.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- a/kdrive.h	17 May 2004 07:14:23 -0000	1.52
+++ b/kdrive.h	20 May 2004 02:42:19 -0000	1.53
@@ -882,7 +882,7 @@
 		  KdOffscreenSaveProc save,
 		  pointer privData);
 
-void
+KdOffscreenArea *
 KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area);
 
 void

Index: koffscreen.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/koffscreen.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- a/koffscreen.c	3 Jan 2004 11:17:44 -0000	1.14
+++ b/koffscreen.c	20 May 2004 02:42:19 -0000	1.15
@@ -55,12 +55,12 @@
 #define KdOffscreenValidate(s)
 #endif
 
-static void
+static KdOffscreenArea *
 KdOffscreenKickOut (ScreenPtr pScreen, KdOffscreenArea *area)
 {
     if (area->save)
 	(*area->save) (pScreen, area);
-    KdOffscreenFree (pScreen, area);
+    return KdOffscreenFree (pScreen, area);
 }
 
 KdOffscreenArea *
@@ -161,14 +161,14 @@
 	 * Kick out first area if in use
 	 */
 	if (area->state != KdOffscreenAvail)
-	    KdOffscreenKickOut (pScreen, area);
+	    area = KdOffscreenKickOut (pScreen, area);
 	/*
 	 * Now get the system to merge the other needed areas together
 	 */
 	while (area->size < real_size)
 	{
 	    assert (area->next && area->next->state == KdOffscreenRemovable);
-	    KdOffscreenKickOut (pScreen, area->next);
+	    (void) KdOffscreenKickOut (pScreen, area->next);
 	}
     }
     
@@ -225,7 +225,7 @@
 		break;
 	}
 	assert (area->state != KdOffscreenAvail);
-	KdOffscreenKickOut (pScreen, area);
+	(void) KdOffscreenKickOut (pScreen, area);
 	KdOffscreenValidate (pScreen);
     }    
     KdOffscreenValidate (pScreen);
@@ -251,7 +251,7 @@
     xfree (next);
 }
 
-void
+KdOffscreenArea *
 KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area)
 {
     KdScreenPriv(pScreen);
@@ -281,9 +281,13 @@
     
     /* link with prev area if free */
     if (prev && prev->state == KdOffscreenAvail)
-	KdOffscreenMerge (prev);
+    {
+	area = prev;
+	KdOffscreenMerge (area);
+    }
 
     KdOffscreenValidate (pScreen);
+    return area;
 }
 
 Bool




More information about the xserver-commit mailing list