[xserver-commit] xserver/hw/kdrive/fbdev Makefile.am,1.6,1.6.2.1 fbdev.c,1.37,1.37.2.1 fbdev.h,1.14,1.14.2.1

Keith Packard xserver-commit@pdx.freedesktop.org
Tue, 21 Oct 2003 23:00:51 -0700


Committed by: keithp

Update of /cvs/xserver/xserver/hw/kdrive/fbdev
In directory pdx:/tmp/cvs-serv16351/hw/kdrive/fbdev

Modified Files:
      Tag: xfixes_2_branch
	Makefile.am fbdev.c fbdev.h 
Log Message:
	* configure.ac:
	Build damage infrastructure.  Don't build layer
	
	* fb/fbcopy.c: (fbCopyNtoN), (fbCopyArea):
	Move check for 24/32 copy to fbCopyNtoN so that other users will hit
	it
	
	* hw/kdrive/fbdev/Makefile.am:
	* hw/kdrive/fbdev/fbdev.c: (fbdevScreenInitialize),
	(fbdevGetPixmap), (fbdevPixmapSet), (fbdevRandRSetConfig),
	(fbdevInitScreen), (fbdevFinishInitScreen):
	* hw/kdrive/fbdev/fbdev.h:
	Eliminate miext/layer
	
	* hw/kdrive/linux/Makefile.am:
	Build damage infrastructure.  Don't build layer
	
	* hw/kdrive/mach64/Makefile.am:
	Build damage infrastructure.  Don't build layer
	
	* hw/kdrive/mach64/mach64.c: (mach64ScreenInit),
	(mach64InitScreen), (mach64ScreenFini), (mach64CardFini):
	* hw/kdrive/mach64/mach64.h:
	* hw/kdrive/mach64/mach64draw.c: (mach64DrawFini):
	* hw/kdrive/mach64/mach64video.c: (mach64InitVideo),
	(mach64FiniVideo):
	Memory leak fix of mach64c on server reset
	Memory leak fix for video on server reset.
	Eliminate layer
	
	* hw/kdrive/mga/Makefile.am:
	* hw/kdrive/mga/mga.c: (mgaScreenInit):
	Build damage infrastructure.  Don't build layer
	
	* hw/kdrive/nvidia/Makefile.am:
	* hw/kdrive/nvidia/nvidia.c: (nvidiaRandRSetConfig),
	(nvidiaPreserve), (nvidiaEnable):
	Build damage infrastructure.  Don't build layer
	
	* hw/kdrive/r128/Makefile.am:
	* hw/kdrive/smi/Makefile.am:
	Build damage infrastructure.  Don't build layer
	
	* hw/kdrive/src/Makefile.am:
	Build damage infrastructure.  Don't build layer
	
	* hw/kdrive/src/kaa.c: (kaaDestroyPixmap), (kaaCreatePixmap),
	(kaaPixmapIsOffscreen), (kaaGetOffscreenPixmap),
	(kaaDrawableIsOffscreen), (kaaFillSpans), (kaaCopyNtoN),
	(kaaPolyFillRect), (kaaSolidBoxClipped), (kaaValidateGC),
	(kaaFillRegionSolid), (kaaDrawInit), (kaaDrawFini):
	Don't assume windows are onscreen, use GetWindowPixmap
	and test devPrivate.ptr.  Make sure depth 24 pixmaps are 24bpp
	when hardware format is 24bpp.
	
	* hw/kdrive/src/kasync.c:
	Get rid of debug KdAssertSync function
	
	* hw/kdrive/src/kdrive.c: (KdCloseScreen), (KdScreenInit):
	* hw/kdrive/src/kdrive.h:
	* hw/kdrive/src/koffscreen.c: (KdOffscreenValidate),
	(KdOffscreenAlloc), (KdOffscreenInit):
	add memory_size to KdScreenInfo, eliminate off_screen_size,
	fix tests to suit.
	
	* hw/kdrive/vesa/Makefile.am:
	* hw/kdrive/vesa/vesa.c: (vesaScreenInitialize), (vesaUpdateMono),
	(vesaGetPixmap), (vesaMapFramebuffer), (vesaPixmapSet),
	(vesaRandRSetConfig), (vesaInitScreen), (vesaFinishInitScreen),
	(vesaScreenFini):
	* hw/kdrive/vesa/vesa.h:
	Build damage infrastructure.  Don't build layer
	
	* hw/xnest/Makefile.am:
	Use damage (for software cursor, I guess)

	* mi/Makefile.am:
	* mi/misprite.c: (miSpriteReportDamage), (miSpriteCopyWindow):
	* mi/mispritest.h:
	Damage is used for software cursor

	* miext/Makefile.am:
	* miext/layer/Makefile.am:
	* miext/layer/layerinit.c: (layerCloseScreen):
	Build damage infrastructure.  Don't build layer
	
	* miext/shadow/Makefile.am:
	* miext/shadow/shadow.c: (shadowRedisplay), (shadowGetImage),
	(shadowCloseScreen), (shadowSetup), (shadowSet), (shadowUnset),
	(shadowInit):
	* miext/shadow/shadow.h:
	* miext/shadow/shpacked.c: (shadowUpdatePacked):
	* miext/shadow/shplanar.c: (shadowUpdatePlanar4):
	* miext/shadow/shplanar8.c: (shadowUpdatePlanar4x8):
	* miext/shadow/shrotate.c: (shadowUpdateRotatePacked):
	* miext/shadow/shrotpack.h:
	Use damage to track changes

	* xfixes/xfixes.c: (XFixesResetProc):
	Fix memory leak


