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

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



 Makefile.am      |    2 
 README           |   20 ++
 configure.ac     |   11 +
 man/mga.man      |    2 
 src/mga_bios.c   |    5 
 src/mga_dacG.c   |  375 +++++++++++++++++++++++++++++++++++--------------------
 src/mga_dh.c     |    4 
 src/mga_driver.c |  325 ++++++++++++++++++++++++++---------------------
 src/mga_exa.c    |    5 
 src/mga_storm.c  |   14 ++
 10 files changed, 477 insertions(+), 286 deletions(-)

New commits:
commit 626af26098ab5d0823bf1d6c08157b4c89ec578a
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Apr 27 14:01:03 2009 -0400

    mga 1.4.10

diff --git a/configure.ac b/configure.ac
index f0119dd..3a04b21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,9 +22,8 @@
 
 AC_PREREQ(2.57)
 
-# When the version number is modified here, also modify it in src/mga.h.
 AC_INIT([xf86-video-mga],
-        1.4.9,
+        1.4.10,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-mga)
 

commit d33b06038223b2b121be7e3f8c207de5f518b28c
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Apr 27 14:00:00 2009 -0400

    Fix ChangeLog generation

diff --git a/Makefile.am b/Makefile.am
index 59e0db2..44f8234 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,6 @@ EXTRA_DIST = README_HALLIB mga_PInS.txt ChangeLog
 .PHONY: ChangeLog
 
 ChangeLog:
-	(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+	(GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
 
 dist-hook: ChangeLog

commit 06b6ead9a1b367e08ed6b3e75dfde0ee3b4a82b8
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Apr 27 13:37:42 2009 -0400

    G200SE: Only force 16bpp on low-memory cards

diff --git a/src/mga_driver.c b/src/mga_driver.c
index 6876f6c..e229984 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2045,7 +2045,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	pScrn->videoRam = MGACountRam(pScrn);
     }
 
-    if (pMga->is_G200SE)
+    if (pMga->is_G200SE && pScrn->videoRam < 2048)
 	pScrn->confScreen->defaultdepth = 16;
 
     if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) {

commit 8b84fe236a42336e87048317880cc437494655f1
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Apr 27 13:36:45 2009 -0400

    Move device ID and memory sizing much earlier in setup

diff --git a/src/mga_driver.c b/src/mga_driver.c
index fcb9127..6876f6c 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -1907,8 +1907,106 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 #endif
     }
 
-   
-    
+    if (!(pMga->Options = xalloc(sizeof(MGAOptions))))
+	return FALSE;
+    memcpy(pMga->Options, MGAOptions, sizeof(MGAOptions));
+
+    /* ajv changes to reflect actual values. see sdk pp 3-2. */
+    /* these masks just get rid of the crap in the lower bits */
+
+    /* For the 2064 and older rev 1064, base0 is the MMIO and base1 is
+     * the framebuffer.
+     */
+
+    switch (pMga->chip_attribs->BARs) {
+    case old_BARs:
+	pMga->framebuffer_bar = 1;
+	pMga->io_bar = 0;
+	pMga->iload_bar = -1;
+	break;
+    case probe_BARs:
+	if (pMga->ChipRev < 3) {
+	    pMga->framebuffer_bar = 1;
+	    pMga->io_bar = 0;
+	    pMga->iload_bar = 2;
+	    break;
+	}
+	/* FALLTHROUGH */
+    case new_BARs:
+	pMga->framebuffer_bar = 0;
+	pMga->io_bar = 1;
+	pMga->iload_bar = 2;
+	break;
+    }
+
+#ifdef XSERVER_LIBPCIACCESS
+    pMga->FbAddress = pMga->PciInfo->regions[pMga->framebuffer_bar].base_addr;
+#else
+    pMga->FbAddress = pMga->PciInfo->memBase[pMga->framebuffer_bar] & 0xff800000;
+#endif
+
+    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Linear framebuffer at 0x%lX\n",
+	       (unsigned long)pMga->FbAddress);
+
+#ifdef XSERVER_LIBPCIACCESS
+    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO registers at 0x%lX\n",
+	       (unsigned long) pMga->PciInfo->regions[pMga->io_bar].base_addr);
+#else
+    pMga->IOAddress = pMga->PciInfo->memBase[pMga->io_bar] & 0xffffc000;
+
+    xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
+	       (unsigned long)pMga->IOAddress);
+#endif
+
+    if (pMga->iload_bar != -1) {
+#ifdef XSERVER_LIBPCIACCESS
+	xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+		   "Pseudo-DMA transfer window at 0x%lX\n",
+		   (unsigned long) pMga->PciInfo->regions[pMga->iload_bar].base_addr);
+#else
+	if (pMga->PciInfo->memBase[2] != 0) {
+	    pMga->ILOADAddress = pMga->PciInfo->memBase[2] & 0xffffc000;
+	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+		       "Pseudo-DMA transfer window at 0x%lX\n",
+		       (unsigned long)pMga->ILOADAddress);
+	}
+#endif
+    }
+
+#ifndef XSERVER_LIBPCIACCESS
+    /*
+     * Find the BIOS base.  Get it from the PCI config if possible.  Otherwise
+     * use the VGA default.  Allow the config file to override this.
+     */
+
+    pMga->BiosFrom = X_NONE;
+    if (pMga->device->BiosBase != 0) {
+	/* XXX This isn't used */
+	pMga->BiosAddress = pMga->device->BiosBase;
+	pMga->BiosFrom = X_CONFIG;
+    } else {
+	/* details: rombase sdk pp 4-15 */
+	if (pMga->PciInfo->biosBase != 0) {
+	    pMga->BiosAddress = pMga->PciInfo->biosBase & 0xffff0000;
+	    pMga->BiosFrom = X_PROBED;
+	} else if (pMga->Primary) {
+	    pMga->BiosAddress = 0xc0000;
+	    pMga->BiosFrom = X_DEFAULT;
+	}
+    }
+    if (pMga->BiosAddress) {
+	xf86DrvMsg(pScrn->scrnIndex, pMga->BiosFrom, "BIOS at 0x%lX\n",
+		   (unsigned long)pMga->BiosAddress);
+    }
+#endif
+
+    if (xf86RegisterResources(pMga->pEnt->index, NULL, ResExclusive)) {
+	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		"xf86RegisterResources() found resource conflicts\n");
+	MGAFreeRec(pScrn);
+	return FALSE;
+    }
+
     /*
      * The first thing we should figure out is the depth, bpp, etc.
      * Our default depth is 8, so pass it to the helper function.
@@ -1921,6 +2019,32 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     if (pMga->SecondCrtc)
 	flags24 = Support32bppFb;
 
+    if (xf86ReturnOptValBool(pMga->Options, OPTION_FBDEV, FALSE)) {
+	pMga->FBDev = TRUE;
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+		"Using framebuffer device\n");
+	/* check for linux framebuffer device */
+	if (!xf86LoadSubModule(pScrn, "fbdevhw"))
+	    return FALSE;
+	xf86LoaderReqSymLists(fbdevHWSymbols, NULL);
+	if (!fbdevHWInit(pScrn, pMga->PciInfo, NULL))
+	    return FALSE;
+    }
+
+    /*
+     * If the user has specified the amount of memory in the XF86Config
+     * file, we respect that setting.
+     */
+    from = X_PROBED;
+    if (pMga->device->videoRam != 0) {
+	pScrn->videoRam = pMga->device->videoRam;
+	from = X_CONFIG;
+    } else if (pMga->FBDev) {
+	pScrn->videoRam = fbdevHWGetVidmem(pScrn)/1024;
+    } else {
+	pScrn->videoRam = MGACountRam(pScrn);
+    }
+
     if (pMga->is_G200SE)
 	pScrn->confScreen->defaultdepth = 16;
 
@@ -1971,9 +2095,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     xf86CollectOptions(pScrn, NULL);
 
     /* Process the options */
-    if (!(pMga->Options = xalloc(sizeof(MGAOptions))))
-	return FALSE;
-    memcpy(pMga->Options, MGAOptions, sizeof(MGAOptions));
     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pMga->Options);
 
     if (pMga->is_G200SE) {
@@ -2122,11 +2243,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Using \"Shadow Framebuffer\" - acceleration disabled\n");
     }
-    if (xf86ReturnOptValBool(pMga->Options, OPTION_FBDEV, FALSE)) {
-	pMga->FBDev = TRUE;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-		"Using framebuffer device\n");
-    }
     if (xf86ReturnOptValBool(pMga->Options, OPTION_OVERCLOCK_MEM, FALSE)) {
 	pMga->OverclockMem = TRUE;
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overclocking memory\n");
@@ -2170,12 +2286,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
         } /* ISMGAGx50() */
     }
     if (pMga->FBDev) {
-	/* check for linux framebuffer device */
-	if (!xf86LoadSubModule(pScrn, "fbdevhw"))
-	    return FALSE;
-	xf86LoaderReqSymLists(fbdevHWSymbols, NULL);
-	if (!fbdevHWInit(pScrn, pMga->PciInfo, NULL))
-	    return FALSE;
 	pScrn->SwitchMode    = fbdevHWSwitchModeWeak();
 	pScrn->AdjustFrame   = fbdevHWAdjustFrameWeak();
 	pScrn->EnterVT       = MGAEnterVTFBDev;
@@ -2233,105 +2343,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	break;
     }
 
-    /* ajv changes to reflect actual values. see sdk pp 3-2. */
-    /* these masks just get rid of the crap in the lower bits */
-
-    /* For the 2064 and older rev 1064, base0 is the MMIO and base1 is
-     * the framebuffer.
-     */
-
-    switch (pMga->chip_attribs->BARs) {
-    case old_BARs:
-	pMga->framebuffer_bar = 1;
-	pMga->io_bar = 0;
-	pMga->iload_bar = -1;
-	break;
-    case probe_BARs:
-	if (pMga->ChipRev < 3) {
-	    pMga->framebuffer_bar = 1;
-	    pMga->io_bar = 0;
-	    pMga->iload_bar = 2;
-	    break;
-	}
-	/* FALLTHROUGH */
-    case new_BARs:
-	pMga->framebuffer_bar = 0;
-	pMga->io_bar = 1;
-	pMga->iload_bar = 2;
-	break;
-    }
-
-
-#ifdef XSERVER_LIBPCIACCESS
-    pMga->FbAddress = pMga->PciInfo->regions[pMga->framebuffer_bar].base_addr;
-#else
-    pMga->FbAddress = pMga->PciInfo->memBase[pMga->framebuffer_bar] & 0xff800000;
-#endif
-
-    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Linear framebuffer at 0x%lX\n",
-	       (unsigned long)pMga->FbAddress);
-
-#ifdef XSERVER_LIBPCIACCESS
-    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO registers at 0x%lX\n",
-	       (unsigned long) pMga->PciInfo->regions[pMga->io_bar].base_addr);
-#else
-    pMga->IOAddress = pMga->PciInfo->memBase[pMga->io_bar] & 0xffffc000;
-
-    xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
-	       (unsigned long)pMga->IOAddress);
-#endif
-
-    if (pMga->iload_bar != -1) {
-#ifdef XSERVER_LIBPCIACCESS
-	xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-		   "Pseudo-DMA transfer window at 0x%lX\n",
-		   (unsigned long) pMga->PciInfo->regions[pMga->iload_bar].base_addr);
-#else
-	if (pMga->PciInfo->memBase[2] != 0) {
-	    pMga->ILOADAddress = pMga->PciInfo->memBase[2] & 0xffffc000;
-	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-		       "Pseudo-DMA transfer window at 0x%lX\n",
-		       (unsigned long)pMga->ILOADAddress);
-	}
-#endif
-    }
-
-
-#ifndef XSERVER_LIBPCIACCESS
-    /*
-     * Find the BIOS base.  Get it from the PCI config if possible.  Otherwise
-     * use the VGA default.  Allow the config file to override this.
-     */
-
-    pMga->BiosFrom = X_NONE;
-    if (pMga->device->BiosBase != 0) {
-	/* XXX This isn't used */
-	pMga->BiosAddress = pMga->device->BiosBase;
-	pMga->BiosFrom = X_CONFIG;
-    } else {
-	/* details: rombase sdk pp 4-15 */
-	if (pMga->PciInfo->biosBase != 0) {
-	    pMga->BiosAddress = pMga->PciInfo->biosBase & 0xffff0000;
-	    pMga->BiosFrom = X_PROBED;
-	} else if (pMga->Primary) {
-	    pMga->BiosAddress = 0xc0000;
-	    pMga->BiosFrom = X_DEFAULT;
-	}
-    }
-    if (pMga->BiosAddress) {
-	xf86DrvMsg(pScrn->scrnIndex, pMga->BiosFrom, "BIOS at 0x%lX\n",
-		   (unsigned long)pMga->BiosAddress);
-    }
-#endif
-
-
-    if (xf86RegisterResources(pMga->pEnt->index, NULL, ResExclusive)) {
-	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		"xf86RegisterResources() found resource conflicts\n");
-	MGAFreeRec(pScrn);
-	return FALSE;
-    }
-
     /*
      * Read the BIOS data struct
      */
@@ -2379,20 +2390,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     if ( (!pMga->Primary && !pMga->FBDev) || xf86IsPc98() )
         MGASoftReset(pScrn);
 
-    /*
-     * If the user has specified the amount of memory in the XF86Config
-     * file, we respect that setting.
-     */
-    from = X_PROBED;
-    if (pMga->device->videoRam != 0) {
-	pScrn->videoRam = pMga->device->videoRam;
-	from = X_CONFIG;
-    } else if (pMga->FBDev) {
-	pScrn->videoRam = fbdevHWGetVidmem(pScrn)/1024;
-    } else {
-	pScrn->videoRam = MGACountRam(pScrn);
-    }
-
     if (pScrn->videoRam == 0) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "Unable to detect video RAM.\n");

commit 9a82c5db3f8332d10b31d68e5b86d3a6b136dc5e
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Apr 27 13:26:03 2009 -0400

    Fix xf86ModeBandwidth check

diff --git a/configure.ac b/configure.ac
index 923b434..f0119dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,10 +109,16 @@ CFLAGS="$XORG_CFLAGS"
 AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
               [XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no],
               [#include "xorg-server.h"])
+CFLAGS="$save_CFLAGS"
+
+save_CFLAGS="$CFLAGS"
+CFLAGS="$XORG_CFLAGS"
 AC_CHECK_DECL(xf86ModeBandwidth,
 	      [AC_DEFINE(HAVE_XF86MODEBANDWIDTH, 1, [Have xf86ModeBandwidth])],
 	      [],
-	      [#include "xf86Modes.h"])
+	      [#include <X11/extensions/randr.h>
+	       #include "xorg-server.h"
+	       #include "xf86Modes.h"])
 CFLAGS="$save_CFLAGS"
 
 if test "x$XSERVER_LIBPCIACCESS" = xyes; then

commit 58888aefd0bad7bfca231ec7a54865d9c26c8095
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Apr 27 13:19:42 2009 -0400

    Remove a leftover from overlay support

diff --git a/src/mga_driver.c b/src/mga_driver.c
index e929311..fcb9127 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -492,7 +492,6 @@ static const OptionInfoRec MGAOptions[] = {
     { OPTION_SYNC_ON_GREEN,	"SyncOnGreen",	OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_NOACCEL,		"NoAccel",	OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_SHOWCACHE,		"ShowCache",	OPTV_BOOLEAN,	{0}, FALSE },
-    { OPTION_OVERLAY,		"Overlay",	OPTV_ANYSTR,	{0}, FALSE },
     { OPTION_MGA_SDRAM,		"MGASDRAM",	OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_SHADOW_FB,		"ShadowFB",	OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_FBDEV,		"UseFBDev",	OPTV_BOOLEAN,	{0}, FALSE },
@@ -1916,17 +1915,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
      * We support both 24bpp and 32bpp layouts, so indicate that.
      */
 
-    /* Prefer 24bpp fb unless the Overlay option is set, or DRI is
-     * supported.
-     */
-    flags24 = Support24bppFb | Support32bppFb | SupportConvert32to24;
-    s = xf86TokenToOptName(MGAOptions, OPTION_OVERLAY);
-#ifndef XF86DRI
-    if (!(xf86FindOption(pScrn->confScreen->options, s) ||
-	  xf86FindOption(pMga->device->options, s))) {
-	flags24 |= PreferConvert32to24;
-    }
-#endif
+    /* Prefer 32bpp */
+    flags24 = Support24bppFb | Support32bppFb | PreferConvert24to32;
 
     if (pMga->SecondCrtc)
 	flags24 = Support32bppFb;

commit 19c44d537e982fcf0fe2dc9f3273ac6166302510
Author: Yannick Heneault <yheneaul@matrox.com>
Date:   Tue Apr 21 10:00:24 2009 -0400

    Fixed bad vga access in memory count routine.

diff --git a/src/mga_driver.c b/src/mga_driver.c
index 7ed5c27..e929311 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -1346,7 +1346,7 @@ MGACountRam(ScrnInfoPtr pScrn)
 		base[Offset+0x100] = 0x55;
 		base[Offset+0x101] = 0xaa;
 
-		OUTREG(MGAREG_CRTC_INDEX, 0);
+		OUTREG8(MGAREG_CRTC_INDEX, 0);
 		usleep(8);
 
 		TestMemoryLocA = base[Offset];

commit 2388c4d512554258bce2b78c8f8aa1151b161c3e
Author: Yannick Heneault <yheneaul@matrox.com>
Date:   Tue Apr 21 09:51:34 2009 -0400

    Force pitch of 1024 for G200SE Pilot1 when edid is used as modeline.

diff --git a/src/mga_driver.c b/src/mga_driver.c
index 7c67405..7ed5c27 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2638,9 +2638,13 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	case PCI_CHIP_MGAG100_PCI:
 	   maxPitch = 2048;
 	   break;
+	case PCI_CHIP_MGAG200_SE_A_PCI:
+	   if (pScrn->videoRam < 2048){
+	       maxPitch = 1024;
+	   }
+	   break;
 	case PCI_CHIP_MGAG200:
 	case PCI_CHIP_MGAG200_PCI:
-	case PCI_CHIP_MGAG200_SE_A_PCI:
 	case PCI_CHIP_MGAG200_SE_B_PCI:
         case PCI_CHIP_MGAG200_WINBOND_PCI:
 	case PCI_CHIP_MGAG200_EV_PCI:
@@ -2664,6 +2668,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
 	   xfree(linePitches);
     }
 
+    /* Some X compute displayWidth from inferred virtual without
+       checking pitch limit. */
+    if(pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI && pScrn->videoRam < 2048)
+        pScrn->displayWidth = 1024;
 
     if (i < 1 && pMga->FBDev) {
 	fbdevHWUseBuildinMode(pScrn);

commit 32bc0bcec815a363a47b9e7337d06370baf0c0d4
Author: Stefan Dirsch <sndirsch@suse.de>
Date:   Thu Apr 16 15:34:12 2009 +0200

    Prevent MergedFB setups from crashing.
    
    Second time mga_read_and_process_bios() is called pMga->chip_attribs
    is a NULL pointer for some reason. (#21022)

diff --git a/src/mga_bios.c b/src/mga_bios.c
index b78890e..c015077 100644
--- a/src/mga_bios.c
+++ b/src/mga_bios.c
@@ -326,8 +326,9 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
      * isn't found or can't be read we'll still have some reasonable values
      * to use.
      */
-    (void) memcpy(& pMga->bios, & pMga->chip_attribs->default_bios_values,
-		  sizeof(struct mga_bios_values));
+    if (pMga->chip_attribs)
+	(void) memcpy(& pMga->bios, & pMga->chip_attribs->default_bios_values,
+                      sizeof(struct mga_bios_values));
 
 
     /* If the BIOS address was probed, it was found from the PCI config space

commit 70681daa0392e5fa413f888d92a30ddacdcc9c8c
Author: Yannick Heneault <yheneaul@matrox.com>
Date:   Tue Mar 31 11:41:00 2009 -0400

    Fixed G200SE PLL selection routine of m,n,p.

diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index 88a12cb..c98ae97 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -55,9 +55,8 @@ static void MGAGLoadPalette(ScrnInfoPtr, int, int*, LOCO*, VisualPtr);
 static Bool MGAG_i2cInit(ScrnInfoPtr pScrn);
 
 static void
-MGAG200IPComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
+MGAG200SEComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
 {
-    MGAPtr pMga = MGAPTR(pScrn);
     unsigned int ulComputedFo;
     unsigned int ulFDelta;
     unsigned int ulFPermitedDelta;
@@ -67,43 +66,68 @@ MGAG200IPComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
     unsigned int ulTestM;
     unsigned int ulTestN;
     unsigned int ulPLLFreqRef;
-    unsigned int ulTestPStart;
-    unsigned int ulTestNStart;
-    unsigned int ulTestNEnd;
-    unsigned int ulTestMStart;
-    unsigned int ulTestMEnd;
 
-    if (pMga->is_G200SE) {
-        ulVCOMax        = 320000;
-        ulVCOMin        = 160000;
-        ulPLLFreqRef    = 25000;
-        ulTestPStart    = 8;
-        ulTestNStart    = 17;
-        ulTestNEnd      = 32;
-        ulTestMStart    = 1;
-        ulTestMEnd      = 32;
-    } else { /* pMga->is_G200EV */
-        ulVCOMax        = 550000;
-        ulVCOMin        = 150000;
-        ulPLLFreqRef    = 50000;
-        ulTestPStart    = 16;
-        ulTestNStart    = 1;
-        ulTestNEnd      = 256;
-        ulTestMStart    = 1;
-        ulTestMEnd      = 16;
+    ulVCOMax        = 320000;
+    ulVCOMin        = 160000;
+    ulPLLFreqRef    = 25000;
+
+    ulFDelta = 0xFFFFFFFF;
+    /* Permited delta is 0.5% as VESA Specification */
+    ulFPermitedDelta = lFo * 5 / 1000;  
+
+    /* Then we need to minimize the M while staying within 0.5% */
+    for (ulTestP = 8; ulTestP > 0; ulTestP >>= 1) {
+        if ((lFo * ulTestP) > ulVCOMax) continue;
+        if ((lFo * ulTestP) < ulVCOMin) continue;
+
+        for (ulTestN = 17; ulTestN <= 256; ulTestN++) {
+            for (ulTestM = 1; ulTestM <= 32; ulTestM++) {
+                ulComputedFo = (ulPLLFreqRef * ulTestN) / (ulTestM * ulTestP);
+                if (ulComputedFo > lFo)
+                    ulFTmpDelta = ulComputedFo - lFo;
+                else
+                    ulFTmpDelta = lFo - ulComputedFo;
+
+                if (ulFTmpDelta < ulFDelta) {
+                    ulFDelta = ulFTmpDelta;
+                    *M = ulTestM - 1;
+                    *N = ulTestN - 1;
+                    *P = ulTestP - 1;
+                }
+            }
+        }
     }
+}
+
+static void
+MGAG200EVComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
+{
+    unsigned int ulComputedFo;
+    unsigned int ulFDelta;
+    unsigned int ulFPermitedDelta;
+    unsigned int ulFTmpDelta;
+    unsigned int ulTestP;
+    unsigned int ulTestM;
+    unsigned int ulTestN;
+    unsigned int ulVCOMax;
+    unsigned int ulVCOMin;
+    unsigned int ulPLLFreqRef;
+
+    ulVCOMax        = 550000;
+    ulVCOMin        = 150000;
+    ulPLLFreqRef    = 50000;
 
     ulFDelta = 0xFFFFFFFF;
     /* Permited delta is 0.5% as VESA Specification */
     ulFPermitedDelta = lFo * 5 / 1000;  
 
     /* Then we need to minimize the M while staying within 0.5% */
-    for (ulTestP = ulTestPStart; ulTestP > 0; ulTestP--) {
+    for (ulTestP = 16; ulTestP > 0; ulTestP--) {
 	if ((lFo * ulTestP) > ulVCOMax) continue;
 	if ((lFo * ulTestP) < ulVCOMin) continue;
 
-	for (ulTestN = ulTestNStart; ulTestN <= ulTestNEnd; ulTestN++) {
-	    for (ulTestM = ulTestMStart; ulTestM <= ulTestMEnd; ulTestM++) {
+	for (ulTestN = 1; ulTestN <= 256; ulTestN++) {
+	    for (ulTestM = 1; ulTestM <= 16; ulTestM++) {
 		ulComputedFo = (ulPLLFreqRef * ulTestN) / (ulTestM * ulTestP);
 		if (ulComputedFo > lFo)
 		    ulFTmpDelta = ulComputedFo - lFo;
@@ -112,7 +136,7 @@ MGAG200IPComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
 
 		if (ulFTmpDelta < ulFDelta) {
 			ulFDelta = ulFTmpDelta;
-			*M = ulTestM - 1;
+			*M = (CARD8)(ulTestM - 1);
 			*N = (CARD8)(ulTestN - 1);
 			*P = (CARD8)(ulTestP - 1);
 		}
@@ -601,6 +625,7 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
 
 	/* Pixel clock values */
 	int m, n, p, s;
+        m = n = p = s = 0;
 
 	if(MGAISGx50(pMga)) {
 	    pReg->Clock = f_out;
@@ -608,13 +633,13 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
 	}
 
 	if (pMga->is_G200SE) {
-	    MGAG200IPComputePLLParam(pScrn, f_out, &m, &n, &p);
+	    MGAG200SEComputePLLParam(pScrn, f_out, &m, &n, &p);
 
 	    pReg->DacRegs[ MGA1064_PIX_PLLC_M ] = m;
 	    pReg->DacRegs[ MGA1064_PIX_PLLC_N ] = n;
 	    pReg->DacRegs[ MGA1064_PIX_PLLC_P ] = p;
 	} else if (pMga->is_G200EV) {
-	    MGAG200IPComputePLLParam(pScrn, f_out, &m, &n, &p);
+	    MGAG200EVComputePLLParam(pScrn, f_out, &m, &n, &p);
 
 	    pReg->PllM = m;
 	    pReg->PllN = n;

commit c955c1fdabfe0449369d0ccf31ab7e6ef3d7bffe
Author: Yannick Heneault <yheneaul@matrox.com>
Date:   Mon Mar 30 13:38:39 2009 -0400

    fixed memory count rountine for G200eW to detect up to 16Megs on X server without libpciaccess.

diff --git a/src/mga_driver.c b/src/mga_driver.c
index 70bd280..7c67405 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -1293,8 +1293,7 @@ MGACountRam(ScrnInfoPtr pScrn)
             MaxMapSize = pMga->PciInfo->regions[0].size;
 #else
             Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
-            MaxMapSize = 1UL << pciGetBaseSize(pMga->PciTag, 0, TRUE,
-                                            NULL);
+            MaxMapSize = 1UL << pMga->PciInfo->size[0];
 #endif
             Option = (Option & 0x3000000) >> 24 ;
 

commit 16a5e3a7e13c0a2c1091ad452250cbc231b8f427
Author: Yannick Heneault <yheneaul@matrox.com>
Date:   Thu Mar 26 10:58:06 2009 -0400

    Modified memory count rountine for G200eW to detect up to 16Megs.

diff --git a/src/mga_driver.c b/src/mga_driver.c
index b363437..70bd280 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -1284,6 +1284,38 @@ MGACountRam(ScrnInfoPtr pScrn)
 	    usleep(20000);
 	}
 
+        if (pMga->is_G200WB) {
+            CARD32 Option, MaxMapSize;
+
+#ifdef XSERVER_LIBPCIACCESS
+            pci_device_cfg_read_u32(pMga->PciInfo, &Option, 
+                                    PCI_OPTION_REG);
+            MaxMapSize = pMga->PciInfo->regions[0].size;
+#else
+            Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
+            MaxMapSize = 1UL << pciGetBaseSize(pMga->PciTag, 0, TRUE,
+                                            NULL);
+#endif
+            Option = (Option & 0x3000000) >> 24 ;
+
+            if (Option == 2)
+                ProbeSize = 4*1024;
+            else if(Option == 1)
+                ProbeSize = 8*1024;
+            else if(Option == 0)
+                ProbeSize = 16*1024;
+
+            if (ProbeSize * 1024 > MaxMapSize)
+                xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 
+                        "Fb size from config space doesn't fit option register\n");
+            else {
+                MGAUnmapMem(pScrn);
+                pMga->FbMapSize = ProbeSize * 1024;
+                MGAMapMem(pScrn);
+                base = pMga->FbBase;
+            }
+        }
+
 	/* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */
 	OUTREG8(MGAREG_CRTCEXT_INDEX, 3);
 	tmp = INREG8(MGAREG_CRTCEXT_DATA);

commit 36ae47b82310d96f158694765105fc010911702f
Author: Yannick Heneault <yheneaul@matrox.com>
Date:   Wed Mar 11 16:31:43 2009 -0400

    Fixed bad access issues and ddc1 implementation for IP core.
    Fixed a bug in PLL programming sequence for G200eW/G200eV where a register IO offset was used instead of
    a memory offset.
    Removed clock selection toggling in PLL programming sequence for G200eW.
    Fixed ddc1 protocol to support correct I/O lines according to chip attribute.
    Fixed a bug in CRTC2 programming seqence where a register IO offset was used instead of a memory offset.

diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index ec04900..88a12cb 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -111,10 +111,10 @@ MGAG200IPComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
 		    ulFTmpDelta = lFo - ulComputedFo;
 
 		if (ulFTmpDelta < ulFDelta) {
-		    ulFDelta = ulFTmpDelta;
-		    *M = (CARD8)(ulTestM - 1);
-		    *N = (CARD8)(ulTestN - 1);
-		    *P = (CARD8)(ulTestP - 1);
+			ulFDelta = ulFTmpDelta;
+			*M = ulTestM - 1;
+			*N = (CARD8)(ulTestN - 1);
+			*P = (CARD8)(ulTestP - 1);
 		}
 	    }
 	}
@@ -199,9 +199,9 @@ MGAG200EVPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
     outMGAdac(MGA1064_PIX_CLK_CTL, ucPixCtrl);
 
     // Select PLL Set C
-    ucTempByte = INREG8(MGAREG_MISC_READ);
+    ucTempByte = INREG8(MGAREG_MEM_MISC_READ);
     ucTempByte |= 0x3<<2; //select MGA pixel clock
-    OUTREG8(MGAREG_MISC_WRITE, ucTempByte);
+    OUTREG8(MGAREG_MEM_MISC_WRITE, ucTempByte);
 
     // Set pixlock to 0
     ucTempByte = inMGAdac(MGA1064_PIX_PLL_STAT);
@@ -281,9 +281,9 @@ MGAG200WBPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
         outMGAdac(MGA1064_REMHEADCTL, ucTempByte);
 
         // Select PLL Set C
-        ucTempByte = INREG8(MGAREG_MISC_READ);
+        ucTempByte = INREG8(MGAREG_MEM_MISC_READ);
         ucTempByte |= 0x3<<2; //select MGA pixel clock
-        OUTREG8(MGAREG_MISC_WRITE, ucTempByte);
+        OUTREG8(MGAREG_MEM_MISC_WRITE, ucTempByte);
 
         // Set pixlock to 0
         ucTempByte = inMGAdac(MGA1064_PIX_PLL_STAT);
@@ -314,13 +314,13 @@ MGAG200WBPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
         // Wait 50 us
         usleep(50);
 
-        ucTempByte = INREG8(MGAREG_MISC_READ);
-        OUTREG8(MGAREG_MISC_WRITE, ucTempByte & ~0x04);
+        ucTempByte = INREG8(MGAREG_MEM_MISC_READ);
+        OUTREG8(MGAREG_MEM_MISC_WRITE, ucTempByte);
 
         // Wait 50 us
         usleep(50);
 
-        OUTREG8(MGAREG_MISC_WRITE, ucTempByte);
+        OUTREG8(MGAREG_MEM_MISC_WRITE, ucTempByte);
 
         // Wait 500 us
         usleep(500);
@@ -1586,9 +1586,17 @@ MGAG_ddc1Read(ScrnInfoPtr pScrn)
 {
   MGAPtr pMga = MGAPTR(pScrn);
   unsigned char val;
-  
+  int i2c_index;
+
+  if (pMga->is_G200SE || pMga->is_G200WB || pMga->is_G200EV)
+    i2c_index = 3;
+  else
+    i2c_index = 0;
+
+  const struct mgag_i2c_private *p = & i2c_priv[i2c_index];
+ 
   /* Define the SDA as an input */
-  outMGAdacmsk(MGA1064_GEN_IO_CTL, ~(DDC_P1_SCL_MASK | DDC_P1_SDA_MASK), 0);
+  outMGAdacmsk(MGA1064_GEN_IO_CTL, ~(p->scl_mask | p->sda_mask), 0);
 
   /* wait for Vsync */
   if (pMga->is_G200SE) {
@@ -1599,7 +1607,7 @@ MGAG_ddc1Read(ScrnInfoPtr pScrn)
   }
 
   /* Get the result */
-  val = (inMGAdac(MGA1064_GEN_IO_DATA) & DDC_P1_SDA_MASK);
+  val = (inMGAdac(MGA1064_GEN_IO_DATA) & p->sda_mask);
   return val;
 }
 
@@ -1675,7 +1683,6 @@ Bool
 MGAG_i2cInit(ScrnInfoPtr pScrn)
 {
     MGAPtr pMga = MGAPTR(pScrn);
-    I2CBusPtr I2CPtr;
 
     if (pMga->SecondCrtc == FALSE) {
         int i2c_index;
diff --git a/src/mga_dh.c b/src/mga_dh.c
index 6ba2945..d9c0d34 100644
--- a/src/mga_dh.c
+++ b/src/mga_dh.c
@@ -251,9 +251,9 @@ void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo)
     
     
     /* We don't use MISC synch pol, must be 0*/
-    ucByte = inMGAdreg( MGAREG_MISC_READ);
+    ucByte = INREG8( MGAREG_MEM_MISC_READ);
     
-    OUTREG8(MGAREG_MISC_WRITE, (CARD8)(ucByte & ~(HSYNCPOL| VSYNCPOL) ));
+    OUTREG8(MGAREG_MEM_MISC_WRITE, (CARD8)(ucByte & ~(HSYNCPOL| VSYNCPOL) ));
 
     
 

commit 669acb55023bce505f4a912bed6f1e9f3efa2856
Author: Thomas Jaeger <ThJaeger@gmail.com>
Date:   Fri Jan 30 16:18:34 2009 -0500

    Fall back to software for unsupported repeat modes
    
    [anholt: dropped unneded ->repeat check -- it's a misguided compat field for
    drivers from before repeatType existed]

diff --git a/src/mga_exa.c b/src/mga_exa.c
index 9321452..f292327 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -332,6 +332,11 @@ mgaCheckSourceTexture(int tmu, PicturePtr pPict)
         return FALSE;
     }
 
+    if (pPict->repeatType != RepeatNormal) {
+        DEBUG_MSG(("Unsupported repeat type %d\n", pPict->repeatType));
+        return FALSE;
+    }
+
     if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) {
         DEBUG_MSG(("NPOT repeat unsupported (%dx%d)\n", w, h));
         return FALSE;

commit 496342b09b7379bff95627ec357d4dd24123dc85
Author: Chris Ball <cjb@laptop.org>
Date:   Fri Feb 27 10:54:17 2009 -0500

    Revert "Build fix for EXA 3"
    
    This reverts commit 4aac5618278d47a801bef40d3eede1c360c1ea28.
    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 1a87b6d..923b434 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,7 @@ if test "x$EXA" = xyes; then
     AC_MSG_RESULT(yes)
 
     SAVE_CPPFLAGS="$CPPFLAGS"
-    CPPFLAGS="$CPPFLAGS $XORG_CFLAGS -DEXA_DRIVER_KNOWN_MAJOR=3"
+    CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
     AC_CHECK_HEADER(exa.h,
                    [have_exa_h="yes"], [have_exa_h="no"])
     CPPFLAGS="$SAVE_CPPFLAGS"
@@ -138,7 +138,7 @@ else
 fi 
 
 SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $XORG_CFLAGS -DEXA_DRIVER_KNOWN_MAJOR=3"
+CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
 if test "x$have_exa_h" = xyes; then
     AC_MSG_CHECKING([whether EXA version is at least 2.0.0])
     AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
@@ -153,7 +153,6 @@ if test "x$have_exa_h" = xyes; then
 
     if test "x$USE_EXA" = xyes; then
         AC_DEFINE(USE_EXA, 1, [Build support for Exa])
-        AC_DEFINE(EXA_DRIVER_KNOWN_MAJOR, 3, [Major version of EXA we know how to handle])
     fi
 fi
 CPPFLAGS="$SAVE_CPPFLAGS"

commit 4aac5618278d47a801bef40d3eede1c360c1ea28
Author: Chris Ball <cjb@laptop.org>
Date:   Tue Feb 24 12:48:54 2009 -0500

    Build fix for EXA 3
    
    EXA in xserver head now requires us to pass -DEXA_DRIVER_KNOWN_MAJOR=3.
    
    Signed-off-by: Chris Ball <cjb@laptop.org>

diff --git a/configure.ac b/configure.ac
index 923b434..1a87b6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,7 @@ if test "x$EXA" = xyes; then
     AC_MSG_RESULT(yes)
 
     SAVE_CPPFLAGS="$CPPFLAGS"
-    CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
+    CPPFLAGS="$CPPFLAGS $XORG_CFLAGS -DEXA_DRIVER_KNOWN_MAJOR=3"
     AC_CHECK_HEADER(exa.h,
                    [have_exa_h="yes"], [have_exa_h="no"])
     CPPFLAGS="$SAVE_CPPFLAGS"
@@ -138,7 +138,7 @@ else
 fi 
 
 SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
+CPPFLAGS="$CPPFLAGS $XORG_CFLAGS -DEXA_DRIVER_KNOWN_MAJOR=3"
 if test "x$have_exa_h" = xyes; then
     AC_MSG_CHECKING([whether EXA version is at least 2.0.0])
     AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
@@ -153,6 +153,7 @@ if test "x$have_exa_h" = xyes; then
 
     if test "x$USE_EXA" = xyes; then
         AC_DEFINE(USE_EXA, 1, [Build support for Exa])
+        AC_DEFINE(EXA_DRIVER_KNOWN_MAJOR, 3, [Major version of EXA we know how to handle])
     fi
 fi
 CPPFLAGS="$SAVE_CPPFLAGS"

commit 0e9df5fe820d69387355c3ef857cde4cc72220b0
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Fri Jan 30 20:41:56 2009 -0800

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


Reply to: