[xserver-commit] xserver/hw/kdrive/src kaa.h,1.1,1.2 kaapict.c,1.1,1.2 Makefile.am,1.7,1.8 kaa.c,1.21,1.22 kdrive.h,1.45,1.46

Eric Anholt xserver-commit@pdx.freedesktop.org
Sun, 28 Dec 2003 22:24:04 -0800


Committed by: anholt

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

Modified Files:
	Makefile.am kaa.c kdrive.h 
Added Files:
	kaa.h kaapict.c 
Log Message:
Merge dri-0-1-branch to trunk.  Notable changes:
- Add libdrm and libdri.  Portions of the DRI extension are stubbed
  out.
- Use the DRM in the ATI driver when available.  This provides a
  minor performance improvement in x11perf, and opens the possibility
  of using the 3d hardware for acceleration in the future.
- Implement solid fill acceleration for Composite in KAA.
- Implement Blend hook for Composite and use it on r128.
- Fix a bug of mine that resulted in overuse of offscreen memory.
- Fix many miscellaneous bugs in ATI driver and add PCI IDs.




Index: Makefile.am
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Makefile.am	11 Nov 2003 05:46:13 -0000	1.7
+++ Makefile.am	29 Dec 2003 06:24:01 -0000	1.8
@@ -6,6 +6,8 @@
 
 libkdrive_a_SOURCES =	\
 	kaa.c		\
+	kaa.h		\
+	kaapict.c	\
 	kasync.c	\
 	kcmap.c		\
 	kcurscol.c	\

Index: kaa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- kaa.c	20 Nov 2003 07:49:46 -0000	1.21
+++ kaa.c	29 Dec 2003 06:24:01 -0000	1.22
@@ -28,8 +28,9 @@
 #include <config.h>
 #endif
 #include "kdrive.h"
-#include	"fontstruct.h"
-#include	"dixfontstr.h"
+#include "kaa.h"
+#include "fontstruct.h"
+#include "dixfontstr.h"
 
 #define DEBUG_MIGRATE 0
 #define DEBUG_PIXMAP 0
@@ -48,30 +49,11 @@
 int kaaScreenPrivateIndex;
 int kaaPixmapPrivateIndex;
 
-typedef struct {
-    KaaScreenInfoPtr info;
-} KaaScreenPrivRec, *KaaScreenPrivPtr;
-
-typedef struct {
-    KdOffscreenArea *area;
-    int		    score;
-    int		    devKind;
-    DevUnion	    devPrivate;
-} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
-
 #define KAA_PIXMAP_SCORE_MOVE_IN    10
 #define KAA_PIXMAP_SCORE_MAX	    20
 #define KAA_PIXMAP_SCORE_MOVE_OUT   -10
 #define KAA_PIXMAP_SCORE_MIN	    -20
 
-#define KaaGetScreenPriv(s)	((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr)
-#define KaaScreenPriv(s)	KaaScreenPrivPtr    pKaaScr = KaaGetScreenPriv(s)
-
-#define KaaGetPixmapPriv(p)	((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
-#define KaaSetPixmapPriv(p,a)	((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
-#define KaaPixmapPriv(p)	KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
-#define KaaPixmapPitch(pitch)	(((pitch) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1))
-
 #define MIN_OFFPIX_SIZE		(4096)
 
 static void
@@ -127,7 +109,7 @@
     
     pKaaPixmap->devKind = pPixmap->devKind;
     pKaaPixmap->devPrivate = pPixmap->devPrivate;
-    pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h * (bpp >> 3),
+    pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h,
 					 pKaaScr->info->offscreenByteAlign,
 					 FALSE, 
 					 kaaPixmapSave, (pointer) pPixmap);
@@ -140,7 +122,7 @@
 		  KaaGetPixmapPriv(pPixmap)->area->offset : -1,
 		  pPixmap->drawable.width,
 		  pPixmap->drawable.height));
-    pPixmap->devKind = pitch * (bpp >> 3);
+    pPixmap->devKind = pitch;
     pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset);
     pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
     return TRUE;
@@ -153,7 +135,6 @@
     unsigned char *dst, *src;
     int i;
 
-    return;
     KdCheckSync (pPixmap->drawable.pScreen);
     
     DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n",
@@ -201,7 +182,7 @@
     }
 }
 
-static void
+void
 kaaPixmapUseScreen (PixmapPtr pPixmap)
 {
     KaaPixmapPriv (pPixmap);
@@ -215,7 +196,7 @@
     }
 }
 
-static void
+void
 kaaPixmapUseMemory (PixmapPtr pPixmap)
 {
     KaaPixmapPriv (pPixmap);
@@ -271,6 +252,7 @@
 		break;
 	    }
     }
+
     pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
     if (!pPixmap)
 	return NULL;
@@ -278,13 +260,12 @@
     pKaaPixmap->score = 0;
     pKaaPixmap->area = NULL;
     
-    if (depth == pScreen->rootDepth &&
-	(pPixmap->devKind * h) >= MIN_OFFPIX_SIZE)
+    if ((pPixmap->devKind * h) >= MIN_OFFPIX_SIZE)
 	kaaPixmapAllocArea (pPixmap);
     return pPixmap;
 }
 
-static Bool
+Bool
 kaaPixmapIsOffscreen(PixmapPtr p)
 {
     ScreenPtr	pScreen = p->drawable.pScreen;
@@ -295,7 +276,7 @@
 	    pScreenPriv->screen->memory_size);
 }
 
-static PixmapPtr
+PixmapPtr
 kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
 {
     PixmapPtr	pPixmap;
@@ -326,7 +307,7 @@
     return NULL;
 }
 
-static Bool
+Bool
 kaaDrawableIsOffscreen (DrawablePtr pDrawable)
 {
     PixmapPtr	pPixmap;
@@ -421,7 +402,7 @@
     KdMarkSync(pDrawable->pScreen);
 }
 
-static void
+void
 kaaCopyNtoN (DrawablePtr    pSrcDrawable,
 	     DrawablePtr    pDstDrawable,
 	     GCPtr	    pGC,
@@ -936,73 +917,6 @@
     KdCheckPaintWindow (pWin, pRegion, what);
 }
 
-#ifdef RENDER
-#include "mipict.h"
-
-static void
-kaaComposite(CARD8	op,
-	     PicturePtr pSrc,
-	     PicturePtr pMask,
-	     PicturePtr pDst,
-	     INT16	xSrc,
-	     INT16	ySrc,
-	     INT16	xMask,
-	     INT16	yMask,
-	     INT16	xDst,
-	     INT16	yDst,
-	     CARD16	width,
-	     CARD16	height)
-{
-    if (op == PictOpSrc && !pMask)
-    {
-	/*
-	 * Check for two special cases -- solid fill and copy area
-	 */
-	if (pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1 &&
-	    pSrc->repeat)
-	{
-	    ;
-	}
-	else if (!pSrc->repeat && pSrc->format == pDst->format)
-	{
-	    RegionRec	region;
-	    
-	    xDst += pDst->pDrawable->x;
-	    yDst += pDst->pDrawable->y;
-	    xSrc += pSrc->pDrawable->x;
-	    ySrc += pSrc->pDrawable->y;
-	    if (pMask)
-	    {
-		xMask += pMask->pDrawable->x;
-		yMask += pMask->pDrawable->y;
-	    }
-	    if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
-					   xSrc, ySrc, xMask, yMask, xDst, yDst,
-					   width, height))
-		return;
-
-				      
-	    kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0,
-			 REGION_RECTS(&region), REGION_NUM_RECTS(&region),
-			 xSrc - xDst, ySrc - yDst,
-			 FALSE, FALSE, 0, 0);
-	    return;
-	}
-    }
-    if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
-    if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable);
-#if 0
-    if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable);
-#endif
-    
-    KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, 
-		      xMask, yMask, xDst, yDst, width, height);
-}
-#endif
-
 Bool
 kaaDrawInit (ScreenPtr		pScreen,
 	     KaaScreenInfoPtr	pScreenInfo)

Index: kdrive.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kdrive.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- kdrive.h	1 Dec 2003 04:33:36 -0000	1.45
+++ kdrive.h	29 Dec 2003 06:24:01 -0000	1.46
@@ -332,6 +332,19 @@
     int	        offscreenByteAlign;
     int         offscreenPitch;
     int		flags;
+
+    Bool        (*PrepareBlend) (int		op,
+				 PicturePtr	pSrcPicture,
+				 PicturePtr	pDstPicture,
+				 PixmapPtr	pSrc,
+				 PixmapPtr	pDst);
+    void        (*Blend) (int	srcX,
+			  int	srcY,
+			  int	dstX,
+			  int	dstY,
+			  int	width,
+			  int	height);
+    void	(*DoneBlend) (void);
 } KaaScreenInfoRec, *KaaScreenInfoPtr;
 
 #define KAA_OFFSCREEN_PIXMAPS (1 << 0)