xserver/hw/kdrive/src kaa.c, 1.24, 1.25 kaa.h, 1.2, 1.3 kdrive.h, 1.50, 1.51

Eric Anholt xserver-commit at pdx.freedesktop.org
Thu May 13 17:34:31 PDT 2004


Committed by: anholt

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

Modified Files:
	kaa.c kaa.h kdrive.h 
Log Message:
Add new flag, KAA_OFFSCREEN_ALIGN_POT, which tells KAA to
align pixmap pitches to a power-of-two number of bytes.
Useful for Render acceleration on older cards.


Index: kaa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- a/kaa.c	14 May 2004 00:27:29 -0000	1.24
+++ b/kaa.c	14 May 2004 00:34:28 -0000	1.25
@@ -95,6 +95,18 @@
     }
 }
 
+static int
+kaaLog2(int val)
+{
+    int bits;
+
+    if (!val)
+	return 0;
+    for (bits = 0; val != 0; bits++)
+	val >>= 1;
+    return bits - 1;
+}
+
 static Bool
 kaaPixmapAllocArea (PixmapPtr pPixmap)
 {
@@ -105,7 +117,12 @@
     int		bpp = pPixmap->drawable.bitsPerPixel;
     CARD16	h = pPixmap->drawable.height;
     CARD16	w = pPixmap->drawable.width;
-    int		pitch = KaaPixmapPitch (w * bpp / 8);
+    int		pitch;
+
+    if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1)
+	w = 1 << (kaaLog2(w - 1) + 1);
+    pitch = (w * bpp / 8 + pKaaScr->info->offscreenPitch - 1) &
+            ~(pKaaScr->info->offscreenPitch - 1);
     
     pKaaPixmap->devKind = pPixmap->devKind;
     pKaaPixmap->devPrivate = pPixmap->devPrivate;

Index: kaa.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kaa.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/kaa.h	29 Dec 2003 06:24:01 -0000	1.2
+++ b/kaa.h	14 May 2004 00:34:28 -0000	1.3
@@ -33,7 +33,6 @@
 #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))
 
 typedef struct {
     KaaScreenInfoPtr info;

Index: kdrive.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/src/kdrive.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- a/kdrive.h	5 Feb 2004 09:09:51 -0000	1.50
+++ b/kdrive.h	14 May 2004 00:34:28 -0000	1.51
@@ -372,7 +372,8 @@
 				   PixmapPtr		pDst);
 } KaaScreenInfoRec, *KaaScreenInfoPtr;
 
-#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
+#define KAA_OFFSCREEN_PIXMAPS		(1 << 0)
+#define KAA_OFFSCREEN_ALIGN_POT		(1 << 1)
 
 /*
  * This is the only completely portable way to




More information about the xserver-commit mailing list