Index: Makefile.am
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/fbdev/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -d -r1.6 -r1.6.2.1
--- Makefile.am	15 Oct 2003 04:59:45 -0000	1.6
+++ Makefile.am	22 Oct 2003 06:00:49 -0000	1.6.2.1
@@ -2,7 +2,7 @@
 	-I$(top_srcdir)/fb			\
 	-I$(top_srcdir)/hw/kdrive/src		\
 	-I$(top_srcdir)/mi			\
-	-I$(top_srcdir)/miext/layer		\
+	-I$(top_srcdir)/miext/damage		\
 	-I$(top_srcdir)/miext/shadow		\
 	-I$(top_srcdir)/randr			\
 	-I$(top_srcdir)/render			\
@@ -22,10 +22,10 @@
 	libfbdev.a					\
 	$(top_builddir)/dix/libdix.a			\
 	$(top_builddir)/os/libos.a			\
-	$(top_builddir)/miext/layer/liblayer.a		\
 	$(top_builddir)/hw/kdrive/src/libkdrive.a  	\
 	$(top_builddir)/hw/kdrive/linux/liblinux.a  	\
 	$(top_builddir)/miext/shadow/libshadow.a 	\
+	$(top_builddir)/miext/damage/libdamage.a 	\
 	$(top_builddir)/randr/librandr.a		\
 	$(top_builddir)/render/librender.a		\
 	$(top_builddir)/xfixes/libxfixes.a		\

Index: fbdev.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/fbdev/fbdev.c,v
retrieving revision 1.37
retrieving revision 1.37.2.1
diff -u -d -r1.37 -r1.37.2.1
--- fbdev.c	14 Oct 2003 05:04:22 -0000	1.37
+++ fbdev.c	22 Oct 2003 06:00:49 -0000	1.37.2.1
@@ -190,7 +190,6 @@
     }
     screen->rate = 72;
     scrpriv->randr = screen->randr;
-    scrpriv->layerKind = LAYER_FB;
     
 #ifdef FAKE24_ON_16
     if (screen->fb[0].depth == 24 && screen->fb[0].bitsPerPixel == 24 &&
@@ -380,16 +379,15 @@
     KdSetMouseMatrix (&m);
 }
 
-LayerPtr
-fbdevLayerCreate (ScreenPtr pScreen)
+PixmapPtr
+fbdevGetPixmap (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
     KdScreenInfo	*screen = pScreenPriv->screen;
     FbdevScrPriv	*scrpriv = screen->driver;
     ShadowUpdateProc	update;
     ShadowWindowProc	window;
-    PixmapPtr		pPixmap;
-    int			kind;
+    PixmapPtr		pShadow, pPixmap;
 
     if (scrpriv->shadow)
     {
@@ -408,21 +406,26 @@
 	    else
 		update = shadowUpdatePacked;
 	}
-	if (!update)
-	    abort ();
-	kind = LAYER_SHADOW;
-	pPixmap = 0;
+	pPixmap = (*pScreen->CreatePixmap) (pScreen,
+					    pScreen->width,
+					    pScreen->height,
+					    screen->fb[0].depth);
+	if (!pPixmap)
+	    return FALSE;
+	shadowSet (pScreen, pPixmap, update, window, scrpriv->randr, 0);
+	pShadow = pPixmap;
     }
     else
     {
-	kind = scrpriv->layerKind;
-	pPixmap = LAYER_SCREEN_PIXMAP;
-	update = 0;
-	window = 0;
+	pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+	pShadow = 0;
     }
     
-    return LayerCreate (pScreen, kind, screen->fb[0].depth, 
-			pPixmap, update, window, scrpriv->randr, 0);
+    if (scrpriv->pShadow)
+        (*pScreen->DestroyPixmap) (scrpriv->pShadow);
+    scrpriv->pShadow = pShadow;
+
+    return pPixmap;
 }
 
 
@@ -459,25 +462,12 @@
 }
 
 int
-fbdevLayerAdd (WindowPtr pWin, pointer value)
-{
-    ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    LayerPtr	    pLayer = (LayerPtr) value;
-
-    if (!LayerWindowAdd (pScreen, pLayer, pWin))
-	return WT_STOPWALKING;
-
-    return WT_WALKCHILDREN;
-}
-
-int
-fbdevLayerRemove (WindowPtr pWin, pointer value)
+fbdevPixmapSet (WindowPtr pWin, pointer value)
 {
     ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    LayerPtr	    pLayer = (LayerPtr) value;
-
-    LayerWindowRemove (pScreen, pLayer, pWin);
+    PixmapPtr	    pPixmap = value;
 
+    (*pScreen->SetWindowPixmap) (pWin, pPixmap);
     return WT_WALKCHILDREN;
 }
 
@@ -496,8 +486,8 @@
     int			oldheight;
     int			oldmmwidth;
     int			oldmmheight;
-    LayerPtr		pNewLayer;
     int			newwidth, newheight;
+    PixmapPtr		pPixmap;
 
     if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
     {
@@ -528,26 +518,21 @@
 
     fbdevConfigureScreen (pScreen);
 
-    pNewLayer = fbdevLayerCreate (pScreen);
-    if (!pNewLayer)
+    /*
+     * Get the pixmap that windows live in
+     */
+    pPixmap = fbdevGetPixmap (pScreen);
+    if (!pPixmap)
 	goto bail4;
-    if (WalkTree (pScreen, fbdevLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING)
-	goto bail5;
-
-    WalkTree (pScreen, fbdevLayerRemove, (pointer) scrpriv->pLayer);
-    LayerDestroy (pScreen, scrpriv->pLayer);
-
-    scrpriv->pLayer = pNewLayer;
 
+    WalkTree (pScreen, fbdevPixmapSet, (pointer) pPixmap);
+    
     KdSetSubpixelOrder (pScreen, scrpriv->randr);
     if (wasEnabled)
 	KdEnableScreen (pScreen);
 
     return TRUE;
 
-bail5:
-    WalkTree (pScreen, fbdevLayerRemove, (pointer) pNewLayer);
-    LayerDestroy (pScreen, pNewLayer);
 bail4:
     pScreen->width = oldwidth;
     pScreen->height = oldheight;
@@ -616,27 +601,20 @@
 #endif
 
     pScreen->CreateColormap = fbdevCreateColormap;
-
-    if (!LayerStartInit (pScreen))
-	return FALSE;
-    return TRUE;
+    return shadowSetup (pScreen);
 }
 
 Bool
 fbdevFinishInitScreen (ScreenPtr pScreen)
 {
-    KdScreenPriv(pScreen);
-    FbdevScrPriv	*scrpriv = pScreenPriv->screen->driver;
-    
-    scrpriv->layerKind = LayerNewKind (pScreen);
+    PixmapPtr	pPixmap;
 
-    if (!LayerFinishInit (pScreen))
-	return FALSE;
+    fbdevConfigureScreen (pScreen);
 
-    scrpriv->pLayer = fbdevLayerCreate (pScreen);
-    if (!scrpriv->pLayer)
+    pPixmap = fbdevGetPixmap (pScreen);
+    if (!pPixmap)
 	return FALSE;
-    
+
 #ifdef RANDR
     if (!fbdevRandRInit (pScreen))
 	return FALSE;

Index: fbdev.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/fbdev/fbdev.h,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -d -r1.14 -r1.14.2.1
--- fbdev.h	5 Oct 2003 05:22:35 -0000	1.14
+++ fbdev.h	22 Oct 2003 06:00:49 -0000	1.14.2.1
@@ -30,7 +30,6 @@
 #include <unistd.h>
 #include <sys/mman.h>
 #include "kdrive.h"
-#include "layer.h"
 
 #ifdef RANDR
 #include "randrstr.h"
@@ -50,8 +49,7 @@
 typedef struct _fbdevScrPriv {
     Rotation			randr;
     Bool			shadow;
-    int				layerKind;
-    LayerPtr			pLayer;
+    PixmapPtr			pShadow;
 } FbdevScrPriv;
 
 extern KdCardFuncs  fbdevFuncs;