xserver/hw/kdrive/mach64 mach64.c, 1.17, 1.18 mach64.h, 1.11, 1.12 mach64draw.c, 1.18, 1.19 mach64stub.c, 1.9, 1.10 mach64video.c, 1.18, 1.19

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/mach64
In directory gabe:/tmp/cvs-serv30863/hw/kdrive/mach64

Modified Files:
	mach64.c mach64.h mach64draw.c mach64stub.c mach64video.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: mach64.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mach64/mach64.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mach64.c	1 Dec 2003 01:46:40 -0000	1.17
+++ mach64.c	9 Jun 2005 10:44:45 -0000	1.18
@@ -25,6 +25,7 @@
 #include <config.h>
 #endif
 #include "mach64.h"
+#include "kaa.h"
 
 static Bool
 mach64CardInit (KdCardInfo *card)
@@ -103,7 +104,7 @@
 		      int		rate,
 		      RRScreenSizePtr	pSize)
 {
-    KdCheckSync (pScreen);
+   kaaWaitSync (pScreen);
 
     if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
 	return FALSE;
@@ -353,7 +354,7 @@
 	CRTC_GEN_CNTL &= ~(1 << 6);
     }
     
-    KdCheckSync (pScreen);
+    kaaWaitSync (pScreen);
 
     mach64WriteLCD (reg, 1, LCD_GEN_CTRL);
     
@@ -425,7 +426,6 @@
     
     mach64DrawInit,	    /* initAccel */
     mach64DrawEnable,	    /* enableAccel */
-    mach64DrawSync,	    /* syncAccel */
     mach64DrawDisable,	    /* disableAccel */
     mach64DrawFini,	    /* finiAccel */
     

Index: mach64.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mach64/mach64.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mach64.h	15 Jan 2004 09:19:56 -0000	1.11
+++ mach64.h	9 Jun 2005 10:44:45 -0000	1.12
@@ -570,6 +570,7 @@
     Mach64Cursor		cursor;
     CARD32			colorKey;
     KdVideoAdaptorPtr		pAdaptor;
+    KaaScreenInfoRec		kaa;
 } Mach64ScreenInfo;
 
 #define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver))
@@ -624,9 +625,6 @@
 mach64DrawEnable (ScreenPtr pScreen);
 
 void
-mach64DrawSync (ScreenPtr pScreen);
-
-void
 mach64DrawDisable (ScreenPtr pScreen);
 
 void

Index: mach64draw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mach64/mach64draw.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mach64draw.c	20 May 2004 19:51:44 -0000	1.18
+++ mach64draw.c	9 Jun 2005 10:44:45 -0000	1.19
@@ -41,6 +41,7 @@
 #include	"migc.h"
 #include	"miline.h"
 #include	"picturestr.h"
+#include	"kaa.h"
 
 CARD8 mach64Rop[16] = {
     /* GXclear      */      0x01,         /* 0 */
@@ -336,6 +337,16 @@
 
 #define NACCELREG (sizeof mach64AccelReg / sizeof mach64AccelReg[0])
 
+static void
+mach64WaitMarker (ScreenPtr pScreen, int marker)
+{
+    KdScreenPriv(pScreen);
+    mach64CardInfo(pScreenPriv);
+    reg = mach64c->reg;
+    
+    mach64WaitIdle (reg);
+}
+
 static Bool
 mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait)
 {
@@ -537,29 +548,29 @@
 #endif
 }
 
