[xserver-commit] xserver/hw/kdrive/vesa Makefile.am,1.11,1.11.2.1 vesa.c,1.26,1.26.2.1 vesa.h,1.16,1.16.2.1

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


Committed by: keithp

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

Modified Files:
      Tag: xfixes_2_branch
	Makefile.am vesa.c vesa.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/vesa/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -d -r1.11 -r1.11.2.1
--- Makefile.am	15 Oct 2003 04:59:45 -0000	1.11
+++ Makefile.am	22 Oct 2003 06:00:49 -0000	1.11.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			\
@@ -25,9 +25,9 @@
 	libvesa.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/damage/libdamage.a \
 	$(top_builddir)/miext/shadow/libshadow.a \
 	$(top_builddir)/randr/librandr.a	\
 	$(top_builddir)/render/librender.a	\

Index: vesa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vesa.c,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -u -d -r1.26 -r1.26.2.1
--- vesa.c	15 Oct 2003 01:00:38 -0000	1.26
+++ vesa.c	22 Oct 2003 06:00:50 -0000	1.26.2.1
@@ -463,8 +463,6 @@
     pscr->randr = screen->randr;
     pscr->shadow = vesa_shadow;
     pscr->origDepth = screen->fb[0].depth;
-    pscr->layerKind = LAYER_FB;
-
     /*
      * Compute visual support for the selected depth
      */
@@ -683,7 +681,7 @@
 vesaUpdateMono (ScreenPtr	pScreen,
 		shadowBufPtr	pBuf)
 {
-    RegionPtr	damage = &pBuf->damage;
+    RegionPtr	damage = shadowDamage(pBuf);
     PixmapPtr	pShadow = pBuf->pPixmap;
     int		nbox = REGION_NUM_RECTS (damage);
     BoxPtr	pbox = REGION_RECTS (damage);
@@ -831,16 +829,15 @@
     KdSetMouseMatrix (&m);
 }
 
-LayerPtr
-vesaLayerCreate (ScreenPtr pScreen)
+PixmapPtr
+vesaGetPixmap (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
     KdScreenInfo	*screen = pScreenPriv->screen;
     VesaScreenPrivPtr	pscr = pScreenPriv->screen->driver;
     ShadowUpdateProc	update;
     ShadowWindowProc	window = 0;
-    PixmapPtr		pPixmap;
-    int			kind;
+    PixmapPtr		pShadow, pPixmap;
 
     if (pscr->shadow)
     {
@@ -872,23 +869,35 @@
 	    break;
 	}
 	
-	kind = LAYER_SHADOW;
-	pPixmap = 0;
+	pPixmap = (*pScreen->CreatePixmap) (pScreen,
+					    pScreen->width,
+					    pScreen->height,
+					    screen->fb[0].depth);
+	if (!pPixmap)
+	    return NullPixmap;
+	if (!shadowSet (pScreen, pPixmap, update, 
+			window, pscr->randr, 0))
+	{
+	    (*pScreen->DestroyPixmap) (pPixmap);
+	    return NullPixmap;
+	}
+	pShadow = pPixmap;
     }
     else
     {
-	kind = pscr->layerKind;
-	pPixmap = LAYER_SCREEN_PIXMAP;
-	update = 0;
-	window = 0;
+	pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+	pShadow = 0;
+	shadowUnset (pScreen);
     }
+    
+    if (pscr->pShadow)
+        (*pScreen->DestroyPixmap) (pscr->pShadow);
+    pscr->pShadow = pShadow;
 
     if (vesa_verbose)
 	ErrorF ("Mode selected %dx%dx%d\n",
 		pScreen->width, pScreen->height, screen->fb[0].depth);
-
-    return LayerCreate (pScreen, kind, screen->fb[0].depth, 
-			pPixmap, update, window, pscr->randr, 0);
+    return pPixmap;
 }
 
 Bool
@@ -1013,7 +1022,11 @@
 	pscr->fb = NULL;
 	break;
     }
+    screen->memory_base = pscr->fb;
+    screen->memory_size = pscr->fb_size;
     screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb);
+    screen->off_screen_base = screen->fb[0].byteStride * screen->height;
+    
     return TRUE;
 }
 
@@ -1109,25 +1122,13 @@
 }
 
 int
