[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-savage: Changes to 'upstream-unstable'



 README              |   20 ++++
 configure.ac        |    6 +
 man/savage.man      |   35 +++++++-
 src/savage_accel.c  |   26 ++++++
 src/savage_dri.c    |   42 +++++++++
 src/savage_driver.c |  222 +++++-----------------------------------------------
 src/savage_driver.h |    4 
 src/savage_exa.c    |  128 +++++++++++++++++++++--------
 src/savage_video.c  |  196 ++++++++++++++++++++++++++++++++++++---------
 9 files changed, 398 insertions(+), 281 deletions(-)

New commits:
commit 75ce40850ea2ce2ed7122cf62856dcf8022187d2
Author: Adam Jackson <ajax@redhat.com>
Date:   Thu Jul 2 11:39:22 2009 -0400

    savage 2.3.0

diff --git a/configure.ac b/configure.ac
index 80c91bc..33be4d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-savage],
-        2.2.1, 
+        2.3.0, 
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-savage)
 

commit a75f0eaba6cb907a6ca9e506858d41f9c6f66b8b
Author: Adam Jackson <ajax@redhat.com>
Date:   Thu May 28 15:16:22 2009 -0400

    Remove useless loader symbol lists.

diff --git a/src/savage_driver.c b/src/savage_driver.c
index 4115fb0..ec2083c 100644
--- a/src/savage_driver.c
+++ b/src/savage_driver.c
@@ -339,178 +339,6 @@ _X_EXPORT DriverRec SAVAGE =
 #endif
 };
 
-
-
-static const char *vgaHWSymbols[] = {
-    "vgaHWBlankScreen",
-    "vgaHWCopyReg",
-    "vgaHWGetHWRec",
-    "vgaHWGetIOBase",
-    "vgaHWGetIndex",
-    "vgaHWInit",
-    "vgaHWLock",
-    "vgaHWProtect",
-    "vgaHWRestore",
-    "vgaHWSave",
-    "vgaHWSaveScreen",
-    "vgaHWSetMmioFuncs",
-    "vgaHWSetStdFuncs",
-    "vgaHWUnmapMem",
-    "vgaHWddc1SetSpeedWeak",
-#if 0
-    "vgaHWFreeHWRec",
-    "vgaHWMapMem",
-    "vgaHWUnlock",
-#endif
-    NULL
-};
-
-#ifdef XF86DRI
-static const char *drmSymbols[] = {
-    "drmAvailable",
-    "drmAddBufs",
-    "drmAddMap",
-    "drmCtlInstHandler",
-    "drmGetInterruptFromBusID",
-    "drmFreeVersion",
-    "drmGetVersion",
-    "drmMap",
-    "drmUnmap",
-    "drmMapBufs",
-    "drmUnmapBufs",
-    "drmAgpAcquire",
-    "drmAgpRelease",
-    "drmAgpEnable",
-    "drmAgpAlloc",
-    "drmAgpFree",
-    "drmAgpBind",
-    "drmAgpUnbind",
-    "drmAgpGetMode",
-    "drmAgpBase",
-    "drmAgpSize",
-    "drmAgpVendorId",
-    "drmAgpDeviceId",
-    "drmMGAInitDMA",
-    "drmMGACleanupDMA",
-    "drmMGAFlushDMA",
-    "drmMGAEngineReset",
-    NULL
-};
-
-static const char *driSymbols[] = {
-    "DRIGetDrawableIndex",
-    "DRIFinishScreenInit",
-    "DRIDestroyInfoRec",
-    "DRICloseScreen",
-    "DRIDestroyInfoRec",
-    "DRIScreenInit",
-    "DRIDestroyInfoRec",
-    "DRICreateInfoRec",
-    "DRILock",
-    "DRIUnlock",
-    "DRIGetSAREAPrivate",
-    "DRIGetContext",
-    "DRIQueryVersion",
-    "DRIAdjustFrame",
-    "DRIOpenFullScreen",
-    "DRICloseFullScreen",
-    "GlxSetVisualConfigs",
-    NULL
-};
-#endif
-
-
-static const char *ramdacSymbols[] = {
-    "xf86CreateCursorInfoRec",
-#if 0
-    "xf86DestroyCursorInfoRec",
-#endif
-    "xf86InitCursor",
-    NULL
-};
-
-static const char *int10Symbols[] = {
-    "xf86ExecX86int10",
-    "xf86Int10AllocPages",
-    "xf86int10Addr",
-    "xf86Int10FreePages"
-};
-
-static const char *vbeSymbols[] = {
-    "VBEInit",
-    "vbeDoEDID",
-#if 0
-    "vbeFree",
-#endif
-    NULL
-};
-
-static const char *vbeOptSymbols[] = {
-    "vbeModeInit",
-    "VBESetVBEMode",
-    "VBEGetVBEInfo",
-    "VBEFreeVBEInfo",
-    NULL
-};
-
-static const char *ddcSymbols[] = {
-    "xf86DoEDID_DDC1",
-    "xf86DoEDID_DDC2",
-    "xf86PrintEDID",
-    "xf86SetDDCproperties",
-    NULL
-};
-
-static const char *i2cSymbols[] = {
-    "xf86CreateI2CBusRec",
-    "xf86I2CBusInit",
-    "xf86CreateI2CDevRec",
-    "xf86I2CDevInit",
-    "xf86I2CWriteByte",
-    "xf86I2CWriteBytes",
-    "xf86I2CReadByte",
-    "xf86I2CReadBytes",
-    "xf86I2CWriteRead",
-    "xf86DestroyI2CDevRec",
-    NULL
-};
-
-static const char *xaaSymbols[] = {
-    "XAAGetCopyROP",
-    "XAAGetCopyROP_PM",
-    "XAACreateInfoRec",
-    "XAADestroyInfoRec",
-    "XAAFillSolidRects",
-    "XAAHelpPatternROP",
-    "XAAHelpSolidROP", 
-    "XAAInit",
-    "XAAScreenIndex",
-    NULL
-};
-
-static const char *exaSymbols[] = {
-    "exaDriverAlloc",
-    "exaDriverInit",
-    "exaDriverFini",
-    "exaOffscreenAlloc",
-    "exaOffscreenFree",
-    "exaGetPixmapOffset",
-    "exaGetPixmapPitch",
-    "exaGetPixmapSize",
-    NULL
-};
-
-static const char *shadowSymbols[] = {
-    "ShadowFBInit",
-    NULL
-};
-
-static const char *fbSymbols[] = {
-    "fbPictureInit",
-    "fbScreenInit",
-    NULL
-};
-
 #ifdef XFree86LOADER
 
 static MODULESETUPPROTO(SavageSetup);
