xserver/hw/kdrive/ati ChangeLog, 1.1, 1.2 ati.c, 1.19, 1.20 ati.h, 1.16, 1.17 ati_draw.c, 1.33, 1.34 ati_dri.c, 1.15, 1.16 ati_video.c, 1.3, 1.4

Eric Anholt <xserver-commit-u7BhqnqprCWvj1b/[email protected]> Thu, 9 Jun 2005 03:44:46 -0700 (PDT)
Newsgroups gmane.comp.freedesktop.xserver.cvs
Message-ID <[email protected]>
Committed by: anholt

Update of /cvs/xserver/xserver/hw/kdrive/ati
In directory gabe:/tmp/cvs-serv30863/hw/kdrive/ati

Modified Files:
	ChangeLog ati.c ati.h ati_draw.c ati_dri.c ati_video.c 
Log Message:
- Replace the syncAccel hook in the kdrive structure with a pair of
  hooks in the kaa structure: markSync and waitMarker.  The first, if
  set, returns a hardware-dependent marker number which can then be
  waited for with waitMarker.  If markSync is absent (which is the case
  on all drivers currently), waitMarker must wait for idle on any given
  marker number.  The intention is to allow for more parallelism when
  we get downloading from framebuffer, or more fine-grained idling.
- Replace the KdMarkSync/KdCheckSync functions with kaaMarkSync and
  kaaWaitSync.  These will need to be refined when KAA starts being
  smart about using them.  Merge kpict.c into kasync.c since kasyn.c has
  all the rest of these fallback funcs.
- Restructure all drivers to initialize a KaaInfo structure by hand
  rather than statically in dubious order.
- Whack the i810 driver into shape in hopes that it'll work after this
  change (it certainly wouldn't have before this).  Doesn't support my
  i845 though.
- Make a new KXV helper to avoid duplicated code to fill the region
  with the necessary color key.  Use it in i810 and mach64 (tested).


Index: ChangeLog
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ChangeLog	28 Feb 2005 20:45:15 -0000	1.1
+++ ChangeLog	9 Jun 2005 10:44:44 -0000	1.2
@@ -1,3 +1,31 @@
+2005-06-09  Eric Anholt  <[email protected]>
+
+	* ati.c:
+	* ati.h:
+	* ati_draw.c: (ATIWaitMarker), (ATIGetOffsetPitch),
+	(ATIUploadToScreen), (ATIUploadToScratch), (ATIDrawInit),
+	(ATIDrawEnable):
+	* ati_dri.c: (ATIDRISwapContext):
+	* ati_video.c: (R128DisplayVideo), (RadeonDisplayVideo):
+	- Replace the syncAccel hook in the kdrive structure with a pair of
+	  hooks in the kaa structure: markSync and waitMarker.  The first, if
+	  set, returns a hardware-dependent marker number which can then be
+	  waited for with waitMarker.  If markSync is absent (which is the case
+	  on all drivers currently), waitMarker must wait for idle on any given
+	  marker number.  The intention is to allow for more parallelism when
+	  we get downloading from framebuffer, or more fine-grained idling.
+	- Replace the KdMarkSync/KdCheckSync functions with kaaMarkSync and
+	  kaaWaitSync.  These will need to be refined when KAA starts being
+	  smart about using them.  Merge kpict.c into kasync.c since kasyn.c has
+	  all the rest of these fallback funcs.
+	- Restructure all drivers to initialize a KaaInfo structure by hand
+	  rather than statically in dubious order.
+	- Whack the i810 driver into shape in hopes that it'll work after this
+	  change (it certainly wouldn't have before this).  Doesn't support my
+	  i845 though.
+	- Make a new KXV helper to avoid duplicated code to fill the region
+	  with the necessary color key.  Use it in i810 and mach64 (tested).
+
 2005-02-28  Keith Packard  <[email protected]>
 
 	* ati_reg.h:

Index: ati.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- ati.c	14 Sep 2004 06:26:53 -0000	1.19
+++ ati.c	9 Jun 2005 10:44:44 -0000	1.20
@@ -756,7 +756,6 @@
 
 	ATIDrawInit,		/* initAccel */
 	ATIDrawEnable,		/* enableAccel */
-	ATIDrawSync,		/* syncAccel */
 	ATIDrawDisable,		/* disableAccel */
 	ATIDrawFini,		/* finiAccel */
 

Index: ati.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ati.h	21 Feb 2005 03:44:10 -0000	1.16
+++ ati.h	9 Jun 2005 10:44:44 -0000	1.17
@@ -353,9 +353,6 @@
 ATIDrawEnable(ScreenPtr pScreen);
 
 void
-ATIDrawSync(ScreenPtr pScreen);
-
-void
 ATIDrawDisable(ScreenPtr pScreen);
 
 void

Index: ati_draw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati_draw.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ati_draw.c	21 Feb 2005 03:44:10 -0000	1.33
+++ ati_draw.c	9 Jun 2005 10:44:44 -0000	1.34
@@ -192,6 +192,17 @@
 	}
 }
 
+static void
+ATIWaitMarker(ScreenPtr pScreen, int marker)
+{
+	KdScreenPriv(pScreen);
+	ATIScreenInfo(pScreenPriv);
+
+	ENTER_DRAW(0);
+	ATIWaitIdle(atis);
+	LEAVE_DRAW(0);
+}
+
 void
 RadeonSwitchTo2D(ATIScreenInfo *atis)
 {
@@ -287,12 +298,12 @@
 	ATICardInfo *atic = atis->atic;
 
 	/* On the R128, depending on the bpp the screen can be set up so that it
-	 * doesn't meet the offscreenPitch requirement but can still be
+	 * doesn't meet the pitchAlign requirement but can still be
 	 * accelerated, so we check the specific pitch requirement of alignment
 	 * to 8 pixels.
 	 */
 	if (atic->is_radeon) {
-		if (pitch % atis->kaa.offscreenPitch != 0)
+		if (pitch % atis->kaa.pitchAlign != 0)
 			ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
 		*pitch_offset = ((pitch >> 6) << 22) | (offset >> 10);
 
@@ -302,7 +313,7 @@
 		*pitch_offset = ((pitch / bpp) << 21) | (offset >> 5);
 	}
 
-	if (offset % atis->kaa.offscreenByteAlign != 0)
+	if (offset % atis->kaa.offsetAlign != 0)
 		ATI_FALLBACK(("Bad offset 0x%08x\n", offset));
 
 	return TRUE;
@@ -656,7 +667,7 @@
 		END_DMA();
 	}
 
-	KdMarkSync(pScreen);
+	kaaMarkSync(pScreen);
 
 	ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp);
 
@@ -683,20 +694,19 @@
 	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);
+	    atis->kaa.pitchAlign - 1) & ~(atis->kaa.pitchAlign - 1);
 
 	size = dst_pitch * pSrc->drawable.height;
 	if (size > atis->scratch_area->size)
 		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);
+	atis->scratch_next = (atis->scratch_next + atis->kaa.offsetAlign - 1) &
+	    ~(atis->kaa.offsetAlign - 1);
 	if (atis->scratch_next + size > atis->scratch_area->offset +
 	    atis->scratch_area->size) {
 		/* Only sync when we've used all of the scratch area. */
-		KdCheckSync(pSrc->drawable.pScreen);
+		kaaWaitSync(pSrc->drawable.pScreen);
 		atis->scratch_next = atis->scratch_area->offset;
 	}
 	memcpy(pDst, pSrc, sizeof(*pDst));
@@ -771,6 +781,7 @@
 #endif /* USE_DRI */
 
 	memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec));
+	atis->kaa.waitMarker = ATIWaitMarker;
 	atis->kaa.PrepareSolid = ATIPrepareSolid;
 	atis->kaa.Solid = ATISolid;
 	atis->kaa.DoneSolid = ATIDoneSolid;
@@ -783,16 +794,16 @@
 
 	atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
 	if (atic->is_radeon) {
-		atis->kaa.offscreenByteAlign = 1024;
-		atis->kaa.offscreenPitch = 64;
+		atis->kaa.offsetAlign = 1024;
+		atis->kaa.pitchAlign = 64;
 	} else {
 		/* Rage 128 compositing wants power-of-two pitches. */
 		atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT;
-		atis->kaa.offscreenByteAlign = 32;
+		atis->kaa.offsetAlign = 32;
 		/* Pitch alignment is in sets of 8 pixels, and we need to cover
 		 * 32bpp, so 32 bytes.
 		 */
-		atis->kaa.offscreenPitch = 32;
+		atis->kaa.pitchAlign = 32;
 	}
 
 	kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0);
@@ -874,13 +885,13 @@
 	 * can't be migrated.
 	 */
 	atis->scratch_area = KdOffscreenAlloc(pScreen, 131072,
-	    atis->kaa.offscreenByteAlign, TRUE, ATIScratchSave, atis);
+	    atis->kaa.offsetAlign, TRUE, ATIScratchSave, atis);
 	if (atis->scratch_area != NULL) {
 		atis->scratch_next = atis->scratch_area->offset;
 		atis->kaa.UploadToScratch = ATIUploadToScratch;
 	}
 
-	KdMarkSync(pScreen);
+	kaaMarkSync(pScreen);
 }
 
 void
@@ -908,13 +919,3 @@
 	kaaDrawFini(pScreen);
 }
 
-void
-ATIDrawSync(ScreenPtr pScreen)
-{
-	KdScreenPriv(pScreen);
-	ATIScreenInfo(pScreenPriv);
-
-	ENTER_DRAW(0);
-	ATIWaitIdle(atis);
-	LEAVE_DRAW(0);
-}

Index: ati_dri.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati_dri.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ati_dri.c	25 Jan 2005 01:38:26 -0000	1.15
+++ ati_dri.c	9 Jun 2005 10:44:44 -0000	1.16
@@ -562,7 +562,7 @@
 	if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) &&
 	    (newContextType==DRI_2D_CONTEXT)) {
 		/* Entering from Wakeup */
-		KdMarkSync(pScreen);
+		kaaMarkSync(pScreen);
 	}
 	if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) &&
 	    (newContextType==DRI_2D_CONTEXT)) {

Index: ati_video.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati_video.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ati_video.c	27 Jan 2005 05:25:57 -0000	1.3
+++ ati_video.c	9 Jun 2005 10:44:44 -0000	1.4
@@ -259,7 +259,7 @@
 	/* XXX: Shouldn't this be in kxv.c instead? */
 	DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
 #endif
-	KdMarkSync(pScreen);
+	kaaMarkSync(pScreen);
 }
 
 union intfloat {
@@ -490,7 +490,7 @@
 	/* XXX: Shouldn't this be in kxv.c instead? */
 	DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
 #endif
-	KdMarkSync(pScreen);
+	kaaMarkSync(pScreen);
 }
 
 static void