-vesaLayerAdd (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
-vesaLayerRemove (WindowPtr pWin, pointer value)
+vesaPixmapSet (WindowPtr pWin, pointer value)
 {
     ScreenPtr	    pScreen = pWin->drawable.pScreen;
-    LayerPtr	    pLayer = (LayerPtr) value;
-
-    LayerWindowRemove (pScreen, pLayer, pWin);
+    PixmapPtr	    pPixmap = value;
 
+    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+    (*pScreen->SetWindowPixmap) (pWin, pPixmap);
     return WT_WALKCHILDREN;
 }
 
@@ -1150,8 +1151,8 @@
     int			oldheight;
     int			oldmmwidth;
     int			oldmmheight;
-    LayerPtr		pNewLayer;
     int			newwidth, newheight;
+    PixmapPtr		pPixmap;
 
     if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
     {
@@ -1225,13 +1226,15 @@
 	break;
     }
 
+    KdOffscreenSwapOut (screen->pScreen);
+    
     vesaUnmapFramebuffer (screen);
     if (!vesaMapFramebuffer (screen))
 	goto bail3;
     
 #if 0
     /*
-     * XXX can't switch depths yet
+     * XXX can't switch depths
      */
     screen->fb[0].depth = depth;
     screen->fb[0].bitsPerPixel = bpp;
@@ -1259,20 +1262,14 @@
     }
 	
     /*
-     * Create the layer
+     * Get the pixmap that windows live in
      */
-    pNewLayer = vesaLayerCreate (pScreen);
-    if (!pNewLayer)
+    pPixmap = vesaGetPixmap (pScreen);
+    if (!pPixmap)
 	goto bail4;
     
-    if (WalkTree (pScreen, vesaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING)
-	goto bail5;
+    WalkTree (pScreen, vesaPixmapSet, (pointer) pPixmap);
     
-    WalkTree (pScreen, vesaLayerRemove, (pointer) pscr->pLayer);
-    LayerDestroy (pScreen, pscr->pLayer);
-
-    pscr->pLayer = pNewLayer;
-
     /* set the subpixel order */
     KdSetSubpixelOrder (pScreen, pscr->randr);
 
@@ -1281,9 +1278,6 @@
 
     return TRUE;
 
-bail5:
-    WalkTree (pScreen, vesaLayerRemove, (pointer) pNewLayer);
-    LayerDestroy (pScreen, pNewLayer);
 bail4:
     vesaUnmapFramebuffer (screen);
     *pscr = oldscr;
@@ -1340,27 +1334,18 @@
 Bool
 vesaInitScreen(ScreenPtr pScreen)
 {
-    if (!LayerStartInit (pScreen))
-	return FALSE;
-    
-    return TRUE;
+    return shadowSetup (pScreen);
 }
 
 Bool
 vesaFinishInitScreen (ScreenPtr pScreen)
 {
-    KdScreenPriv(pScreen);
-    VesaScreenPrivPtr	pscr = pScreenPriv->screen->driver;
+    PixmapPtr		pPixmap;
     
-    pscr->layerKind = LayerNewKind (pScreen);
-
-    if (!LayerFinishInit (pScreen))
-	return FALSE;
-
     vesaConfigureScreen (pScreen);
 
-    pscr->pLayer = vesaLayerCreate (pScreen);
-    if (!pscr->pLayer)
+    pPixmap = vesaGetPixmap (pScreen);
+    if (!pPixmap)
 	return FALSE;
     
 #ifdef RANDR
@@ -1668,6 +1653,11 @@
 {
     VesaScreenPrivPtr	pscr = screen->driver;
     
+    if (pscr->pShadow)
+    {
+	(*screen->pScreen->DestroyPixmap) (pscr->pShadow);
+	pscr->pShadow = 0;
+    }
     vesaUnmapFramebuffer (screen);
     screen->fb[0].depth = pscr->origDepth;
 }

Index: vesa.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vesa.h,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- vesa.h	14 Oct 2003 05:08:35 -0000	1.16
+++ vesa.h	22 Oct 2003 06:00:50 -0000	1.16.2.1
@@ -25,7 +25,7 @@
 #define _VESA_H_
 
 #include "kdrive.h"
-#include "layer.h"
+#include "shadow.h"
 #include "vm86.h"
 #ifdef RANDR
 #include "randrstr.h"
@@ -98,11 +98,10 @@
     Rotation	randr;
     int		mapping;
     int		origDepth;
-    int		layerKind;
     void	*fb;
     int		fb_size;
     CARD32	fb_phys;
-    LayerPtr	pLayer;
+    PixmapPtr	pShadow;
 } VesaScreenPrivRec, *VesaScreenPrivPtr;
 
 extern int vesa_video_mode;
@@ -145,8 +144,8 @@
 Bool
 vesaScreenInit(KdScreenInfo *screen);    
 
-LayerPtr
-vesaLayerCreate (ScreenPtr pScreen);
+PixmapPtr
+vesaGetPixmap (ScreenPtr pScreen);
 
 Bool
 vesaMapFramebuffer (KdScreenInfo    *screen);