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

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



 configure.ac     |    6 
 src/Makefile.am  |    1 
 src/binding.h    |   31 --
 src/client.h     |   40 --
 src/clientlx.c   |  848 -------------------------------------------------------
 src/mga.h        |   48 ---
 src/mga_dacG.c   |   48 ---
 src/mga_dga.c    |    2 
 src/mga_dri.c    |   82 ++---
 src/mga_driver.c |  792 +++++++--------------------------------------------
 src/mga_esc.c    |  778 --------------------------------------------------
 src/mga_exa.c    |   10 
 src/mga_macros.h |   15 
 src/mga_merge.c  |   65 ----
 src/mga_storm.c  |   10 
 src/mga_vga.c    |    8 
 src/mga_video.c  |   37 +-
 17 files changed, 207 insertions(+), 2614 deletions(-)

New commits:
commit 3991971c23ebe596742c004b1e583dfb1aa14ec4
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Fri Mar 23 19:02:40 2012 -0700

    xf86-video-mga 1.5.0
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>

diff --git a/configure.ac b/configure.ac
index 840ff3c..933500d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-mga],
-        [1.4.13],
+        [1.5.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-mga])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 4c4beaf628c9c5dd531605e40696ed31db0e97b8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Jan 4 15:15:07 2012 +1000

    Untangle XF86DRI from the driver-specific DRI define
    
    XF86DRI is defined by xorg-server.h, so --disable-dri in the driver
    itself does exactly nothing other than not fill in the CFLAGS
    and thus stop the driver from compiling.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 540c390..840ff3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,8 +100,8 @@ AC_MSG_RESULT([$DRI])
 AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
 if test "x$DRI" = xyes; then
         PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto])
-        AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
-        AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
+        AC_DEFINE(MGADRI,1,[Enable DRI driver support])
+        AC_DEFINE(MGADRI_DEVEL,1,[Enable developmental DRI driver support])
 fi
 
 save_CFLAGS="$CFLAGS"
diff --git a/src/mga.h b/src/mga.h
index fced6aa..77406f1 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -28,7 +28,11 @@
 #include "xf86DDC.h"
 #include "xf86xv.h"
 
-#ifdef XF86DRI
+#ifndef XF86DRI
+#undef MGADRI
+#endif
+
+#ifdef MGADRI
 #include "xf86drm.h"
 
 #define _XF86DRI_SERVER_
@@ -589,7 +593,7 @@ typedef struct {
     int			expandRemaining;
     int			expandHeight;
     int			expandY;
-#ifdef XF86DRI
+#ifdef MGADRI
     Bool 		directRenderingEnabled;
     DRIInfoPtr 		pDRIInfo;
     int 		drmFD;
@@ -743,7 +747,7 @@ void MGAPointerMoved(int index, int x, int y);
 void MGAInitVideo(ScreenPtr pScreen);
 void MGAResetVideo(ScrnInfoPtr pScrn);
 
-#ifdef XF86DRI
+#ifdef MGADRI
 
 #define MGA_FRONT	0x1
 #define MGA_BACK	0x2
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 00469e7..af005f1 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -101,7 +101,7 @@
 #include "shadowfb.h"
 #include "fbdevhw.h"
 
-#ifdef XF86DRI
+#ifdef MGADRI
 #include "dri.h"
 #endif
 
@@ -1532,7 +1532,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 
     pMga = MGAPTR(pScrn);
     /* Set here until dri is enabled */
-#ifdef XF86DRI
+#ifdef MGADRI
     pMga->haveQuiescense = 1;
 #endif
     /* Get the entity, and make sure it is PCI. */
@@ -1706,13 +1706,13 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     }
 
     if (pMga->DualHeadEnabled) {
-#ifdef XF86DRI
+#ifdef MGADRI
         pMga->GetQuiescence = MGAGetQuiescenceShared;
 #endif
     } else {                                              /* single-head mode */
         pMga->SecondCrtc = FALSE;
         pMga->HWCursor = TRUE;
-#ifdef XF86DRI
+#ifdef MGADRI
         pMga->GetQuiescence = MGAGetQuiescence;
 #endif
     }
@@ -1942,7 +1942,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     if (pScrn->depth == 8)
 	pScrn->rgbBits = 8;
 
-#ifdef XF86DRI
+#ifdef MGADRI
     from = X_DEFAULT;
     pMga->agpMode = MGA_DEFAULT_AGP_MODE;
 
@@ -2637,7 +2637,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	}
     }
 
-#ifdef XF86DRI
+#ifdef MGADRI
     /* Load the dri module if requested. */
     if (xf86ReturnOptValBool(pMga->Options, OPTION_DRI, FALSE)) {
        xf86LoadSubModule(pScrn, "dri");
@@ -2878,7 +2878,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     vgaReg = &hwp->ModeReg;
     mgaReg = &pMga->ModeReg;
 
-#ifdef XF86DRI
+#ifdef MGADRI
    if (pMga->directRenderingEnabled) {
        DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
    }
@@ -2989,7 +2989,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 	pMga->M1currentMode = (DisplayModePtr)mode->Private;
     }
 
-#ifdef XF86DRI
+#ifdef MGADRI
    if (pMga->directRenderingEnabled)
      DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
 #endif
@@ -3138,7 +3138,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     MGAEntPtr pMgaEnt = NULL;
     int f;
     CARD32 VRTemp, FBTemp;
-#ifdef XF86DRI
+#ifdef MGADRI
     MessageType driFrom = X_DEFAULT;
 #endif
     DPMSSetProcPtr mga_dpms_set_proc = NULL;
@@ -3317,7 +3317,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	FBStart = pMga->FbStart;
     }
 
-#ifdef XF86DRI
+#ifdef MGADRI
      /*
       * Setup DRI after visuals have been established.
       *
@@ -3473,7 +3473,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     MGAInitVideo(pScreen);
 
-#ifdef XF86DRI
+#ifdef MGADRI
     if (pMga->directRenderingEnabled) {
        /* Now that mi, drm and others have done their thing,
 	* complete the DRI setup.
@@ -3625,7 +3625,7 @@ MGAEnterVT(int scrnIndex, int flags)
 
     pMga = MGAPTR(pScrn);
 
-#ifdef XF86DRI
+#ifdef MGADRI
     if (pMga->directRenderingEnabled) {
 	if (pMga->irq) {
 	    /* Need to make sure interrupts are enabled */
@@ -3651,7 +3651,7 @@ static Bool
 MGAEnterVTFBDev(int scrnIndex, int flags)
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-#ifdef XF86DRI
+#ifdef MGADRI
     ScreenPtr pScreen;
     MGAPtr pMga;
 
@@ -3690,7 +3690,7 @@ MGALeaveVT(int scrnIndex, int flags)
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     vgaHWPtr hwp = VGAHWPTR(pScrn);
-#ifdef XF86DRI
+#ifdef MGADRI
     MGAPtr pMga = MGAPTR(pScrn);
     ScreenPtr pScreen;
 #endif
@@ -3698,7 +3698,7 @@ MGALeaveVT(int scrnIndex, int flags)
     MGARestore(pScrn);
     vgaHWLock(hwp);
 
-#ifdef XF86DRI
+#ifdef MGADRI
     if (pMga->directRenderingEnabled) {
         pScreen = screenInfo.screens[scrnIndex];
         DRILock(pScreen, 0);
@@ -3760,7 +3760,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
         pMga->FbMapSize = FBTemp;
     }
 
-#ifdef XF86DRI
+#ifdef MGADRI
    if (pMga->directRenderingEnabled) {
        MGADRICloseScreen(pScreen);
        pMga->directRenderingEnabled=FALSE;
diff --git a/src/mga_exa.c b/src/mga_exa.c
index e5eaa92..ced6452 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -41,7 +41,7 @@
 #include "mga_macros.h"
 
 #include "exa.h"
-#ifdef XF86DRI
+#ifdef MGADRI
 #include "mga_dri.h"
 #endif
 
@@ -763,7 +763,7 @@ mgaWaitMarker(ScreenPtr pScreen, int marker)
     while (INREG (MGAREG_Status) & 0x10000);
 }
 
-#ifdef XF86DRI
+#ifdef MGADRI
 static void
 init_dri(ScrnInfoPtr pScrn)
 {
@@ -837,7 +837,7 @@ init_dri(ScrnInfoPtr pScrn)
                        MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN;
     dri->backPitch = widthBytes;
 }
-#endif /* XF86DRI */
+#endif /* MGADRI */
 
 Bool
 mgaExaInit(ScreenPtr pScreen)
@@ -898,7 +898,7 @@ mgaExaInit(ScreenPtr pScreen)
     pExa->UploadToScreen = mgaUploadToScreen;
     pExa->DownloadFromScreen = mgaDownloadFromScreen;
 
-#ifdef XF86DRI
+#ifdef MGADRI
     if (pMga->directRenderingEnabled)
         init_dri(pScrn);
 #endif
diff --git a/src/mga_macros.h b/src/mga_macros.h
index 130651d..d3b0d0e 100644
--- a/src/mga_macros.h
+++ b/src/mga_macros.h
@@ -17,7 +17,7 @@
 
 #define RGBEQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
 
-#ifdef XF86DRI
+#ifdef MGADRI
 #define MGA_SYNC_XTAG                 0x275f4200
 
 #define MGABUSYWAIT() do { \
@@ -64,7 +64,7 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \
 	WAITFIFO(1); \
 	OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); }
 
-#ifdef XF86DRI
+#ifdef MGADRI
 #define CHECK_DMA_QUIESCENT(pMGA, pScrn) {	\
    if (!pMGA->haveQuiescense) {			\
       pMGA->GetQuiescence( pScrn );		\
diff --git a/src/mga_merge.c b/src/mga_merge.c
index aec3443..f355f76 100644
--- a/src/mga_merge.c
+++ b/src/mga_merge.c
@@ -316,7 +316,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
     pMga->Chipset = pMga1->Chipset;
     pMga->ChipRev = pMga1->ChipRev;
 
-#ifdef XF86DRI
+#ifdef MGADRI
     pMga->agpMode = pMga1->agpMode;
 #endif
 
diff --git a/src/mga_storm.c b/src/mga_storm.c
index f0e6194..7ac3ae0 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -24,7 +24,7 @@
 #include "miline.h"
 #include "servermd.h"
 
-#ifdef XF86DRI
+#ifdef MGADRI
 #include "GL/glxtokens.h"
 #endif
 
@@ -32,7 +32,7 @@
 #include "mga_reg.h"
 #include "mga_macros.h"
 
-#ifdef XF86DRI
+#ifdef MGADRI
 #include "mga_dri.h"
 #endif
 
@@ -797,7 +797,7 @@ Bool mgaAccelInit( ScreenPtr pScreen )
 	break;
     }
 
-#ifdef XF86DRI
+#ifdef MGADRI
     if ( pMga->directRenderingEnabled ) {
        MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo;
        BoxRec MemBox;
@@ -899,7 +899,7 @@ Bool mgaAccelInit( ScreenPtr pScreen )
 		   pMGADRIServer->textureOffset );
     }
     else
-#endif /* defined(XF86DRI) */
+#endif /* defined(MGADRI) */
     {
        AvailFBArea.x1 = 0;
        AvailFBArea.x2 = pScrn->displayWidth;

commit 9223c44a731f48c66c226eb88dcb6f9d574cb599
Author: Julien Cristau <jcristau@debian.org>
Date:   Tue Jan 3 23:35:18 2012 +0100

    When we can't load the xaa or exa modules, use shadowfb instead
    
    Signed-off-by: Julien Cristau <jcristau@debian.org>

diff --git a/src/mga_driver.c b/src/mga_driver.c
index ae36378..00469e7 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2101,6 +2101,31 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
         }
     }
 
+    /* Load XAA if needed */
+    if (!pMga->NoAccel) {
+#ifdef USE_EXA
+	if (pMga->Exa) {
+	    if (!xf86LoadSubModule(pScrn, "exa")) {
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		           "Falling back to shadowfb\n");
+		pMga->ShadowFB = TRUE;
+		pMga->NoAccel = TRUE;
+	    }
+	} else {
+#endif
+#ifdef USE_XAA
+	    if (!xf86LoadSubModule(pScrn, "xaa")) {
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		           "Falling back to shadowfb\n");
+		pMga->ShadowFB = TRUE;
+		pMga->NoAccel = TRUE;
+	    }
+#endif
+#ifdef USE_EXA
+	}
+#endif
+    }
+
     switch (pMga->Chipset) {
     case PCI_CHIP_MGA2064:
     case PCI_CHIP_MGA2164:
@@ -2596,27 +2621,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	return FALSE;
     }
 
-    /* Load XAA if needed */
-    if (!pMga->NoAccel) {
-#ifdef USE_EXA
-	if (pMga->Exa) {
-	    if (!xf86LoadSubModule(pScrn, "exa")) {
-		MGAFreeRec(pScrn);
-		return FALSE;
-	    }
-	} else {
-#endif
-#ifdef USE_XAA
-	    if (!xf86LoadSubModule(pScrn, "xaa")) {
-		MGAFreeRec(pScrn);
-		return FALSE;
-	    }
-#endif
-#ifdef USE_EXA
-	}
-#endif
-    }
-
     /* Load ramdac if needed */
     if (pMga->HWCursor) {
 	if (!xf86LoadSubModule(pScrn, "ramdac")) {

commit cc9d2e808de20723c9035952242d966455d583b7
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Wed Dec 28 19:44:40 2011 -0800

    Check MGAAllocAdaptor() for memory allocation failure
    
    If it couldn't allocate memory, don't attempt to write a bunch of values
    to the NULL pointer before returning it, but just pass the NULL along
    right away.
    
    Resolves parfait warnings of the form:
    
    Error: Null pointer dereference (CWE 476)
       Write to null pointer 'adapt'
            at line 322 of src/mga_video.c in function 'MGASetupImageVideoTexture'.
              Function 'MGAAllocAdaptor' may return constant 'NULL' at line 237, called at line 320.
              Null pointer introduced at line 237 in function 'MGAAllocAdaptor'.
    
    repeated for every line writing to the adapt pointer in each function.
    
    [ This bug was found by the Parfait 0.4.2 bug checking tool.
      For more information see http://labs.oracle.com/projects/parfait/ ]
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Mark Kettenis <kettenis@openbsd.org>

diff --git a/src/mga_video.c b/src/mga_video.c
index 784e7b1..abce31f 100644
--- a/src/mga_video.c
+++ b/src/mga_video.c
@@ -269,6 +269,8 @@ MGASetupImageVideoOverlay(ScreenPtr pScreen)
     XF86VideoAdaptorPtr adapt;
 
     adapt = MGAAllocAdaptor(pScrn, TRUE);
+    if (adapt == NULL)
+	return NULL;
 
     adapt->type = XvWindowMask | XvInputMask | XvImageMask;
     adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
@@ -316,6 +318,8 @@ MGASetupImageVideoTexture(ScreenPtr pScreen)
     MGAPtr pMga = MGAPTR(pScrn);
 
     adapt = MGAAllocAdaptor(pScrn, FALSE);
+    if (adapt == NULL)
+	return NULL;
 
     adapt->type = XvWindowMask | XvInputMask | XvImageMask;
     adapt->flags = 0;
@@ -1298,6 +1302,8 @@ MGASetupImageVideoILOAD(ScreenPtr pScreen)
     MGAPtr pMga = MGAPTR(pScrn);
 
     adapt = MGAAllocAdaptor(pScrn, FALSE);
+    if (adapt == NULL)
+	return NULL;
 
     adapt->type = XvWindowMask | XvInputMask | XvImageMask;
     adapt->flags = 0;

commit 644ba5d11049e63ea61b5cc4fb889b0f840965ff
Author: Christian Toutant <ctoutant@matrox.com>
Date:   Wed Dec 7 15:42:39 2011 -0500

    Add support for Video Memory greater then 8M
    
    Expand memory mapping of framebuffer from 8 to 16MB
    
    Fix segfault on redhat distibution
    
    Signed-off-by: Christian Toutant <ctoutant@matrox.com>

diff --git a/src/mga_driver.c b/src/mga_driver.c
index d9f6ea4..ae36378 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2707,9 +2707,18 @@ MGAMapMem(ScrnInfoPtr pScrn)
 	if (pMga->IOBase == NULL)
 	    return FALSE;
 
-	pMga->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
-				     pMga->PciTag, pMga->FbAddress,
-				     pMga->FbMapSize);
+    if (pMga->is_G200ER)
+    {
+        pMga->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+                         pMga->PciTag, pMga->FbAddress,
+                         pMga->FbMapSize);
+    }
+    else
+    {
+        pMga->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+                         pMga->PciTag, pMga->FbAddress,
+                         pMga->FbMapSize);
+    }
 	if (pMga->FbBase == NULL)
 	    return FALSE;
 #endif
@@ -3139,11 +3148,19 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     pMga = MGAPTR(pScrn);
     MGAdac = &pMga->Dac;
 
-    if (pMga->is_G200SE) {
-	VRTemp = pScrn->videoRam;
-	FBTemp = pMga->FbMapSize;
-	pScrn->videoRam = 8192;
-	pMga->FbMapSize = pScrn->videoRam * 1024;
+    if (pMga->is_G200SE)
+    {
+        VRTemp = pScrn->videoRam;
+        FBTemp = pMga->FbMapSize;
+        if (pMga->reg_1e24 >= 0x01)
+        {
+            pScrn->videoRam = 16384;
+        }
+        else
+        {
+            pScrn->videoRam = 8192;
+        }
+        pMga->FbMapSize = pScrn->videoRam * 1024;
     }
     
 
@@ -3701,10 +3718,26 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
     vgaHWPtr hwp = VGAHWPTR(pScrn);
     MGAPtr pMga = MGAPTR(pScrn);
     MGAEntPtr pMgaEnt = NULL;
+    CARD32 VRTemp, FBTemp;
 
     if (pMga->MergedFB)
          MGACloseScreenMerged(scrnIndex, pScreen);
 
+    if (pMga->is_G200SE)
+    {
+        VRTemp = pScrn->videoRam;
+        FBTemp = pMga->FbMapSize;
+        if (pMga->reg_1e24 >= 0x01)
+        {
+            pScrn->videoRam = 16384;
+        }
+        else
+        {
+            pScrn->videoRam = 8192;
+        }
+        pMga->FbMapSize = pScrn->videoRam * 1024;
+    }
+
     if (pScrn->vtSema) {
 	if (pMga->FBDev) {
 	    fbdevHWRestore(pScrn);
@@ -3716,6 +3749,13 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
 	    vgaHWUnmapMem(pScrn);
 	}
     }
+
+    if (pMga->is_G200SE)
+    {
+        pScrn->videoRam = VRTemp;
+        pMga->FbMapSize = FBTemp;
+    }
+
 #ifdef XF86DRI
    if (pMga->directRenderingEnabled) {
        MGADRICloseScreen(pScreen);

commit d9cf07a4f424b2beb844ea1b3ec5d468e79a747c
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat Oct 29 16:34:41 2011 -0700

    Include "xf86Modes.h" for xf86ModeBandwidth
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/mga_driver.c b/src/mga_driver.c
index 4af36ca..d9f6ea4 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -52,6 +52,10 @@
 #include "xf86.h"
 #include "xf86_OSproc.h"
 
+#ifdef HAVE_XF86MODEBANDWIDTH
+#include "xf86Modes.h"
+#endif
+
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
 #include "xf86Resources.h"
 #include "xf86RAC.h"

commit f9acf37be49844bea8165be9786afe37fd999229
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat Oct 29 16:31:08 2011 -0700

    Include <unistd.h> for usleep
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/mga_vga.c b/src/mga_vga.c
index 0ac8bf7..8f52951 100644
--- a/src/mga_vga.c
+++ b/src/mga_vga.c
@@ -2,6 +2,8 @@
 #include "config.h"
 #endif
 
+#include <unistd.h>
+
 #include "misc.h"
 #include "xf86.h"
 #include "xf86_OSproc.h"

commit 07792ef41f33aa5419168263637e34ee614f26e2
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Sep 26 22:38:17 2011 -0400

    Remove calls to xf86IsPc98()
    
    Reviewed-by: Jamey Sharp <jamey@minilop.net>
    Signed-off-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/mga_driver.c b/src/mga_driver.c
index dcbfabf..4af36ca 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2164,7 +2164,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     /*
      * Reset card if it isn't primary one
      */
-    if ( (!pMga->Primary && !pMga->FBDev) || xf86IsPc98() )
+    if ( (!pMga->Primary && !pMga->FBDev) )
         MGASoftReset(pScrn);
 
     if (pScrn->videoRam == 0) {
@@ -2878,13 +2878,6 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 	vgaHWProtect(pScrn, FALSE);
     }
 
-    if (xf86IsPc98()) {
-	if (pMga->Chipset == PCI_CHIP_MGA2064)
-	    outb(0xfac, 0x01);
-	else
-	    outb(0xfac, 0x02);
-    }
-
     /* Reset tagfifo*/ 
 	if (pMga->is_G200ER) 
     {
@@ -3680,8 +3673,6 @@ MGALeaveVT(int scrnIndex, int flags)
     MGARestore(pScrn);
     vgaHWLock(hwp);
 
-    if (xf86IsPc98())
-	outb(0xfac, 0x00);
 #ifdef XF86DRI
     if (pMga->directRenderingEnabled) {
         pScreen = screenInfo.screens[scrnIndex];
@@ -3755,9 +3746,6 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
 
     pScrn->vtSema = FALSE;
 
-    if (xf86IsPc98())
-	outb(0xfac, 0x00);
-
     xf86ClearPrimInitDone(pScrn->entityList[0]);
 
     if(pMga->BlockHandler)
diff --git a/src/mga_merge.c b/src/mga_merge.c
index c1cf2eb..aec3443 100644
--- a/src/mga_merge.c
+++ b/src/mga_merge.c
@@ -385,7 +385,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
     /*
      * Reset card if it isn't primary one
      */
-    if ( (!pMga->Primary && !pMga->FBDev) || xf86IsPc98() )
+    if ( (!pMga->Primary && !pMga->FBDev) )
         MGASoftReset(pScrn);
 
     

commit 560967b4ffdb103f95121c43708dd5fc680a5045
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Sep 26 22:37:04 2011 -0400

    Fix printf format specifier warning
    
    Signed-off-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/mga_exa.c b/src/mga_exa.c
index f292327..e5eaa92 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -865,7 +865,7 @@ mgaExaInit(ScreenPtr pScreen)
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "X %d Y %d bpp %d\n",
                pScrn->virtualX, pScrn->virtualY, pScrn->bitsPerPixel);
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Start at %p, size %x, osb %x\n",
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Start at %p, size %lx, osb %lx\n",
                pExa->memoryBase, pExa->memorySize, pExa->offScreenBase);
 
     /* In PW24 mode, we need to align to "3 64-bytes" */

commit 1036e32e006d496023553ea566cb13ae93933719
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Sep 26 22:35:48 2011 -0400

    Remove if(E != NULL) checks around free(E)
    
    Reviewed-by: Jamey Sharp <jamey@minilop.net>
    Signed-off-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/mga_dri.c b/src/mga_dri.c
index 957c6df..1454994 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -1011,8 +1011,8 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, DDXPointRec ptOldOrg,
 	    pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec)*nbox);
 	    pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec)*nbox);
 	    if (!pboxNew2 || !pptNew2) {
-	        if (pptNew2) free(pptNew2);
-	        if (pboxNew2) free(pboxNew2);
+	        free(pptNew2);
+	        free(pboxNew2);
 	        if (pboxNew1) {
 		    free(pptNew1);
 		    free(pboxNew1);
@@ -1494,21 +1494,13 @@ void MGADRICloseScreen( ScreenPtr pScreen )
    DRICloseScreen( pScreen );
 
    if ( pMga->pDRIInfo ) {
-      if ( pMga->pDRIInfo->devPrivate ) {
-	 free( pMga->pDRIInfo->devPrivate );
-	 pMga->pDRIInfo->devPrivate = 0;
-      }
+      free(pMga->pDRIInfo->devPrivate);
+      pMga->pDRIInfo->devPrivate = 0;
       DRIDestroyInfoRec( pMga->pDRIInfo );
       pMga->pDRIInfo = 0;
    }
-   if ( pMga->DRIServerInfo ) {
-      free(pMga->DRIServerInfo);
-      pMga->DRIServerInfo = 0;
-   }
-   if ( pMga->pVisualConfigs ) {
-      free(pMga->pVisualConfigs);
-   }
-   if ( pMga->pVisualConfigsPriv ) {
-      free( pMga->pVisualConfigsPriv );
-   }
+   free(pMga->DRIServerInfo);
+   pMga->DRIServerInfo = 0;
+   free(pMga->pVisualConfigs);
+   free(pMga->pVisualConfigsPriv);
 }
diff --git a/src/mga_driver.c b/src/mga_driver.c
index d4ae346..dcbfabf 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -644,8 +644,6 @@ MGAGetRec(ScrnInfoPtr pScrn)
 void
 MGAFreeRec(ScrnInfoPtr pScrn)
 {
-    if (pScrn->driverPrivate == NULL)
-	return;
     free(pScrn->driverPrivate);
     pScrn->driverPrivate = NULL;
 }
@@ -2430,8 +2428,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 			      pMga->FbMapSize,
 			      LOOKUP_BEST_REFRESH);
       
-	if (linePitches)
-	   free(linePitches);
+	free(linePitches);
     }
 
     if (i < 1 && pMga->FBDev) {
@@ -3750,16 +3747,11 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
 #endif
     if (pMga->CursorInfoRec)
     	xf86DestroyCursorInfoRec(pMga->CursorInfoRec);
-    if (pMga->ShadowPtr)
-	free(pMga->ShadowPtr);
-    if (pMga->DGAModes)
-	free(pMga->DGAModes);
-    if (pMga->adaptor)
-	free(pMga->adaptor);
-    if (pMga->portPrivate)
-	free(pMga->portPrivate);
-    if (pMga->ScratchBuffer)
-	free(pMga->ScratchBuffer);
+    free(pMga->ShadowPtr);
+    free(pMga->DGAModes);
+    free(pMga->adaptor);
+    free(pMga->portPrivate);
+    free(pMga->ScratchBuffer);
 
     pScrn->vtSema = FALSE;
 
diff --git a/src/mga_merge.c b/src/mga_merge.c
index e3216c9..c1cf2eb 100644
--- a/src/mga_merge.c
+++ b/src/mga_merge.c
@@ -528,8 +528,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
 			      pMga->FbMapSize,
 			      LOOKUP_BEST_REFRESH);
         
-	if (linePitches)
-	   free(linePitches);
+	free(linePitches);
     }
 
 
@@ -892,8 +891,7 @@ MGACloseScreenMerged(int scrnIndex, ScreenPtr pScreen) {
         pScrn1->currentMode = pScrn1->modes;
         do {
             DisplayModePtr p = pScrn1->currentMode->next; 
-            if(pScrn1->currentMode->Private) 
-                free(pScrn1->currentMode->Private);
+            free(pScrn1->currentMode->Private);
             free(pScrn1->currentMode);
             pScrn1->currentMode = p;
         }while( pScrn1->currentMode != pScrn1->modes);
diff --git a/src/mga_video.c b/src/mga_video.c
index beb5a3c..784e7b1 100644
--- a/src/mga_video.c
+++ b/src/mga_video.c
@@ -146,8 +146,7 @@ void MGAInitVideo(ScreenPtr pScreen)
     if(num_adaptors)
         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 
-    if(newAdaptors)
-	free(newAdaptors);
+    free(newAdaptors);
 }
 
 /* client libraries expect an encoding */

commit ee09a9a340f8946f2d4a71a431b64189dbb5c256
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Sep 26 22:22:09 2011 -0400

    Remove xalloc/xcalloc/xrealloc/xfree
    
    Reviewed-by: Jamey Sharp <jamey@minilop.net>
    Signed-off-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/mga_dga.c b/src/mga_dga.c
index d43b96d..224e4ba 100644
--- a/src/mga_dga.c
+++ b/src/mga_dga.c
@@ -111,7 +111,7 @@ SECOND_PASS:
 	    if(secondPitch)
 		pitch = secondPitch; 
 
-	    if(!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec))))
+	    if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
 		break;
 
 	    modes = newmodes;
diff --git a/src/mga_dri.c b/src/mga_dri.c
index 14f342f..957c6df 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -91,24 +91,24 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen )
    case 16:
       numConfigs = 8;
 
-      pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig),
+      pConfigs = (__GLXvisualConfig*)calloc( sizeof(__GLXvisualConfig),
 						numConfigs );
       if ( !pConfigs ) {
 	 return FALSE;
       }
 
-      pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec),
+      pMGAConfigs = (MGAConfigPrivPtr)calloc( sizeof(MGAConfigPrivRec),
 						 numConfigs );
       if ( !pMGAConfigs ) {
-	 xfree( pConfigs );
+	 free(pConfigs);
 	 return FALSE;
       }
 
-      pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr),
+      pMGAConfigPtrs = (MGAConfigPrivPtr*)calloc( sizeof(MGAConfigPrivPtr),
 						     numConfigs );
       if ( !pMGAConfigPtrs ) {
-	 xfree( pConfigs );
-	 xfree( pMGAConfigs );
+	 free(pConfigs);
+	 free(pMGAConfigs);
 	 return FALSE;
       }
 
@@ -182,24 +182,24 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen )
    case 32:
       numConfigs = 8;
 
-      pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig),
+      pConfigs = (__GLXvisualConfig*)calloc( sizeof(__GLXvisualConfig),
 						numConfigs );
       if ( !pConfigs ) {
 	 return FALSE;
       }
 
-      pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec),
+      pMGAConfigs = (MGAConfigPrivPtr)calloc( sizeof(MGAConfigPrivRec),
 						 numConfigs );
       if ( !pMGAConfigs ) {
-	 xfree( pConfigs );
+	 free(pConfigs);
 	 return FALSE;
       }
 
-      pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr),
+      pMGAConfigPtrs = (MGAConfigPrivPtr*)calloc( sizeof(MGAConfigPrivPtr),
 						     numConfigs );
       if ( !pMGAConfigPtrs ) {
-	 xfree( pConfigs );
-	 xfree( pMGAConfigs );
+	 free(pConfigs);
+	 free(pMGAConfigs);
 	 return FALSE;
       }
 
@@ -973,11 +973,11 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, DDXPointRec ptOldOrg,
 
         if (nbox>1) {
 	    /* Keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
+	    pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec)*nbox);
 	    if (!pboxNew1) return;
-	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
+	    pptNew1 = (DDXPointPtr)malloc(sizeof(DDXPointRec)*nbox);
 	    if (!pptNew1) {
-	        xfree(pboxNew1);
+	        free(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -1008,14 +1008,14 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, DDXPointRec ptOldOrg,
 
         if (nbox > 1) {
 	    /*reverse orderof rects in each band */
-	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec)*nbox);
-	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec)*nbox);
+	    pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec)*nbox);
+	    pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec)*nbox);
 	    if (!pboxNew2 || !pptNew2) {
-	        if (pptNew2) xfree(pptNew2);
-	        if (pboxNew2) xfree(pboxNew2);
+	        if (pptNew2) free(pptNew2);
+	        if (pboxNew2) free(pboxNew2);
 	        if (pboxNew1) {
-		    xfree(pptNew1);
-		    xfree(pboxNew1);
+		    free(pptNew1);
+		    free(pboxNew1);
 		}
 	       return;
 	    }
@@ -1066,12 +1066,12 @@ static void MGADRIMoveBuffersXAA(WindowPtr pParent, DDXPointRec ptOldOrg,


Reply to: