[xserver-commit] xserver/hw/kdrive/src kaa.c,1.22,1.23 kaapict.c,1.6,1.7 kdrive.h,1.48,1.49

Eric Anholt xserver-commit@pdx.freedesktop.org
Thu, 08 Jan 2004 00:16:26 -0800


Committed by: anholt

Update of /cvs/xserver/xserver/hw/kdrive/src
In directory pdx:/home/anholt/xserver/hw/kdrive/src

Modified Files:
	kaa.c kaapict.c kdrive.h 
Log Message:
- Add a new UploadToScratch kaa hook for putting the data for a single
  pixmap into temporary offscreen storage.  Subsequent UploadToScratch
  may clobber the data of previous ones.  This allows hardware
  acceleration of composite operations on glyphs.
- Add a new UploadToScreen kaa hook for doing the actual moving of
  data to framebuffer.  This would allow us to do things like hostdata
  blits or memcpy to agp and then blit.
- Add an UploadToScreen on ATI which is just memcpy, but which
  will be replaced with a hostdata blit soon.
- Add UploadToScratch on ATI and reserve 64k of scratch space.  This
  provided a 3x speedup of rgb24text on my Radeon.


Index: kaa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- kaa.c	29 Dec 2003 06:24:01 -0000	1.22
+++ kaa.c	8 Jan 2004 08:16:24 -0000	1.23
@@ -131,12 +131,12 @@
 static void
 kaaMoveInPixmap (PixmapPtr pPixmap)
 {
+    ScreenPtr	pScreen = pPixmap->drawable.pScreen;
+    KaaScreenPriv (pScreen);
     int dst_pitch, src_pitch, bytes;
     unsigned char *dst, *src;
     int i;
 
-    KdCheckSync (pPixmap->drawable.pScreen);
-    
     DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n",
 		  pPixmap->drawable.id,
 		  KaaGetPixmapPriv(pPixmap)->area ? 
@@ -150,11 +150,19 @@
     if (!kaaPixmapAllocArea (pPixmap))
 	return;
     
+    if (pKaaScr->info->UploadToScreen)
+    {
+	if (pKaaScr->info->UploadToScreen(pPixmap, src, src_pitch))
+	    return;
+    }
+
     dst = pPixmap->devPrivate.ptr;
     dst_pitch = pPixmap->devKind;
     
     bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
 
+    KdCheckSync (pPixmap->drawable.pScreen);
+
     i = pPixmap->drawable.height;
     while (i--) {
 	memcpy (dst, src, bytes);

Index: kaapict.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaapict.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- kaapict.c	4 Jan 2004 20:51:53 -0000	1.6
+++ kaapict.c	8 Jan 2004 08:16:24 -0000	1.7
@@ -319,6 +319,7 @@
     int nbox;
     int src_off_x, src_off_y, dst_off_x, dst_off_y;
     PixmapPtr pSrcPix, pDstPix;
+    struct _Pixmap srcScratch;
 
     xDst += pDst->pDrawable->x;
     yDst += pDst->pDrawable->y;
@@ -339,7 +340,19 @@
     
     pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
     pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
-    if (!pSrcPix || !pDstPix) {
+
+    if (!pDstPix) {
+	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+	return 0;
+    }
+
+    if (!pSrcPix && pKaaScr->info->UploadToScratch) {
+	if ((*pKaaScr->info->UploadToScratch) ((PixmapPtr) pSrc->pDrawable,
+					       &srcScratch))
+	    pSrcPix = &srcScratch;
+    }
+
+    if (!pSrcPix) {
 	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
 	return 0;
     }

Index: kdrive.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kdrive.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- kdrive.h	3 Jan 2004 11:17:44 -0000	1.48
+++ kdrive.h	8 Jan 2004 08:16:24 -0000	1.49
@@ -363,6 +363,12 @@
 			     int	width,
 			     int	height);
     void	(*DoneComposite) (void);
+
+    Bool        (*UploadToScreen) (PixmapPtr		pDst,
+				   char			*src,
+				   int			src_pitch);
+    Bool        (*UploadToScratch) (PixmapPtr		pSrc,
+				   PixmapPtr		pDst);
 } KaaScreenInfoRec, *KaaScreenInfoPtr;
 
 #define KAA_OFFSCREEN_PIXMAPS (1 << 0)