-KaaScreenInfoRec    mach64Kaa = {
-    mach64PrepareSolid,
-    mach64Solid,
-    mach64DoneSolid,
-
-    mach64PrepareCopy,
-    mach64Copy,
-    mach64DoneCopy,
-
-    64,			    /* Offscreen byte alignment */
-    64,			    /* Offscreen pitch */
-    KAA_OFFSCREEN_PIXMAPS,  /* Flags */
-};
 
 Bool
 mach64DrawInit (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
-    
+    mach64ScreenInfo(pScreenPriv);
+
+    memset(&mach64s->kaa, 0, sizeof(KaaScreenInfoRec));
+    mach64s->kaa.waitMarker	= mach64WaitMarker;
+    mach64s->kaa.PrepareSolid	= mach64PrepareSolid;
+    mach64s->kaa.Solid		= mach64Solid;
+    mach64s->kaa.DoneSolid	= mach64DoneSolid;
+    mach64s->kaa.PrepareCopy	= mach64PrepareCopy;
+    mach64s->kaa.Copy		= mach64Copy;
+    mach64s->kaa.DoneCopy	= mach64DoneCopy;
+    mach64s->kaa.offsetAlign	= 64;
+    mach64s->kaa.pitchAlign	= 64;
+    mach64s->kaa.flags		= KAA_OFFSCREEN_PIXMAPS;
+
     if (pScreenPriv->screen->fb[0].depth == 4)
 	return FALSE;
     
-    if (!kaaDrawInit (pScreen, &mach64Kaa))
+    if (!kaaDrawInit (pScreen, &mach64s->kaa))
 	return FALSE;
 
     return TRUE;
@@ -568,7 +579,7 @@
 void
 mach64DrawEnable (ScreenPtr pScreen)
 {
-    KdMarkSync (pScreen);
+    kaaMarkSync (pScreen);
 }
 
 void
@@ -581,13 +592,3 @@
 {
     kaaDrawFini (pScreen);
 }
-
-void
-mach64DrawSync (ScreenPtr pScreen)
-{
-    KdScreenPriv(pScreen);
-    mach64CardInfo(pScreenPriv);
-    reg = mach64c->reg;
-    
-    mach64WaitIdle (reg);
-}

Index: mach64stub.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mach64/mach64stub.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mach64stub.c	8 Feb 2005 22:43:54 -0000	1.9
+++ mach64stub.c	9 Jun 2005 10:44:45 -0000	1.10
@@ -35,13 +35,15 @@
 {
     KdCardAttr	attr;
 
-    if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr))
+    if (LinuxFindPci (0x1002, 0x4750, 0, &attr))
 	KdCardInfoAdd (&mach64Funcs, &attr, 0);
-    else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr))
+    else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr))
 	KdCardInfoAdd (&mach64Funcs, &attr, 0);
     else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr))
 	KdCardInfoAdd (&mach64Funcs, &attr, 0);
-    else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr))
+    else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr))
+	KdCardInfoAdd (&mach64Funcs, &attr, 0);
+    else if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr))
 	KdCardInfoAdd (&mach64Funcs, &attr, 0);
 }
 

Index: mach64video.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mach64/mach64video.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mach64video.c	17 Nov 2003 22:09:12 -0000	1.18
+++ mach64video.c	9 Jun 2005 10:44:45 -0000	1.19
@@ -326,48 +326,6 @@
     }
 }
 
-static void
-mach64PaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
-{
-    GCPtr	pGC;
-    CARD32    	val[2];
-    xRectangle	*rects, *r;
-    BoxPtr	pBox = REGION_RECTS (pRgn);
-    int		nBox = REGION_NUM_RECTS (pRgn);
-    
-    rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle));
-    if (!rects)
-	goto bail0;
-    r = rects;
-    while (nBox--)
-    {
-	r->x = pBox->x1 - pDraw->x;
-	r->y = pBox->y1 - pDraw->y;
-	r->width = pBox->x2 - pBox->x1;
-	r->height = pBox->y2 - pBox->y1;
-	r++;
-	pBox++;
-    }
-    
-    pGC = GetScratchGC (pDraw->depth, pDraw->pScreen);
-    if (!pGC)
-	goto bail1;
-    
-    val[0] = fg;
-    val[1] = IncludeInferiors;
-    ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
-    
-    ValidateGC (pDraw, pGC);
-    
-    (*pGC->ops->PolyFillRect) (pDraw, pGC, 
-			       REGION_NUM_RECTS (pRgn), rects);
-
-    FreeScratchGC (pGC);
-bail1:
-    DEALLOCATE_LOCAL (rects);
-bail0:
-    ;
-}
 
 /* Mach64ClipVideo -  
 
@@ -777,7 +735,7 @@
     if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
     {
 	REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
-	mach64PaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
+	KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
     }
 
     pPortPriv->videoOn = TRUE;
@@ -898,7 +856,7 @@
 	if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
 	{
 	    REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
-	    mach64PaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
+	    KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
 	}
 	return Success;
     }