xserver/hw/kdrive/via via.c, 1.1, 1.2 via.h, 1.1, 1.2 viadraw.c, 1.1, 1.2

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

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

Modified Files:
	via.c via.h viadraw.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: via.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/via/via.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- via.c	29 May 2004 12:15:46 -0000	1.1
+++ via.c	9 Jun 2005 10:44:45 -0000	1.2
@@ -426,7 +426,6 @@
 
 	viaDrawInit,		/* initAccel */
 	viaDrawEnable,		/* enableAccel */
-	viaDrawSync,		/* syncAccel */
 	viaDrawDisable,		/* disableAccel */
 	viaDrawFini,		/* finiAccel */
 

Index: via.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/via/via.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- via.h	29 May 2004 12:15:46 -0000	1.1
+++ via.h	9 Jun 2005 10:44:45 -0000	1.2
@@ -107,6 +107,7 @@
 */
 typedef struct _viaScreenInfo {
 	VesaScreenPrivRec	vesa;
+	KaaScreenInfoRec	kaa;
 } ViaScreenInfo;
 
 /*

Index: viadraw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/via/viadraw.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- viadraw.c	29 May 2004 12:15:46 -0000	1.1
+++ viadraw.c	9 Jun 2005 10:44:45 -0000	1.2
@@ -34,6 +34,8 @@
 #include "viadraw.h"
 #include "via_regs.h"
 #include <sched.h>
+#include "kdrive.h"
+#include "kaa.h"
 
 /*
 ** A global to contain card information between calls into this file.
@@ -108,6 +110,29 @@
 }
 
 /*
+** void viaDrawSync( ScreenPtr pScreen, int marker )
+**
+** Description:
+**	Block until the graphics chip has finished all outstanding drawing
+**	operations and the framebuffer contents is static.
+**
+** Arguments:
+**	pScreen		Pointer to screen strucutre for the screen we're
+**			waiting for drawing to end on.
+**
+** Return:
+**	None.
+*/
+static void
+viaWaitMarker( ScreenPtr pScreen, int marker ) {
+	KdScreenPriv( pScreen );
+	ViaCardInfo* viac = pScreenPriv->card->driver;
+
+	viaWaitIdle( viac );
+}
+
+
+/*
 ** Bool viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg )
 **
 ** Description:
@@ -214,8 +239,7 @@
 **	None.
 */
 static void
-viaDoneSolid() {
-	;
+viaDoneSolid(void) {
 }
 
 /*
@@ -330,26 +354,9 @@
 **	None.
 */
 static void
-viaDoneCopy() {
-	;
+viaDoneCopy(void) {
 }
 
-/*
-** viaKaa structure
-**
-** Description:
-**	Structure to contain function pointers to accelerated KAA operations
-**	in this driver.
-*/
-KaaScreenInfoRec viaKaa = {
-	viaPrepareSolid,
-	viaSolid,
-	viaDoneSolid,
-
-	viaPrepareCopy,
-	viaCopy,
-	viaDoneCopy,
-};
 
 /*
 ** Bool viaDrawInit( ScreenPtr pScreen )
@@ -370,6 +377,7 @@
 viaDrawInit( ScreenPtr pScreen ) {
 	KdScreenPriv( pScreen );
 	ViaCardInfo* viac = pScreenPriv->card->driver;
+	ViaScreenInfo* vias = pScreenPriv->card->driver;
 	CARD32 geMode = 0;
 
 	if( !viac ) return FALSE;
@@ -425,7 +433,16 @@
 
 	DebugF( "Initialized 2D engine!\n" );
 
-	return kaaDrawInit( pScreen, &viaKaa );
+	memset(&vias->kaa, 0, sizeof(KaaScreenInfoRec));
+	vias->kaa.waitMarker	= viaWaitMarker;
+	vias->kaa.PrepareSolid	= viaPrepareSolid;
+	vias->kaa.Solid		= viaSolid;
+	vias->kaa.DoneSolid	= viaDoneSolid;
+	vias->kaa.PrepareCopy	= viaPrepareCopy;
+	vias->kaa.Copy		= viaCopy;
+	vias->kaa.DoneCopy	= viaDoneCopy;
+
+	return kaaDrawInit( pScreen, &vias->kaa );
 }
 
 /*
@@ -443,7 +460,7 @@
 */
 void
 viaDrawEnable( ScreenPtr pScreen ) {
-	KdMarkSync( pScreen );
+	kaaMarkSync( pScreen );
 }
 
 /*
@@ -480,26 +497,3 @@
 void
 viaDrawFini( ScreenPtr pScreen ) {
 }
-
-/*
-** void viaDrawSync( ScreenPtr pScreen )
-**
-** Description:
-**	Block until the graphics chip has finished all outstanding drawing
-**	operations and the framebuffer contents is static.
-**
-** Arguments:
-**	pScreen		Pointer to screen strucutre for the screen we're
-**			waiting for drawing to end on.
-**
-** Return:
-**	None.
-*/
-void
-viaDrawSync( ScreenPtr pScreen ) {
-	KdScreenPriv( pScreen );
-	ViaCardInfo* viac = pScreenPriv->card->driver;
-
-	viaWaitIdle( viac );
-}
-