xserver/hw/kdrive/pm2 pm2.c, 1.2, 1.3 pm2.h, 1.2, 1.3 pm2_draw.c, 1.2, 1.3

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

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

Modified Files:
	pm2.c pm2.h pm2_draw.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: pm2.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/pm2/pm2.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pm2.c	30 May 2004 13:51:18 -0000	1.2
+++ pm2.c	9 Jun 2005 10:44:45 -0000	1.3
@@ -2,6 +2,7 @@
 #include <config.h>
 #endif
 #include "kdrive.h"
+#include "kaa.h"
 
 #include "pm2.h"
 
@@ -198,7 +199,7 @@
 		      int		rate,
 		      RRScreenSizePtr	pSize)
 {
-    KdCheckSync (pScreen);
+    kaaWaitSync (pScreen);
 
     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
 	return FALSE;
@@ -296,7 +297,6 @@
 
     pmDrawInit,              /* initAccel */
     pmDrawEnable,            /* enableAccel */
-    pmDrawSync,              /* syncAccel */
     pmDrawDisable,           /* disableAccel */
     pmDrawFini,              /* finiAccel */
     

Index: pm2.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/pm2/pm2.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pm2.h	30 May 2004 13:51:18 -0000	1.2
+++ pm2.h	9 Jun 2005 10:44:45 -0000	1.3
@@ -59,6 +59,7 @@
     CARD8 *off_screen;
     int	 off_screen_size;
     KdVideoAdaptorPtr pAdaptor;
+    KaaScreenInfoRec kaa;
 } PM2ScreenInfo;
 
 #define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver))
@@ -77,9 +78,6 @@
 pmDrawEnable (ScreenPtr);
 
 void
-pmDrawSync (ScreenPtr);
-
-void
 pmDrawDisable (ScreenPtr);
 
 void

Index: pm2_draw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/pm2/pm2_draw.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pm2_draw.c	30 May 2004 13:51:18 -0000	1.2
+++ pm2_draw.c	9 Jun 2005 10:44:45 -0000	1.3
@@ -2,6 +2,7 @@
 #include <config.h>
 #endif
 #include "kdrive.h"
+#include "kaa.h"
 
 #include "pm2.h"
 
@@ -10,6 +11,20 @@
 
 static void Permedia2LoadCoord(int x, int y, int w, int h);
 
+static void
+pmWaitMarker (ScreenPtr pScreen, int marker)
+{
+    CHECKCLIPPING;
+
+    while (GLINT_READ_REG(DMACount) != 0);
+    GLINT_WAIT(2);
+    GLINT_WRITE_REG(0x400, FilterMode);
+    GLINT_WRITE_REG(0, GlintSync);
+    do {
+   	while(GLINT_READ_REG(OutFIFOWords) == 0);
+    } while (GLINT_READ_REG(OutputFIFO) != Sync_tag);
+}
+
 static Bool
 pmPrepareSolid (PixmapPtr   	pPixmap,
 		int		rop,
@@ -159,27 +174,28 @@
     }
 }
 
-KaaScreenInfoRec    pmKaa = {
-    pmPrepareSolid,
-    pmSolid,
-    pmDoneSolid,
-
-    pmPrepareCopy,
-    pmCopy,
-    pmDoneCopy,
-};
 
 Bool
 pmDrawInit (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
     pmCardInfo(pScreenPriv);
+    pmScreenInfo(pScreenPriv);
     Bool    ret = TRUE;
 
     card = pm2c;
     mmio = pm2c->reg_base;
 
-    if (ret && !kaaDrawInit (pScreen, &pmKaa))
+    memset(&pm2s->kaa, 0, sizeof(KaaScreenInfoRec));
+    pm2s->kaa.waitMarker	= pmWaitMarker;
+    pm2s->kaa.PrepareSolid	= pmPrepareSolid;
+    pm2s->kaa.Solid		= pmSolid;
+    pm2s->kaa.DoneSolid		= pmDoneSolid;
+    pm2s->kaa.PrepareCopy	= pmPrepareCopy;
+    pm2s->kaa.Copy		= pmCopy;
+    pm2s->kaa.DoneCopy		= pmDoneCopy;
+
+    if (ret && !kaaDrawInit (pScreen, &pm2s->kaa))
     {
 	ErrorF ("kaaDrawInit failed\n");
 	ret = FALSE;
@@ -288,7 +304,7 @@
     GLINT_SLOW_WRITE_REG(0, StartY);
     GLINT_SLOW_WRITE_REG(0, GLINTCount);
 
-    KdMarkSync (pScreen);
+    kaaMarkSync (pScreen);
 }
 
 void
@@ -300,17 +316,3 @@
 pmDrawFini (ScreenPtr pScreen)
 {
 }
-
-void
-pmDrawSync (ScreenPtr pScreen)
-{
-    CHECKCLIPPING;
-
-    while (GLINT_READ_REG(DMACount) != 0);
-    GLINT_WAIT(2);
-    GLINT_WRITE_REG(0x400, FilterMode);
-    GLINT_WRITE_REG(0, GlintSync);
-    do {
-   	while(GLINT_READ_REG(OutFIFOWords) == 0);
-    } while (GLINT_READ_REG(OutputFIFO) != Sync_tag);
-}