xserver/hw/kdrive/mga mga.c, 1.5, 1.6 mga.h, 1.8, 1.9 mgadraw.c, 1.10, 1.11

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

Modified Files:
	mga.c mga.h mgadraw.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: mga.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mga/mga.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mga.c	16 Jun 2004 21:36:54 -0000	1.5
+++ mga.c	9 Jun 2005 10:44:45 -0000	1.6
@@ -234,7 +234,6 @@
     
     mgaDrawInit,	/* initAccel */
     mgaDrawEnable,	/* enableAccel */
-    mgaDrawSync,	/* syncAccel */
     mgaDrawDisable,	/* disableAccel */
     mgaDrawFini,	/* finiAccel */
     

Index: mga.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mga/mga.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mga.h	14 Jun 2004 08:43:57 -0000	1.8
+++ mga.h	9 Jun 2005 10:44:45 -0000	1.9
@@ -100,9 +100,10 @@
 typedef struct _mgaScreenInfo {
     VesaScreenPrivRec vesa;
 
+    KaaScreenInfoRec kaa;
+
     int pitch;
     int pw;
-    
 } MgaScreenInfo;
 
 #define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver))
@@ -134,9 +135,6 @@
 mgaDrawEnable (ScreenPtr pScreen);
 
 void
-mgaDrawSync (ScreenPtr pScreen);
-
-void
 mgaDrawDisable (ScreenPtr pScreen);
 
 void

Index: mgadraw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mga/mgadraw.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mgadraw.c	16 Jun 2004 21:36:54 -0000	1.10
+++ mgadraw.c	9 Jun 2005 10:44:45 -0000	1.11
@@ -27,6 +27,7 @@
 #endif
 #include "mga.h"
 #include "g400_common.h"
+#include "kaa.h"
 #include <unistd.h>
 
 CARD32 mgaRop[16] = {
@@ -70,6 +71,17 @@
     while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000);
 }
 
+static void
+mgaWaitMarker (ScreenPtr pScreen, int marker)
+{
+    KdScreenPriv (pScreen);
+    mgaCardInfo (pScreenPriv);
+
+    mmio = mgac->reg_base;
+
+    mgaWaitIdle ();
+}
+
 Bool
 mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait)
 {
@@ -232,38 +244,40 @@
   return TRUE;
 }
 
-KaaScreenInfoRec mgaKaa = {
-    mgaPrepareSolid,
-    mgaSolid,
-    mgaDoneSolid,
-
-    mgaPrepareCopy,
-    mgaCopy,
-    mgaDoneCopy,
-
-    192, /* 192 Offscreen byte alignment */
-    128, /* Pitch alignment is in sets of 32 pixels, and we need to
-	    cover 32bpp, so 128 bytes */
-    KAA_OFFSCREEN_PIXMAPS /* Flags */
-};
-
 Bool
 mgaDrawInit (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
+    mgaScreenInfo (pScreenPriv);
     KdCardInfo *card = pScreenPriv->card;
         
+    memset(&mgas->kaa, 0, sizeof(KaaScreenInfoRec));
+    mgas->kaa.waitMarker	= mgaWaitMarker;
+    mgas->kaa.PrepareSolid	= mgaPrepareSolid;
+    mgas->kaa.Solid		= mgaSolid;
+    mgas->kaa.DoneSolid		= mgaDoneSolid;
+    mgas->kaa.PrepareCopy	= mgaPrepareCopy;
+    mgas->kaa.Copy		= mgaCopy;
+    mgas->kaa.DoneCopy		= mgaDoneCopy;
+    /* In PW24 mode, we need to align to "3 64-bytes" */
+    mgas->kaa.offsetAlign	= 192;
+    /* Pitch alignment is in sets of 32 pixels, and we need to cover 32bpp, so
+     * 128 bytes
+     */
+    mgas->kaa.pitchAlign	= 128;
+    mgas->kaa.flags		= KAA_OFFSCREEN_PIXMAPS;
+
     if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) {
-        mgaKaa.PrepareBlend=mgaPrepareBlend;
-	mgaKaa.Blend=mgaBlend;
-	mgaKaa.DoneBlend=mgaDoneBlend;
-	mgaKaa.PrepareComposite=mgaPrepareComposite;
-	mgaKaa.Composite=mgaComposite;
-	mgaKaa.DoneComposite=mgaDoneComposite;
+        mgas->kaa.PrepareBlend	= mgaPrepareBlend;
+	mgas->kaa.Blend		= mgaBlend;
+	mgas->kaa.DoneBlend	= mgaDoneBlend;
+	mgas->kaa.PrepareComposite = mgaPrepareComposite;
+	mgas->kaa.Composite	= mgaComposite;
+	mgas->kaa.DoneComposite	= mgaDoneComposite;
     }
     /*mgaKaa.UploadToScreen=mgaUploadToScreen;*/
         
-    if (!kaaDrawInit (pScreen, &mgaKaa))
+    if (!kaaDrawInit (pScreen, &mgas->kaa))
 	return FALSE;
 
     return TRUE;
@@ -292,7 +306,7 @@
       FatalError ("unsupported pixel format");
     }
 
-    KdMarkSync (pScreen);
+    kaaMarkSync (pScreen);
 }
 
 void
@@ -305,13 +319,3 @@
 {
 }
 
-void
-mgaDrawSync (ScreenPtr pScreen)
-{
-    KdScreenPriv (pScreen);
-    mgaCardInfo (pScreenPriv);
-
-    mmio = mgac->reg_base;
-
-    mgaWaitIdle ();
-}