@@ -542,14 +370,6 @@ static pointer SavageSetup(pointer module, pointer opts, int *errmaj,
     if (!setupDone) {
 	setupDone = TRUE;
 	xf86AddDriver(&SAVAGE, module, 1);
-	LoaderRefSymLists(vgaHWSymbols, fbSymbols, ramdacSymbols, 
-			  xaaSymbols,
-			  exaSymbols,
-			  shadowSymbols, vbeSymbols, vbeOptSymbols,
-#ifdef XF86DRI
-                          drmSymbols, driSymbols,
-#endif
-			  int10Symbols, i2cSymbols, ddcSymbols, NULL);
 	return (pointer) 1;
     } else {
 	if (errmaj)
@@ -1052,7 +872,6 @@ static void SavageDoDDC(ScrnInfoPtr pScrn)
     /* Do the DDC dance. */ /* S3/VIA's DDC code */
     ddc = xf86LoadSubModule(pScrn, "ddc");
     if (ddc) {
-        xf86LoaderReqSymLists(ddcSymbols, NULL);
         switch( psav->Chipset ) {
             case S3_SAVAGE3D:
             case S3_SAVAGE_MX:
@@ -1074,7 +893,6 @@ static void SavageDoDDC(ScrnInfoPtr pScrn)
         if (!SavageDDC1(pScrn->scrnIndex)) {
             /* DDC1 failed,switch to DDC2 */
             if (xf86LoadSubModule(pScrn, "i2c")) {
-                xf86LoaderReqSymLists(i2cSymbols,NULL);
                 if (SavageI2CInit(pScrn)) {
                     unsigned char tmp;
                     xf86MonPtr pMon;
@@ -1276,7 +1094,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
     if (!xf86LoadSubModule(pScrn, "vgahw"))
 	return FALSE;
 
-    xf86LoaderReqSymLists(vgaHWSymbols, NULL);
     if (!vgaHWGetHWRec(pScrn))
 	return FALSE;
 
@@ -1579,7 +1396,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
     psav->EntityIndex = pEnt->index;
 
     if (xf86LoadSubModule(pScrn, "vbe")) {
-	xf86LoaderReqSymLists(vbeSymbols, NULL);
 	psav->pVbe = VBEInit(NULL, pEnt->index);
     }
 
@@ -2313,16 +2129,11 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
 	return FALSE;
     }
 
-    xf86LoaderReqSymLists(fbSymbols, NULL);
-
     if( !psav->NoAccel ) {
-
         char *modName = NULL;
-        const char **symNames = NULL;
 
 	if (psav->useEXA) {
 	    modName = "exa";
-	    symNames = exaSymbols;
 	    XF86ModReqInfo req;
 	    int errmaj, errmin;
 	    memset(&req, 0, sizeof(req));
@@ -2339,7 +2150,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
 	    }
 	} else {
 	    modName = "xaa";
-	    symNames = xaaSymbols;
 	    if( !xf86LoadSubModule(pScrn, modName) ) {
 	    	SavageFreeRec(pScrn);
 	    	vbeFree(psav->pVbe);
@@ -2347,9 +2157,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
 	    	return FALSE;
 	    } 
 	}
-
-	xf86LoaderReqSymLists(symNames, NULL );
-
     }
 
     if (psav->hwcursor) {
@@ -2359,7 +2166,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
 	    psav->pVbe = NULL;
 	    return FALSE;
 	}
-	xf86LoaderReqSymLists(ramdacSymbols, NULL);
     }
 
     if (psav->shadowFB) {
@@ -2369,7 +2175,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
 	    psav->pVbe = NULL;
 	    return FALSE;
 	}
-	xf86LoaderReqSymLists(shadowSymbols, NULL);
     }
     vbeFree(psav->pVbe);
 
@@ -4740,7 +4545,6 @@ SavageProbeDDC(ScrnInfoPtr pScrn, int index)
     vbeInfoPtr pVbe;
     
     if (xf86LoadSubModule(pScrn, "vbe")) {
-	xf86LoaderReqSymLists(vbeSymbols, NULL);
 	pVbe = VBEInit(NULL, index);
 	ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
 	vbeFree(pVbe);

commit f2742755352d49a1ff4cbf9a1a5050a0a50e9e6b
Author: Alex Villacís Lasso <a_villacis@palosanto.com>
Date:   Sun Apr 12 16:07:06 2009 -0500

    Do not use XAAGetCopyROP outside of XAA-specific code
    
    The DRI code attempts to use XAAGetCopyROP without checking whether XAA or EXA is in effect. This results in the server crashing with an undefined-symbol error when enabling EXA, then starting glxgears under GNOME/Metacity and attempting to drag the glxgears window.
    
    The EXA code happens to have a functional duplicate of the required code under the name SavageGetCopyROP(). This patch moves the code to savage_accel.c where it is now shared between EXA and the DRI code.
    
    It is disturbing that this has not been caught before.

diff --git a/src/savage_accel.c b/src/savage_accel.c
index 450b402..73c2d90 100644
--- a/src/savage_accel.c
+++ b/src/savage_accel.c
@@ -1537,6 +1537,32 @@ SavageInitAccel(ScreenPtr pScreen)
     	return SavageXAAInit(pScreen);
 }
 
+int SavageGetCopyROP(int rop) {
+
+    int ALUCopyROP[16] =
+    {
+       0x00, /*ROP_0 GXclear */
+       0x88, /*ROP_DSa GXand */
+       0x44, /*ROP_SDna GXandReverse */
+       0xCC, /*ROP_S GXcopy */
+       0x22, /*ROP_DSna GXandInverted */
+       0xAA, /*ROP_D GXnoop */
+       0x66, /*ROP_DSx GXxor */
+       0xEE, /*ROP_DSo GXor */
+       0x11, /*ROP_DSon GXnor */
+       0x99, /*ROP_DSxn GXequiv */
+       0x55, /*ROP_Dn GXinvert*/
+       0xDD, /*ROP_SDno GXorReverse */
+       0x33, /*ROP_Sn GXcopyInverted */
+       0xBB, /*ROP_DSno GXorInverted */
+       0x77, /*ROP_DSan GXnand */
+       0xFF, /*ROP_1 GXset */
+    };
+
+    return (ALUCopyROP[rop]);
+
+}
+
 /* Routines for debugging. */
 
 
diff --git a/src/savage_dri.c b/src/savage_dri.c
index 216c915..190e8ee 100644
--- a/src/savage_dri.c
+++ b/src/savage_dri.c
@@ -1578,6 +1578,9 @@ SAVAGEDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
 	psav->AccelInfoRec->NeedToSync = TRUE;
 }
 
+/* Definition in savage_accel.c */
+int SavageGetCopyROP(int rop);
+
 static void 
 SAVAGEDRISetupForScreenToScreenCopy(
     ScrnInfoPtr pScrn,
@@ -1591,7 +1594,7 @@ SAVAGEDRISetupForScreenToScreenCopy(
     int cmd =0;
 
     cmd = BCI_CMD_RECT | BCI_CMD_DEST_PBD | BCI_CMD_SRC_PBD_COLOR;
-    BCI_CMD_SET_ROP( cmd, XAAGetCopyROP(rop) );
+    BCI_CMD_SET_ROP( cmd, SavageGetCopyROP(rop) );
     if (transparency_color != -1)
         cmd |= BCI_CMD_SEND_COLOR | BCI_CMD_SRC_TRANSPARENT;
 
diff --git a/src/savage_exa.c b/src/savage_exa.c
index 08524f0..3fc8f30 100644
--- a/src/savage_exa.c
+++ b/src/savage_exa.c
@@ -69,31 +69,8 @@ SavageDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
 #define	GXset	0xFF
 #endif
 
-static int SavageGetCopyROP(int rop) {
-
-    int ALUCopyROP[16] =
-    {
-       0x00, /*ROP_0 GXclear */
-       0x88, /*ROP_DSa GXand */
-       0x44, /*ROP_SDna GXandReverse */
-       0xCC, /*ROP_S GXcopy */
-       0x22, /*ROP_DSna GXandInverted */
-       0xAA, /*ROP_D GXnoop */
-       0x66, /*ROP_DSx GXxor */
-       0xEE, /*ROP_DSo GXor */
-       0x11, /*ROP_DSon GXnor */
-       0x99, /*ROP_DSxn GXequiv */
-       0x55, /*ROP_Dn GXinvert*/
-       0xDD, /*ROP_SDno GXorReverse */
-       0x33, /*ROP_Sn GXcopyInverted */
-       0xBB, /*ROP_DSno GXorInverted */
-       0x77, /*ROP_DSan GXnand */
-       0xFF, /*ROP_1 GXset */
-    };
-
-    return (ALUCopyROP[rop]);
-
-}
+/* Definition moved to savage_accel.c */
+int SavageGetCopyROP(int rop);
 
 static int SavageGetSolidROP(int rop) {
 

commit a5ad3e8f509ca07c429a43810cc3e2f80e70a1dc
Author: Alex Villacís Lasso <alex@karlalex.palosanto.com>
Date:   Sat Apr 11 19:12:31 2009 -0500

    Implement use of Mastered Image Transfer through AGP for UploadToScreen EXA acceleration.
    
    Under some conditions (documented in this patch), the UploadToScreen implementation can make use of the AGP scratch buffer used for XVideo as a convenient source for Mastered Image Transfer. The previous implementation is still available as a fallback for when AGP acceleration is not possible. This requires the AGP scratch buffer to be persistent, so the XVideo code is also made aware of an existing DRM mapping for the scratch buffer.

diff --git a/man/savage.man b/man/savage.man
index 822a233..a1cbb1e 100644
--- a/man/savage.man
+++ b/man/savage.man
@@ -180,7 +180,7 @@ and twister (use BCI for Xv); off for savage4 (do not use the BCI for Xv).
 Instructs the BCI Xv pixel formatter to use AGP memory as a scratch buffer.
 Ordinarily the BCI formatter uses a an area in framebuffer memory to hold 
 YV12 planar data to be converted for display. This requires a somewhat expensive
-upload of YV12 data to framebuffer memory. The \*qAGPforXv\*q causes the BCI
+upload of YV12 data to framebuffer memory. The \*qAGPforXv\*q option causes the BCI
 formatter to place the YV12 data in AGP memory instead, which can be uploaded
 faster than the framebuffer. Use of this option cuts upload overhead by 25%
 according to benchmarks. This option also smooths out most of the shearing
@@ -189,6 +189,10 @@ present when using BCI for pixel conversion. Currently this option is
 and is disabled by default. Video width restrictions that apply to \*qBCIforXv\*q 
 also apply here. Only valid when \*qDRI\*q and \*qBCIforXv\*q are both active, 
 and only on AGP chipsets. Default: \*qoff\*q.
+.br
+If \*qAccelMethod\*q is set to \*qEXA\*q and \*qAGPforXv\*q is enabled, then the
+driver will also attempt to reuse the AGP scratch buffer for UploadToScreen 
+acceleration.
 .TP 
 .BI "Option \*qAGPMode\*q \*q" integer \*q
 Set AGP data transfer rate.
diff --git a/src/savage_exa.c b/src/savage_exa.c
index 538e000..08524f0 100644
--- a/src/savage_exa.c
+++ b/src/savage_exa.c
@@ -463,10 +463,73 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
     BCI_GET_PTR;
     int i, j, dwords, queue, Bpp;
     unsigned int cmd;
-    CARD32 * srcp; 
+    CARD32 * srcp;
+    unsigned int dst_pitch;
+    unsigned int dst_yoffset;
+    int agp_possible;
     
+    exaWaitSync(pDst->drawable.pScreen);
+
     Bpp = pDst->drawable.bitsPerPixel / 8;
 
+    /* Test for conditions for AGP Mastered Image Transfer (MIT). AGP memory
+       needs to be available, the XVideo AGP needs to be enabled, the 
+       framebuffer destination must be a multiple of 32 bytes, and the source
+       pitch must span the entirety of the destination pitch. This last 
+       condition allows the code to consider this upload as equivalent to a 
+       plain memcpy() call. */
+    dst_pitch = exaGetPixmapPitch(pDst);
+    dst_yoffset = exaGetPixmapOffset(pDst) + y * dst_pitch;
+    agp_possible = 
+        (!psav->IsPCI && psav->drmFD > 0 && psav->DRIServerInfo != NULL &&
+        psav->DRIServerInfo->agpXVideo.size > 0 &&
+        x == 0 && src_pitch == dst_pitch && w * Bpp == dst_pitch &&
+        (dst_yoffset & 0x1f) == 0);
+
+    if (agp_possible) {
+      	SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo;
+        if (pSAVAGEDRIServer->agpXVideo.map != NULL || 
+            0 <= drmMap( psav->drmFD,
+		pSAVAGEDRIServer->agpXVideo.handle,
+		pSAVAGEDRIServer->agpXVideo.size,
+		&pSAVAGEDRIServer->agpXVideo.map)) {
+        
+            unsigned char * agpMap = pSAVAGEDRIServer->agpXVideo.map;
+            unsigned int agpOffset = drmAgpBase(psav->drmFD) + pSAVAGEDRIServer->agpXVideo.offset;
+            unsigned int bytesTotal = dst_pitch * h;            
+
+            while (bytesTotal > 0) {
+                unsigned int bytesTransfer = 
+                    (bytesTotal > pSAVAGEDRIServer->agpXVideo.size) 
+                    ? pSAVAGEDRIServer->agpXVideo.size 
+                    : bytesTotal;
+                unsigned int qwordsTransfer = bytesTransfer >> 3;
+
+                /* Copy source into AGP buffer */
+                memcpy(agpMap, src, bytesTransfer);
+                
+                psav->WaitQueue(psav,6);
+                BCI_SEND(BCI_SET_REGISTER | BCI_SET_REGISTER_COUNT(2) | 0x51);
+                BCI_SEND(agpOffset | 3);        /* Source buffer in AGP memory */
+                BCI_SEND(dst_yoffset);          /* Destination buffer in framebuffer */
+
+                BCI_SEND(BCI_SET_REGISTER | BCI_SET_REGISTER_COUNT(1) | 0x50);
+                BCI_SEND(0x00000002 | ((qwordsTransfer - 1) << 3)); /* Select MIT, sysmem to framebuffer */
+
+                /* I want to wait here for any reads from AGP memory and any 
+                   framebuffer writes performed by the MIT to stop. */
+                BCI_SEND(0xC0000000 | ((0x08 | 0x01) << 16));
+
+                bytesTotal -= bytesTransfer;
+                src += bytesTransfer;
+                dst_yoffset += bytesTransfer;
+            }
+            exaMarkSync(pDst->drawable.pScreen);
+            return TRUE;
+        }
+    }
+
+    /* If we reach here, AGP transfer is not possible, or failed to drmMap() */
     psav->sbd_offset = exaGetPixmapOffset(pDst);
     psav->sbd_high = SavageSetBD(psav, pDst);
 
@@ -515,7 +578,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
     }
 
     /*exaWaitSync(pDst->drawable.pScreen);*/
-
+    exaMarkSync(pDst->drawable.pScreen);
     return TRUE;
 }
 
diff --git a/src/savage_video.c b/src/savage_video.c
index bccb801..cf51ba0 100644
--- a/src/savage_video.c
+++ b/src/savage_video.c
@@ -1048,8 +1048,12 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
 
 	if (pPriv->agpBufferMap != NULL) {
 	    SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo;
-	    drmUnmap(pPriv->agpBufferMap, pSAVAGEDRIServer->agpXVideo.size);
-	    pSAVAGEDRIServer->agpXVideo.map = NULL;
+
+            /* agpXVideo is reused to implement UploadToScreen in EXA */            
+            if (!psav->useEXA) {
+	        drmUnmap(pPriv->agpBufferMap, pSAVAGEDRIServer->agpXVideo.size);
+	        pSAVAGEDRIServer->agpXVideo.map = NULL;
+            }
 	    pPriv->agpBufferMap = NULL;
 	    pPriv->agpBufferOffset = 0;
 	}
@@ -1971,7 +1975,8 @@ SavagePutImage(
         
 	pPriv->tried_agp = TRUE;
 	if (pSAVAGEDRIServer->agpXVideo.size >= max(new_size, planarFrameSize)) {
-	    if ( drmMap( psav->drmFD,
+	    if (pSAVAGEDRIServer->agpXVideo.map == NULL &&
+	        drmMap( psav->drmFD,
 		pSAVAGEDRIServer->agpXVideo.handle,
 		pSAVAGEDRIServer->agpXVideo.size,
 		&pSAVAGEDRIServer->agpXVideo.map ) < 0 ) {

commit 0f4369c95b6ef948743c9b244709e454b8b8ef7f
Author: Alex Villacís Lasso <alex@karlalex.palosanto.com>
Date:   Sat Mar 14 21:34:48 2009 -0500

    Fix crash by null pointer access when DRI is not available.

diff --git a/src/savage_video.c b/src/savage_video.c
index 57483e0..bccb801 100644
--- a/src/savage_video.c
+++ b/src/savage_video.c
@@ -1965,7 +1965,7 @@ SavagePutImage(
 
     /* Check whether AGP buffers can be allocated. If not, fall back to ordinary
        upload to framebuffer (slower) */
-    if (!pPriv->tried_agp && !psav->IsPCI && psav->drmFD > 0) {
+    if (!pPriv->tried_agp && !psav->IsPCI && psav->drmFD > 0 && psav->DRIServerInfo != NULL) {
         int ret;
 	SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo;
         

commit 343b2f312b1e555f9d03a499ddbe4c9b33b3a6e5
Author: Chris Ball <cjb@laptop.org>
Date:   Fri Feb 27 10:55:58 2009 -0500

    Revert EXA 3 build fix.
    
    The EXA developers have backed out this ABI bump.
    
    Signed-off-by: Chris Ball <cjb@laptop.org>

diff --git a/configure.ac b/configure.ac
index 3198823..80c91bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,9 +111,6 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
 fi
 AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
 
-# Required by exa.h
-AC_DEFINE(EXA_DRIVER_KNOWN_MAJOR, 3, [Major version of EXA we can handle])
-
 AC_SUBST([DRI_CFLAGS])
 AC_SUBST([XORG_CFLAGS])
 AC_SUBST([moduledir])

commit 08692dd381dc6e98d484d5bffabcbd04ebf83df6
Author: Chris Ball <cjb@laptop.org>
Date:   Tue Feb 24 12:54:13 2009 -0500

    configure: use AC_DEFINE instead of shell substitution
    
    (This is just cosmetic.)
    
    Signed-off-by: Chris Ball <cjb@laptop.org>

diff --git a/configure.ac b/configure.ac
index 5c28725..3198823 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,7 @@ fi
 AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
 
 # Required by exa.h
-XORG_CFLAGS="$XORG_CFLAGS -DEXA_DRIVER_KNOWN_MAJOR=3"
+AC_DEFINE(EXA_DRIVER_KNOWN_MAJOR, 3, [Major version of EXA we can handle])
 
 AC_SUBST([DRI_CFLAGS])
 AC_SUBST([XORG_CFLAGS])

commit 26f9e78d9b4f93f34792a31583cb5e8700c5ed52
Author: Chris Ball <cjb@laptop.org>
Date:   Tue Feb 24 11:54:06 2009 -0500

    Build fix: EXA now requires -DEXA_DRIVER_KNOWN_MAJOR=3
    
    This driver doesn't use {Prepare,Finish}Access, so this is safe.
    
    Signed-off-by: Chris Ball <cjb@laptop.org>

diff --git a/configure.ac b/configure.ac
index 80c91bc..5c28725 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,6 +111,9 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
 fi
 AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
 
+# Required by exa.h
+XORG_CFLAGS="$XORG_CFLAGS -DEXA_DRIVER_KNOWN_MAJOR=3"
+
 AC_SUBST([DRI_CFLAGS])
 AC_SUBST([XORG_CFLAGS])
 AC_SUBST([moduledir])

commit f4a3a1cd1bfbf6df583c913030ca2e9ce239d0c3
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Fri Jan 30 20:59:46 2009 -0800

    Add README with pointers to mailing list, bugzilla & git repos

diff --git a/README b/README
new file mode 100644
index 0000000..015d2a9
--- /dev/null
+++ b/README
@@ -0,0 +1,20 @@
+xf86-video-savage - S3 Savage video driver for the Xorg X server
+
+Please submit bugs & patches to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/driver/xf86-video-savage
+
+        http://cgit.freedesktop.org/xorg/driver/xf86-video-savage
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage

commit 0fae48235841f05d7e52e61a2450835fdb8892b3
Author: Tormod Volden <debian.tormod@gmail.com>
Date:   Thu Jan 22 01:22:53 2009 -0500

    Savage: Do not add panel modes when there is no panel
    
    SavageGetPanelInfo will reset DisplayType if the panel is not
    active, so check again before calling SavageAddPanelMode so that
    bogus modes are not added.
    
    This fixes startup failures in some cases, for instance when there is no
    real panel and EDID is missing. The bogus sync ranges (typically 0 Hz)
    would also block the default sync ranges from being applied.
    
    Thanks to Peter Belew for testing.
    https://bugs.launchpad.net/bugs/294899

diff --git a/src/savage_driver.c b/src/savage_driver.c
index da472e9..4115fb0 100644
--- a/src/savage_driver.c
+++ b/src/savage_driver.c
@@ -2206,10 +2206,11 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
     /* Check LCD panel information */
 
     if(psav->DisplayType == MT_LCD)
-    {
 	SavageGetPanelInfo(pScrn);
+
+    /* DisplayType will be reset if panel is not active */
+    if(psav->DisplayType == MT_LCD)
 	SavageAddPanelMode(pScrn);
-    }
   
 #if 0
     if (psav->CrtOnly && !psav->UseBIOS) {

commit 8241b8edaf1f100b0d9f308fdf921b2ab548f3dc
Author: Alex Villacís Lasso <a_villacis@palosanto.com>
Date:   Fri Jan 16 16:22:42 2009 -0500

    EXA: UTS Optimization
    
    use one memcpy per scanline instead of a conditional inside
    a loop for every dword

diff --git a/src/savage_exa.c b/src/savage_exa.c
index 7c6efb3..538e000 100644
--- a/src/savage_exa.c
+++ b/src/savage_exa.c
@@ -495,13 +495,21 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int
     dwords = (((w * Bpp) + 3) >> 2);
     for (i = 0; i < h; i++) {
 	srcp = (CARD32 *)src;
-	for (j = 0; j < dwords; j++) {
-	    if (queue < 4) {
-		BCI_RESET;
-		queue = 120 * 1024;
+
+	if (4 * dwords <= queue) {
+	    /* WARNING: breaking BCI_PTR abstraction here */
+	    memcpy(bci_ptr, srcp, 4 * dwords);
+	    bci_ptr += dwords;
+	    queue -= 4 * dwords;
+	} else {
+	    for (j = 0; j < dwords; j++) {
+		if (queue < 4) {
+		    BCI_RESET;
+		    queue = 120 * 1024;
+		}
+		BCI_SEND(*srcp++);
+		queue -= 4;
 	    }
-	    BCI_SEND(*srcp++);
-	    queue -= 4;
 	}
 	src += src_pitch;
     }

commit 50bcd4bd6f32ed2fd9631b3607a203a187b2e4a2
Author: Alex Villacís Lasso <a_villacis@palosanto.com>
Date:   Fri Jan 16 16:20:23 2009 -0500

    Add AGPforXv Option
    
    Instructs the BCI Xv pixel formatter to use AGP memory as a scratch buffer
    for Xv image upload

diff --git a/man/savage.man b/man/savage.man
index 6454681..822a233 100644
--- a/man/savage.man
+++ b/man/savage.man
@@ -169,8 +169,26 @@ applies to Savage4 and newer chips.  Default: \*qoff\*q (use COB).
 .BI "Option \*qBCIforXv\*q \*q" boolean \*q  
 Use the BCI to copy and reformat Xv pixel data.  Using the BCI for Xv causes 
 graphics artifacts on some chips.  This option only applies to Savage4 and 
-prosavage/twister chips.  Default: on for prosavage and twister (use BCI for Xv); 
-off for savage4 (do not use the BCI for Xv).
+prosavage/twister chips. On some combinations of chipsets and video players,
+BCI formatting might actually be slower than software formatting (\*qAGPforXv\*q 
+might help in this case). BCI formatting can only be used on video data with
+a width that is a multiple of 16 pixels (which is the vast majority of videos). 
+Other widths are handled through software formatting. Default: on for prosavage 
+and twister (use BCI for Xv); off for savage4 (do not use the BCI for Xv).
+.TP
+.BI "Option \*qAGPforXv\*q \*q" boolean \*q
+Instructs the BCI Xv pixel formatter to use AGP memory as a scratch buffer.
+Ordinarily the BCI formatter uses a an area in framebuffer memory to hold 
+YV12 planar data to be converted for display. This requires a somewhat expensive
+upload of YV12 data to framebuffer memory. The \*qAGPforXv\*q causes the BCI
+formatter to place the YV12 data in AGP memory instead, which can be uploaded
+faster than the framebuffer. Use of this option cuts upload overhead by 25%
+according to benchmarks. This option also smooths out most of the shearing
+present when using BCI for pixel conversion. Currently this option is 
+.B experimental
+and is disabled by default. Video width restrictions that apply to \*qBCIforXv\*q 
+also apply here. Only valid when \*qDRI\*q and \*qBCIforXv\*q are both active, 
+and only on AGP chipsets. Default: \*qoff\*q.
 .TP 
 .BI "Option \*qAGPMode\*q \*q" integer \*q
 Set AGP data transfer rate.
diff --git a/src/savage_dri.c b/src/savage_dri.c
index 0d40222..216c915 100644
--- a/src/savage_dri.c
+++ b/src/savage_dri.c
@@ -520,6 +520,15 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen)
        }
    }
 
+   if (psav->AGPforXv) {
+       pSAVAGEDRIServer->agpXVideo.offset = offset;
+       pSAVAGEDRIServer->agpXVideo.size = 2 * 1024 * 1024; /* Max XV image is 1024x1024x16bpp */
+       offset += pSAVAGEDRIServer->agpXVideo.size;
+   } else {
+       pSAVAGEDRIServer->agpXVideo.offset = 0;
+       pSAVAGEDRIServer->agpXVideo.size = 0;
+   }
+
    pSAVAGEDRIServer->agpTextures.offset = offset;
    pSAVAGEDRIServer->agpTextures.size = (pSAVAGEDRIServer->agp.size - offset);
 
@@ -581,6 +590,25 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen)
        }
    }
 
+   /* XVideo buffer
+    */
+   if (pSAVAGEDRIServer->agpXVideo.size != 0) {
+       if ( drmAddMap( psav->drmFD,
+		   pSAVAGEDRIServer->agpXVideo.offset,
+		   pSAVAGEDRIServer->agpXVideo.size,
+		   DRM_AGP, 0,
+		   &pSAVAGEDRIServer->agpXVideo.handle ) < 0 ) {
+	    xf86DrvMsg( pScreen->myNum, X_ERROR,
+		  "[agp] Could not add agpXVideo, will use framebuffer upload (slower) \n" );
+	    pSAVAGEDRIServer->agpXVideo.size = 0;
+	    pSAVAGEDRIServer->agpXVideo.handle = 0;
+       } else {
+	    xf86DrvMsg( pScreen->myNum, X_INFO,
+	       "[agp] agpXVideo handle = 0x%08lx\n",
+	       pSAVAGEDRIServer->agpXVideo.handle );
+       }
+   }
+
    /* AGP textures
     */
    if ( drmAddMap( psav->drmFD,
@@ -1278,6 +1306,12 @@ void SAVAGEDRICloseScreen( ScreenPtr pScreen )
       pSAVAGEDRIServer->aperture.map = NULL;
    }
 
+   if ( pSAVAGEDRIServer->agpXVideo.map ) {
+      drmUnmap( pSAVAGEDRIServer->agpXVideo.map, 
+                pSAVAGEDRIServer->agpXVideo.size );
+      pSAVAGEDRIServer->agpXVideo.map = NULL;
+   }
+
    if ( pSAVAGEDRIServer->agpTextures.map ) {
       drmUnmap( pSAVAGEDRIServer->agpTextures.map, 
                 pSAVAGEDRIServer->agpTextures.size );
@@ -1293,6 +1327,9 @@ void SAVAGEDRICloseScreen( ScreenPtr pScreen )
    if (pSAVAGEDRIServer->aperture.handle)
        drmRmMap(psav->drmFD,pSAVAGEDRIServer->registers.handle);
 
+   if (pSAVAGEDRIServer->agpXVideo.handle)
+       drmRmMap(psav->drmFD,pSAVAGEDRIServer->agpXVideo.handle);
+
    if (pSAVAGEDRIServer->agpTextures.handle)
        drmRmMap(psav->drmFD,pSAVAGEDRIServer->agpTextures.handle);
 
diff --git a/src/savage_driver.c b/src/savage_driver.c
index 919bd1a..da472e9 100644
--- a/src/savage_driver.c
+++ b/src/savage_driver.c
@@ -278,6 +278,7 @@ typedef enum {
     ,OPTION_AGP_SIZE
     ,OPTION_DRI
     ,OPTION_IGNORE_EDID
+    ,OPTION_AGP_FOR_XV
 } SavageOpts;
 
 
@@ -312,6 +313,7 @@ static const OptionInfoRec SavageOptions[] =
     { OPTION_AGP_MODE,	"AGPMode",	OPTV_INTEGER, {0}, FALSE },
     { OPTION_AGP_SIZE,	"AGPSize",	OPTV_INTEGER, {0}, FALSE },
     { OPTION_DRI,       "DRI",          OPTV_BOOLEAN, {0}, TRUE },
+    { OPTION_AGP_FOR_XV,   "AGPforXv",    OPTV_BOOLEAN, {0}, FALSE },
 #endif
     { -1,		NULL,		OPTV_NONE,    {0}, FALSE }
 };
@@ -1870,6 +1872,20 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
                    "%s DVI port support (Savage4 only)\n",(psav->dvi?"Force":"Disable"));
     }
 
+    psav->AGPforXv = FALSE;
+#ifdef XF86DRI
+    if (xf86GetOptValBool(psav->Options, OPTION_AGP_FOR_XV, &psav->AGPforXv)) {
+        if (psav->AGPforXv) {
+            if (psav->agpSize == 0) {
+                psav->AGPforXv = FALSE;
+                xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "AGP not available, cannot use AGP for Xv\n");
+            }
+        }
+        xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+                   "Option: %s use of AGP buffer for Xv\n",(psav->AGPforXv?"Enable":"Disable"));
+    }
+#endif
+
     /* Add more options here. */
 
 
@@ -3678,6 +3694,11 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen,
         else
             xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"XvMC is not enabled\n");
     }
+
+    if (!psav->directRenderingEnabled && psav->AGPforXv) {
+        xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"AGPforXV requires DRI to be enabled.\n");
+	psav->AGPforXv = FALSE;
+    }
 #endif
 
     if (serverGeneration == 1)
diff --git a/src/savage_driver.h b/src/savage_driver.h
index b6d1e7a..c47b472 100644
--- a/src/savage_driver.h
+++ b/src/savage_driver.h
@@ -136,6 +136,9 @@ typedef struct _server{
 
    /* command DMA */
    drmRegion cmdDma;
+
+   /* XVideo through AGP */
+   drmRegion agpXVideo;
 } SAVAGEDRIServerPrivateRec, *SAVAGEDRIServerPrivatePtr;
 
 #endif
@@ -486,6 +489,7 @@ typedef struct _Savage {
 
     Bool bDisableXvMC;
 
+    Bool AGPforXv;
 #endif
 
     Bool disableCOB;
diff --git a/src/savage_video.c b/src/savage_video.c
index c999b09..57483e0 100644
--- a/src/savage_video.c
+++ b/src/savage_video.c
@@ -244,8 +244,13 @@ typedef struct {
    void         *video_memory;			/* opaque memory management information structure */
    CARD32       video_offset;			/* offset in video memory of packed YUV buffer */
 
-   void         *video_planarmem;			/* opaque memory management information structure */
+   void         *video_planarmem;		/* opaque memory management information structure */
    CARD32       video_planarbuf; 		/* offset in video memory of planar YV12 buffer */
+   
+   Bool         tried_agp;			/* TRUE if AGP allocation has been tried */
+   CARD32	agpBase;			/* Physical address of aperture base */
+   CARD32	agpBufferOffset;		/* Offset of buffer in AGP memory, or 0 if unavailable */
+   drmAddress   agpBufferMap;			/* Mapping of AGP buffer in process memory, or NULL */
 
 } SavagePortPrivRec, *SavagePortPrivPtr;
 
@@ -1030,7 +1035,8 @@ static void


Reply to: