xserver/hw/kdrive/ati ati_draw.c,1.14,1.15

Eric Anholt xserver-commit at pdx.freedesktop.org
Thu Jun 10 19:51:01 EST 2004


Committed by: anholt

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

Modified Files:
	ati_draw.c 
Log Message:
Align scratch area offsets to the offscreen byte alignment.


Index: ati_draw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati_draw.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- a/ati_draw.c	17 May 2004 20:18:02 -0000	1.14
+++ b/ati_draw.c	10 Jun 2004 09:50:59 -0000	1.15
@@ -85,7 +85,6 @@
 	KdScreenPriv(pScreen);
 	ATIScreenInfo(pScreenPriv);
 	ATICardInfo(pScreenPriv);
-	char *mmio = atic->reg_base;
 	RING_LOCALS;
 
 	/* XXX: this shouldn't be necessary, but fixes some R128 composite
@@ -605,7 +604,9 @@
 	 * KAA flag we check for (and supported in kaa.c in general) since many
 	 * older bits of hardware are going to want POT pitches.
 	 */
-	w = 1 << (ATILog2(pSrc->drawable.width - 1) + 1);
+	w = pSrc->drawable.width;
+	if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT)
+		w = 1 << (ATILog2(w - 1) + 1);
 	dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 +
 	    atis->kaa.offscreenPitch - 1) & ~(atis->kaa.offscreenPitch - 1);
 
@@ -614,6 +615,9 @@
 		ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n",
 		    pSrc->drawable.width, pSrc->drawable.height));
 
+	atis->scratch_next = (atis->scratch_next +
+	    atis->kaa.offscreenByteAlign - 1) &
+	    ~(atis->kaa.offscreenByteAlign - 1);
 	if (atis->scratch_next + size > atis->scratch_offset +
 	    atis->scratch_size) {
 		/* Only sync when we've used all of the scratch area. */
@@ -673,6 +677,7 @@
 	KdScreenPriv(pScreen);
 	ATIScreenInfo(pScreenPriv);
 	ATICardInfo(pScreenPriv);
+	int align_scratch;
 
 	ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth,
 	    pScreenPriv->screen->fb[0].bitsPerPixel);
@@ -706,6 +711,13 @@
 		atis->kaa.offscreenPitch = 32;
 	}
 
+	/* Align the scratch area to what offscreenByteAlign requires. */
+	align_scratch = (atis->scratch_offset +
+	    atis->kaa.offscreenByteAlign - 1) &
+	    ~(atis->kaa.offscreenByteAlign - 1);
+	atis->scratch_size -= align_scratch - atis->scratch_offset;
+	atis->scratch_offset = align_scratch;
+
 	if (!kaaDrawInit(pScreen, &atis->kaa))
 		return FALSE;
 




More information about the xserver-commit mailing list