ChangeLog         |  104 ++++++++++++++++++++++++++++++
 configure.ac      |    8 +-
 debian/changelog  |    9 ++
 debian/control    |   10 +-
 debian/copyright  |    2 
 debian/watch      |    2 
 src/mga.h         |   10 ++
 src/mga_dac3026.c |    6 +
 src/mga_dacG.c    |  184 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 src/mga_driver.c  |   58 +++++++++++++----
 src/mga_exa.c     |   34 ++-------
 src/mga_merge.c   |    4 -
 src/mga_storm.c   |    1 
 13 files changed, 370 insertions(+), 62 deletions(-)

New commits:
commit b55dcb2d4010cec77345f09ed0323bcb595f7a2b
Author: Andreas Boll <andreas.boll....@gmail.com>
Date:   Wed Jan 18 13:52:32 2017 +0100

    Bump Standards-Version to 3.9.8.

diff --git a/debian/changelog b/debian/changelog
index 6533fbc..6c48951 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ xserver-xorg-video-mga (1:1.6.5-1) UNRELEASED; urgency=medium
   * New upstream release.
   * Move URL from description to Homepage field.
   * Switch URLs to https.
+  * Bump Standards-Version to 3.9.8.
 
  -- Andreas Boll <andreas.boll....@gmail.com>  Wed, 18 Jan 2017 13:48:55 +0100
 
diff --git a/debian/control b/debian/control
index 51ee3f1..00a1fae 100644
--- a/debian/control
+++ b/debian/control
@@ -21,7 +21,7 @@ Build-Depends:
  x11proto-xf86dri-dev,
  quilt,
  xutils-dev (>= 1:7.5+4)
-Standards-Version: 3.9.3
+Standards-Version: 3.9.8
 Homepage: https://www.x.org
 Vcs-Git: 
https://anonscm.debian.org/git/pkg-xorg/driver/xserver-xorg-video-mga.git
 Vcs-Browser: 
https://anonscm.debian.org/git/pkg-xorg/driver/xserver-xorg-video-mga.git

commit f0f01b0311b2f0825b921a174a9037c3b7bf5b3b
Author: Andreas Boll <andreas.boll....@gmail.com>
Date:   Wed Jan 18 13:51:58 2017 +0100

    Switch URLs to https.

diff --git a/debian/changelog b/debian/changelog
index 518c67a..6533fbc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ xserver-xorg-video-mga (1:1.6.5-1) UNRELEASED; urgency=medium
 
   * New upstream release.
   * Move URL from description to Homepage field.
+  * Switch URLs to https.
 
  -- Andreas Boll <andreas.boll....@gmail.com>  Wed, 18 Jan 2017 13:48:55 +0100
 
diff --git a/debian/control b/debian/control
index d1dbb42..51ee3f1 100644
--- a/debian/control
+++ b/debian/control
@@ -23,8 +23,8 @@ Build-Depends:
  xutils-dev (>= 1:7.5+4)
 Standards-Version: 3.9.3
 Homepage: https://www.x.org
-Vcs-Git: git://git.debian.org/git/pkg-xorg/driver/xserver-xorg-video-mga
-Vcs-Browser: 
http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-video-mga.git
+Vcs-Git: 
https://anonscm.debian.org/git/pkg-xorg/driver/xserver-xorg-video-mga.git
+Vcs-Browser: 
https://anonscm.debian.org/git/pkg-xorg/driver/xserver-xorg-video-mga.git
 
 Package: xserver-xorg-video-mga
 Architecture: any
diff --git a/debian/copyright b/debian/copyright
index a5e621c..558d220 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,7 +1,7 @@
 This package was downloaded from
 git://anongit.freedesktop.org/git/xorg/driver/xf86-video-mga.
 Release tarballs are available at
-http://xorg.freedesktop.org/releases/individual/driver/
+https://xorg.freedesktop.org/releases/individual/driver/
 
 Copyright (C) 1994-2003 The XFree86 Project, Inc.  All Rights Reserved.
 
diff --git a/debian/watch b/debian/watch
index c914dd8..263b2c0 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,4 +1,4 @@
 #git=git://anongit.freedesktop.org/xorg/driver/xf86-video-mga
 version=3
 opts="pgpsigurlmangle=s/$/.sig/,dversionmangle=s/\.dfsg$//" \
-  http://xorg.freedesktop.org/releases/individual/driver/ 
xf86-video-mga-(1\.[^9].*)\.tar\.gz debian debian/xsfbs/repack.sh
+  https://xorg.freedesktop.org/releases/individual/driver/ 
xf86-video-mga-(1\.[^9].*)\.tar\.gz debian debian/xsfbs/repack.sh

commit 38a8869ebc0cf7e643c301e4c581f23403175d56
Author: Andreas Boll <andreas.boll....@gmail.com>
Date:   Wed Jan 18 13:49:30 2017 +0100

    Move URL from description to Homepage field.

diff --git a/debian/changelog b/debian/changelog
index c817986..518c67a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 xserver-xorg-video-mga (1:1.6.5-1) UNRELEASED; urgency=medium
 
   * New upstream release.
+  * Move URL from description to Homepage field.
 
  -- Andreas Boll <andreas.boll....@gmail.com>  Wed, 18 Jan 2017 13:48:55 +0100
 
diff --git a/debian/control b/debian/control
index b6fb4ab..d1dbb42 100644
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,7 @@ Build-Depends:
  quilt,
  xutils-dev (>= 1:7.5+4)
 Standards-Version: 3.9.3
+Homepage: https://www.x.org
 Vcs-Git: git://git.debian.org/git/pkg-xorg/driver/xserver-xorg-video-mga
 Vcs-Browser: 
http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-video-mga.git
 
@@ -41,7 +42,4 @@ Description: X.Org X server -- MGA display driver
  This package provides the driver for the Matrox MGA family of chipsets,
  including Matrox Millennium and Mystique cards.
  .
- More information about X.Org can be found at:
- <URL:http://www.X.org>
- .
  This package is built from the X.org xf86-video-mga driver module.

commit e4f1a4f8c418bee5c95d967984145f92aff816bd
Author: Andreas Boll <andreas.boll....@gmail.com>
Date:   Wed Jan 18 13:49:14 2017 +0100

    Bump changelogs

diff --git a/ChangeLog b/ChangeLog
index f4f7ff5..31def79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,107 @@
+commit 979e0e73eb3424b6a97746e29c8b4a5b7e86196e
+Author: Matt Turner <matts...@gmail.com>
+Date:   Tue Jan 17 14:40:48 2017 -0800
+
+    xf86-video-mga 1.6.5
+    
+    Signed-off-by: Matt Turner <matts...@gmail.com>
+
+commit fc5d7acc23fcec9d87ca26fadf466fcf107671c0
+Author: Mathieu Larouche <mathieu.larou...@matrox.com>
+Date:   Wed Jul 20 09:18:49 2016 -0400
+
+    xf86-video-mga: Add support for the new G200e chipset -- V2
+    
+    - Added PLL algorithm for a new rev of G200e
+    - Removed the bandwidth limitation for the new G200e
+    
+    Fixes : https://bugs.freedesktop.org/show_bug.cgi?id=92540
+    
+    Change from V1 :
+    - Make sure we don't cause issue on previous chips. (Dave Airlie review)
+    
+    Signed-off-by: Mathieu Larouche <mathieu.larou...@matrox.com>
+    Signed-off-by: Dave Airlie <airl...@redhat.com>
+
+commit 12781f2e3deb7f6d86fde53134384996a6004894
+Author: Mathieu Larouche <mathieu.larou...@matrox.com>
+Date:   Fri Jun 17 10:52:42 2016 -0400
+
+    xf86-video-mga: Add support for a new G200eW3 chipset
+    
+    - Added support for the new deviceID for G200eW3
+    - Added PLL algorithm for the G200eW3
+    - Added some initialization code for G200eW3
+    
+    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=92541
+    
+    Signed-off-by: Mathieu Larouche <mathieu.larou...@matrox.com>
+    Signed-off-by: Dave Airlie <airl...@redhat.com>
+
+commit df094bfffe4ef097bfd9a569f2d2e35649c1a3c7
+Author: Adam Jackson <a...@redhat.com>
+Date:   Tue Jul 19 10:03:56 2016 -0400
+
+    Adapt Block/WakeupHandler signature for ABI 23
+    
+    Signed-off-by: Adam Jackson <a...@redhat.com>
+
+commit 72a8b5ef0bcb08d4cde7b329a13a59db35342f58
+Author: Thomas Klausner <w...@netbsd.org>
+Date:   Mon Feb 23 13:26:14 2015 +0100
+
+    Use correct type in function call.
+    
+    Fixes
+    passing argument 2 of 'pci_device_cfg_read_u32' from incompatible pointer 
type
+    pciaccess.h:153:5: note: expected '__uint32_t *' but argument is of type 
'CARD32 *'
+    
+    Signed-off-by: Thomas Klausner <w...@netbsd.org>
+    Reviewed-by: Connor Behan <connor.be...@gmail.com>
+
+commit f1e6c73be073c8816319104b2fde329bc286f5ec
+Author: Connor Behan <connor.be...@gmail.com>
+Date:   Mon Aug 24 13:48:29 2015 -0400
+
+    Composite fixup
+    
+    A driver like this that tries to composite a lot will definitely need to
+    avoid crashing for solid pictures.
+    
+    Signed-off-by: Connor Behan <connor.be...@gmail.com>
+
+commit e6770f7cc11800ab6cc2e88790f357189de7ce32
+Author: Connor Behan <connor.be...@gmail.com>
+Date:   Mon Aug 24 11:48:16 2015 -0400
+
+    Remove DownloadFromScreen
+    
+    This hook was broken and did the same thing as a software fallback.
+    
+    Signed-off-by: Connor Behan <connor.be...@gmail.com>
+
+commit 04432b9c1db255e8e3d39a924f8803f83c407acc
+Author: Adam Jackson <a...@redhat.com>
+Date:   Tue May 5 11:05:44 2015 -0400
+
+    Enable write-combining on the framebuffer BAR
+    
+    Signed-off-by: Adam Jackson <a...@redhat.com>
+
+commit da1223394ac9b6f3974b0b2570cbf46a2425fc11
+Author: Matthew Rezny <matt...@reztek.cz>
+Date:   Sun Jun 21 19:50:43 2015 +0200
+
+    MGA DDX: make it possible to find EXA support
+    
+    Newer versions of the xserver stricter requirements on header order
+    which caused the configure tests for EXA support to erroneously fail.
+    Since XAA was already removed from an earlier version of xserver, the
+    configure failure meant no acceleration was possible. Patch configure
+    tests similar to r128.
+    
+    Reviewed-by: Adam Jackson <a...@redhat.com>
+
 commit 8ed77eb7920f375e9490a31f907eccb02fb123cd
 Author: Matt Turner <matts...@gmail.com>
 Date:   Thu Feb 19 13:39:18 2015 -0800
diff --git a/debian/changelog b/debian/changelog
index 5601a9f..c817986 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xserver-xorg-video-mga (1:1.6.5-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Andreas Boll <andreas.boll....@gmail.com>  Wed, 18 Jan 2017 13:48:55 +0100
+
 xserver-xorg-video-mga (1:1.6.4-2) unstable; urgency=medium
 
   [ Andreas Boll ]

commit 979e0e73eb3424b6a97746e29c8b4a5b7e86196e
Author: Matt Turner <matts...@gmail.com>
Date:   Tue Jan 17 14:40:48 2017 -0800

    xf86-video-mga 1.6.5
    
    Signed-off-by: Matt Turner <matts...@gmail.com>

diff --git a/configure.ac b/configure.ac
index 14271f1..3bef1f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-mga],
-        [1.6.4],
+        [1.6.5],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-mga])
 AC_CONFIG_SRCDIR([Makefile.am])

commit fc5d7acc23fcec9d87ca26fadf466fcf107671c0
Author: Mathieu Larouche <mathieu.larou...@matrox.com>
Date:   Wed Jul 20 09:18:49 2016 -0400

    xf86-video-mga: Add support for the new G200e chipset -- V2
    
    - Added PLL algorithm for a new rev of G200e
    - Removed the bandwidth limitation for the new G200e
    
    Fixes : https://bugs.freedesktop.org/show_bug.cgi?id=92540
    
    Change from V1 :
    - Make sure we don't cause issue on previous chips. (Dave Airlie review)
    
    Signed-off-by: Mathieu Larouche <mathieu.larou...@matrox.com>
    Signed-off-by: Dave Airlie <airl...@redhat.com>

diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index 2be0bb7..73d0d9d 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -51,6 +51,75 @@ static Bool MGAGInit(ScrnInfoPtr, DisplayModePtr);
 static void MGAGLoadPalette(ScrnInfoPtr, int, int*, LOCO*, VisualPtr);
 static Bool MGAG_i2cInit(ScrnInfoPtr pScrn);
 
+#define P_ARRAY_SIZE 9
+
+void
+MGAG200E4ComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
+{
+    unsigned int ulComputedFo;
+    unsigned int ulFDelta;
+    unsigned int ulFPermitedDelta;
+    unsigned int ulFTmpDelta;
+    unsigned int ulVCOMax, ulVCOMin;
+    unsigned int ulTestP;
+    unsigned int ulTestM;
+    unsigned int ulTestN;
+    unsigned int ulFoInternal;
+    unsigned int ulPLLFreqRef;
+    unsigned int pulPValues[P_ARRAY_SIZE] = {16, 14, 12, 10, 8, 6, 4, 2, 1};
+    unsigned int i;
+    unsigned int ulVCO;
+    unsigned int ulFVV;
+
+    ulVCOMax        = 1600000;
+    ulVCOMin        = 800000;
+    ulPLLFreqRef    = 25000;
+
+    if(lFo < 25000)
+        lFo = 25000;
+
+    ulFoInternal = lFo * 2;
+
+    ulFDelta = 0xFFFFFFFF;
+    /* Permited delta is 0.5% as VESA Specification */
+    ulFPermitedDelta = ulFoInternal * 5 / 1000;  
+
+    for (i = 0 ; i < P_ARRAY_SIZE ; i++)
+    {
+        ulTestP = pulPValues[i];
+
+        if ((ulFoInternal * ulTestP) > ulVCOMax) continue;
+        if ((ulFoInternal * ulTestP) < ulVCOMin) continue;
+
+        for (ulTestN = 50; ulTestN <= 256; ulTestN++) {
+            for (ulTestM = 1; ulTestM <= 32; ulTestM++) {
+                ulComputedFo = (ulPLLFreqRef * ulTestN) / (ulTestM * ulTestP);
+                if (ulComputedFo > ulFoInternal)
+                    ulFTmpDelta = ulComputedFo - ulFoInternal;
+                else
+                    ulFTmpDelta = ulFoInternal - ulComputedFo;
+
+                if (ulFTmpDelta < ulFDelta) {
+                    ulFDelta = ulFTmpDelta;
+                    *M = ulTestM - 1;
+                    *N = ulTestN - 1;
+                    *P = ulTestP - 1;
+                }
+            }
+        }
+    }
+                                                                               
                                     
+    ulVCO = ulPLLFreqRef * ((*N)+1) / ((*M)+1);
+    ulFVV = (ulVCO - 800000) / 50000;
+
+    if (ulFVV > 15)
+        ulFVV = 15;
+
+    *P |= (ulFVV << 4);                                                        
                                     
+
+    *M |= 0x80;
+}
+
 static void
 MGAG200SEComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
 {
@@ -958,7 +1027,11 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
        }
 
        if (pMga->is_G200SE) {
-           MGAG200SEComputePLLParam(pScrn, f_out, &m, &n, &p);
+            if (pMga->reg_1e24 >= 0x04) {
+                MGAG200E4ComputePLLParam(pScrn, f_out, &m, &n, &p);
+            } else {
+                MGAG200SEComputePLLParam(pScrn, f_out, &m, &n, &p);
+            }
 
            pReg->DacRegs[ MGA1064_PIX_PLLC_M ] = m;
            pReg->DacRegs[ MGA1064_PIX_PLLC_N ] = n;
@@ -1557,7 +1630,12 @@ MGA_NOT_HAL(
         {
                        outMGAdac(0x90, mgaReg->Dac_Index90);
         }
-   
+           if (pMga->is_G200SE && (pMga->reg_1e24 >= 0x04)) {
+              outMGAdac( 0x1a, 0x09);
+              usleep(500);
+              outMGAdac( 0x1a, 0x01);
+           }
+    
           if (!MGAISGx50(pMga)) {
               /* restore pci_option register */
 #ifdef XSERVER_LIBPCIACCESS
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 96d1d7a..7b46561 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -315,7 +315,7 @@ static const struct mga_device_attributes attribs[] = {
     },
 
     /* G200SE A PCI */
-    [10] = { 0, 1, 0, 0, 1, 0, 0, 1, new_BARs,
+    [10] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
             (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
        {
            { 50000, 230000 }, /* System VCO frequencies */
@@ -331,7 +331,7 @@ static const struct mga_device_attributes attribs[] = {
     },
 
     /* G200SE B PCI */
-    [11] = { 0, 1, 0, 0, 1, 0, 0, 1, new_BARs,
+    [11] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
             (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
        {
            { 50000, 114000 }, /* System VCO frequencies */
@@ -3854,7 +3854,7 @@ MGAValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool 
verbose, int flags)
                if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
                    return MODE_BANDWIDTH;
         } else {
-            if (pMga->reg_1e24 >= 0x02) {
+            if (pMga->reg_1e24 == 0x02) {
                    if (mode->HDisplay > 1920)
                        return MODE_VIRTUAL_X;
                    if (mode->VDisplay > 1200)

commit 12781f2e3deb7f6d86fde53134384996a6004894
Author: Mathieu Larouche <mathieu.larou...@matrox.com>
Date:   Fri Jun 17 10:52:42 2016 -0400

    xf86-video-mga: Add support for a new G200eW3 chipset
    
    - Added support for the new deviceID for G200eW3
    - Added PLL algorithm for the G200eW3
    - Added some initialization code for G200eW3
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=92541
    
    Signed-off-by: Mathieu Larouche <mathieu.larou...@matrox.com>
    Signed-off-by: Dave Airlie <airl...@redhat.com>

diff --git a/src/mga.h b/src/mga.h
index e87932f..04f6bfd 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -146,6 +146,12 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
 #define PCI_CHIP_MGAG400                0x0525
 #define PCI_CHIP_MGAG550                0x2527
 
+#ifndef PCI_CHIP_MGAG200_EW3_PCI
+#define PCI_CHIP_MGAG200_EW3_PCI 0x0536
+#endif
+
+
+
 /*
  * Read/write to the DAC via MMIO 
  */
@@ -209,9 +215,9 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
 typedef struct {
     unsigned char      ExtVga[6];
     unsigned char      DacClk[6];
-    unsigned char      ExtVga_Index24;
+    unsigned char      ExtVga_MgaReq;
     unsigned char      Dac_Index90;
-    unsigned char * DacRegs;
+    unsigned char       * DacRegs;
     unsigned long      crtc2[0x58];
     unsigned char      dac2[0x21];
     CARD32             Option;
diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index f307488..2be0bb7 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -207,6 +207,74 @@ MGAG200WBComputePLLParam(ScrnInfoPtr pScrn, long lFo, int 
*M, int *N, int *P)
 #endif
 }
 
+void
+MGAG200EW3ComputePLLParam(ScrnInfoPtr pScrn ,long lFo, int *M, int *N, int *P)
+{
+    unsigned int ulComputedFo;
+    unsigned int ulFDelta;
+    unsigned int ulFPermitedDelta;
+    unsigned int ulFTmpDelta;
+    unsigned int ulVCOMax, ulVCOMin;
+    unsigned int ulTestP1;
+    unsigned int ulTestP2;
+    unsigned int ulTestM;
+    unsigned int ulTestN;
+    unsigned int ulPLLFreqRef;
+    unsigned int ulTestP1Start;
+    unsigned int ulTestP1End;
+    unsigned int ulTestP2Start;
+    unsigned int ulTestP2End;
+    unsigned int ulTestMStart;
+    unsigned int ulTestMEnd;
+    unsigned int ulTestNStart;
+    unsigned int ulTestNEnd;
+
+    ulVCOMax        = 800000;
+    ulVCOMin        = 400000;
+    ulPLLFreqRef    = 25000;
+    ulTestP1Start   = 1;
+    ulTestP1End     = 8;
+    ulTestP2Start   = 1;
+    ulTestP2End     = 8;
+    ulTestMStart    = 1;
+    ulTestMEnd      = 26;
+    ulTestNStart    = 32;
+    ulTestNEnd      = 2048;
+
+    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 (ulTestP1 = ulTestP1Start; ulTestP1 < ulTestP1End; ulTestP1++) {
+        for (ulTestP2 = ulTestP2Start; ulTestP2 < ulTestP2End; ulTestP2++) {
+            if (ulTestP1 < ulTestP2) continue;
+            if ((lFo * ulTestP1 * ulTestP2) > ulVCOMax) continue;
+            if ((lFo * ulTestP1 * ulTestP2) < ulVCOMin) continue;
+
+            for (ulTestM = ulTestMStart; ulTestM < ulTestMEnd; ulTestM++) {
+                for (ulTestN = ulTestNStart; ulTestN < ulTestNEnd; ulTestN++) {
+                    ulComputedFo = (ulPLLFreqRef * ulTestN) / (ulTestM * 
ulTestP1 * ulTestP2);
+                    if (ulComputedFo > lFo)
+                        ulFTmpDelta = ulComputedFo - lFo;
+                    else
+                        ulFTmpDelta = lFo - ulComputedFo;
+
+                    if (ulFTmpDelta < ulFDelta) {
+                        ulFDelta = ulFTmpDelta;
+                        *M = (CARD8)((ulTestN & 0x100) >> 1) | 
+                             (CARD8)(ulTestM);
+                        *N = (CARD8)(ulTestN & 0xFF);
+                        *P = (CARD8)((ulTestN & 0x600) >> 3) | 
+                             (CARD8)(ulTestP2 << 3) | 
+                             (CARD8)ulTestP1;
+                    }
+                }
+            }
+        }
+    }
+}
+
 static void
 MGAG200EHComputePLLParam(ScrnInfoPtr pScrn, long lFo, int *M, int *N, int *P)
 {
@@ -902,7 +970,14 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
            pReg->PllN = n;
            pReg->PllP = p;
        } else if (pMga->is_G200WB) {
-           MGAG200WBComputePLLParam(pScrn, f_out, &m, &n, &p);
+            if (pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI)
+            {
+                 MGAG200EW3ComputePLLParam(pScrn, f_out, &m, &n, &p);
+            }
+            else
+            {
+                MGAG200WBComputePLLParam(pScrn, f_out, &m, &n, &p);
+            }
 
            pReg->PllM = m;
            pReg->PllN = n;
@@ -1092,6 +1167,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
                break;
 
         case PCI_CHIP_MGAG200_WINBOND_PCI:
+        case PCI_CHIP_MGAG200_EW3_PCI:
                 pReg->DacRegs[MGA1064_VREF_CTL] = 0x07;
                 pReg->Option = 0x41049120;
                 pReg->Option2 = 0x0000b000;
@@ -1232,7 +1308,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
         if (pMga->is_G200WB){
             pReg->ExtVga[1] |= 0x88;
         }
-       pReg->ExtVga_Index24 = 0x05;
+       pReg->ExtVga_MgaReq = 0x05;
                
        pVga->CRTC[0]   = ht - 4;
        pVga->CRTC[1]   = hd;
@@ -1528,7 +1604,15 @@ MGA_NOT_HAL(
 
            if (pMga->is_G200ER) {
                OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24);
-               OUTREG8(MGAREG_CRTCEXT_DATA,  mgaReg->ExtVga_Index24);          
           
+               OUTREG8(MGAREG_CRTCEXT_DATA,  mgaReg->ExtVga_MgaReq);           
           
+           }
+
+           if (pMga->is_G200WB) {
+               if(pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI)
+               {
+                   OUTREG8(MGAREG_CRTCEXT_INDEX, 0x34);
+                   OUTREG8(MGAREG_CRTCEXT_DATA,  mgaReg->ExtVga_MgaReq);
+               } 
            }
 
           /* This handles restoring the generic VGA registers. */
@@ -1717,8 +1801,16 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr 
mgaReg,
        if (pMga->is_G200ER)
        {
                OUTREG8(MGAREG_CRTCEXT_INDEX, 0x24);
-               mgaReg->ExtVga_Index24 = INREG8(MGAREG_CRTCEXT_DATA);
-       }
+               mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA);
+       }
+        if (pMga->is_G200WB) 
+        {
+            if(pMga->Chipset == PCI_CHIP_MGAG200_EW3_PCI)
+            {
+                OUTREG8(MGAREG_CRTCEXT_INDEX, 0x34);
+                mgaReg->ExtVga_MgaReq = INREG8(MGAREG_CRTCEXT_DATA);           
     
+            }
+        }
 
 #ifdef DEBUG           
        ErrorF("Saved values:\nDAC:");
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 8a7186f..96d1d7a 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -408,6 +408,22 @@ static const struct mga_device_attributes attribs[] = {
        },
 
        16384, 0x4000,          /* Memory probe size & offset values */
+    },
+
+    /* G200WB */
+    [16] = { 0, 1, 0, 0, 1, 0, 0, 0, new_BARs,
+            (TRANSC_SOLID_FILL | TWO_PASS_COLOR_EXPAND | USE_LINEAR_EXPANSION),
+       {
+           { 50000, 230000 }, /* System VCO frequencies */
+           { 50000, 203400 }, /* Pixel VCO frequencies */
+           { 0, 0 },          /* Video VCO frequencies */
+           45000,            /* Memory clock */
+           27050,             /* PLL reference frequency */
+           0,                 /* Supports fast bitblt? */
+           MGA_HOST_PCI       /* Host interface */
+       },
+
+       16384, 0x4000,          /* Memory probe size & offset values */
     }
 };
 
@@ -438,7 +454,9 @@ static const struct pci_id_match mga_device_match[] = {
 
     MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_EH_PCI, 14 ),
 
-       MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_ER_PCI, 15 ),
+    MGA_DEVICE_MATCH(PCI_CHIP_MGAG200_ER_PCI, 15 ),
+
+    MGA_DEVICE_MATCH( PCI_CHIP_MGAG200_EW3_PCI, 16 ),
 
     { 0, 0, 0 },
 };
@@ -459,6 +477,7 @@ static SymTabRec MGAChipsets[] = {
     { PCI_CHIP_MGAG200_EV_PCI, "mgag200 EV Maxim" },
     { PCI_CHIP_MGAG200_ER_PCI, "mgag200 ER SH7757" },  
     { PCI_CHIP_MGAG200_WINBOND_PCI,    "mgag200 eW Nuvoton" },
+    { PCI_CHIP_MGAG200_EW3_PCI,        "mgag200 eW3 Nuvoton" },
     { PCI_CHIP_MGAG200_EH_PCI, "mgag200eH" },
     { PCI_CHIP_MGAG400,                "mgag400" },
     { PCI_CHIP_MGAG550,                "mgag550" },
@@ -484,6 +503,8 @@ static PciChipsets MGAPciChipsets[] = {
        RES_SHARED_VGA },
     { PCI_CHIP_MGAG200_WINBOND_PCI, PCI_CHIP_MGAG200_WINBOND_PCI,
        RES_SHARED_VGA },
+    { PCI_CHIP_MGAG200_EW3_PCI, PCI_CHIP_MGAG200_EW3_PCI,
+       RES_SHARED_VGA },
     { PCI_CHIP_MGAG200_EH_PCI, PCI_CHIP_MGAG200_EH_PCI,
        RES_SHARED_VGA },
     { PCI_CHIP_MGAG400,            PCI_CHIP_MGAG400,   RES_SHARED_VGA },
@@ -923,6 +944,9 @@ MGAProbe(DriverPtr drv, int flags)
                 attrib_no = 15;
                 break;
                                
+            case PCI_CHIP_MGAG200_EW3_PCI:
+                attrib_no = 16;
+                break;
 
            default:
                return FALSE;
@@ -1541,7 +1565,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     pMga->is_G200SE = (pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI)
        || (pMga->Chipset == PCI_CHIP_MGAG200_SE_B_PCI);
     pMga->is_G200EV = (pMga->Chipset == PCI_CHIP_MGAG200_EV_PCI);
-    pMga->is_G200WB = (pMga->Chipset == PCI_CHIP_MGAG200_WINBOND_PCI);
+    pMga->is_G200WB = (pMga->Chipset == PCI_CHIP_MGAG200_WINBOND_PCI)
+       || (pMga->Chipset ==  PCI_CHIP_MGAG200_EW3_PCI);
     pMga->is_G200EH = (pMga->Chipset == PCI_CHIP_MGAG200_EH_PCI);
     pMga->is_G200ER = (pMga->Chipset == PCI_CHIP_MGAG200_ER_PCI);
 
@@ -2049,6 +2074,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
     case PCI_CHIP_MGAG200_SE_A_PCI:
     case PCI_CHIP_MGAG200_SE_B_PCI:
     case PCI_CHIP_MGAG200_WINBOND_PCI:
+    case PCI_CHIP_MGAG200_EW3_PCI:
     case PCI_CHIP_MGAG200_EV_PCI:
     case PCI_CHIP_MGAG200_EH_PCI:
     case PCI_CHIP_MGAG200_ER_PCI:      
@@ -2163,8 +2189,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
          case PCI_CHIP_MGAG200_SE_A_PCI:
          case PCI_CHIP_MGAG200_SE_B_PCI:
           case PCI_CHIP_MGAG200_WINBOND_PCI:
+         case PCI_CHIP_MGAG200_EW3_PCI:
          case PCI_CHIP_MGAG200_EV_PCI:
-      case PCI_CHIP_MGAG200_EH_PCI:
+         case PCI_CHIP_MGAG200_EH_PCI:
          case PCI_CHIP_MGAG200_ER_PCI:   
            pMga->SrcOrg = 0;
            pMga->DstOrg = 0;
@@ -2347,6 +2374,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
        case PCI_CHIP_MGAG200_PCI:
        case PCI_CHIP_MGAG200_SE_B_PCI:
         case PCI_CHIP_MGAG200_WINBOND_PCI:
+       case PCI_CHIP_MGAG200_EW3_PCI:
        case PCI_CHIP_MGAG200_EV_PCI:
     case PCI_CHIP_MGAG200_EH_PCI:
        case PCI_CHIP_MGAG200_ER_PCI:   
@@ -3838,12 +3866,15 @@ MGAValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, 
Bool verbose, int flags)
     } else if (pMga->is_G200WB){
         if (mode->Flags & V_DBLSCAN)
             return MODE_NO_DBLESCAN;
-       if (pMga->KVM && mode->HDisplay > 1280)
-           return MODE_VIRTUAL_X;
-       if (pMga->KVM && mode->VDisplay > 1024)
-           return MODE_VIRTUAL_Y;
-       if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 318.77)
-           return MODE_BANDWIDTH;
+        if (pMga->Chipset != PCI_CHIP_MGAG200_EW3_PCI)
+        {
+           if (pMga->KVM && mode->HDisplay > 1280)
+               return MODE_VIRTUAL_X;
+           if (pMga->KVM && mode->VDisplay > 1024)
+               return MODE_VIRTUAL_Y;
+           if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 318.77)
+               return MODE_BANDWIDTH;
+        }
     } else if (pMga->is_G200EV
               && (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 327)) {
        return MODE_BANDWIDTH;
diff --git a/src/mga_merge.c b/src/mga_merge.c
index 6d7b71e..a257306 100644
--- a/src/mga_merge.c
+++ b/src/mga_merge.c
@@ -353,9 +353,10 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
     case PCI_CHIP_MGAG200_SE_A_PCI:
     case PCI_CHIP_MGAG200_SE_B_PCI:
     case PCI_CHIP_MGAG200_WINBOND_PCI:
+    case PCI_CHIP_MGAG200_EW3_PCI:
     case PCI_CHIP_MGAG200_EV_PCI:
     case PCI_CHIP_MGAG200_EH_PCI:
-       case PCI_CHIP_MGAG200_ER_PCI:
+    case PCI_CHIP_MGAG200_ER_PCI:
     case PCI_CHIP_MGAG400:
     case PCI_CHIP_MGAG550:
        MGAGSetupFuncs(pScrn);
@@ -505,6 +506,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags)
        case PCI_CHIP_MGAG200_SE_A_PCI:
        case PCI_CHIP_MGAG200_SE_B_PCI:
         case PCI_CHIP_MGAG200_WINBOND_PCI:
+       case PCI_CHIP_MGAG200_EW3_PCI:          
         case PCI_CHIP_MGAG200_EV_PCI:
         case PCI_CHIP_MGAG200_EH_PCI:
        case PCI_CHIP_MGAG200_ER_PCI:           
diff --git a/src/mga_storm.c b/src/mga_storm.c
index 84a4c8c..4ef655b 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -1148,6 +1148,7 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
     case PCI_CHIP_MGAG200_SE_A_PCI:
     case PCI_CHIP_MGAG200_SE_B_PCI:
     case PCI_CHIP_MGAG200_WINBOND_PCI:
+    case PCI_CHIP_MGAG200_EW3_PCI:
     case PCI_CHIP_MGAG200_EV_PCI:
     case PCI_CHIP_MGAG200_EH_PCI:
     case PCI_CHIP_MGAG200_ER_PCI:      

commit df094bfffe4ef097bfd9a569f2d2e35649c1a3c7
Author: Adam Jackson <a...@redhat.com>
Date:   Tue Jul 19 10:03:56 2016 -0400

    Adapt Block/WakeupHandler signature for ABI 23
    
    Signed-off-by: Adam Jackson <a...@redhat.com>

diff --git a/src/compat-api.h b/src/compat-api.h
index 6bc946f..89976e4 100644
--- a/src/compat-api.h
+++ b/src/compat-api.h
@@ -75,8 +75,13 @@
 
 #define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
 
+#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
+#define BLOCKHANDLER_ARGS arg, pTimeout
+#else
 #define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer 
pReadmask
 #define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+#endif
 
 #define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
 #define CLOSE_SCREEN_ARGS pScreen

commit 72a8b5ef0bcb08d4cde7b329a13a59db35342f58
Author: Thomas Klausner <w...@netbsd.org>
Date:   Mon Feb 23 13:26:14 2015 +0100

    Use correct type in function call.
    
    Fixes
    passing argument 2 of 'pci_device_cfg_read_u32' from incompatible pointer 
type
    pciaccess.h:153:5: note: expected '__uint32_t *' but argument is of type 
'CARD32 *'
    
    Signed-off-by: Thomas Klausner <w...@netbsd.org>
    Reviewed-by: Connor Behan <connor.be...@gmail.com>

diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c
index 97c2c7a..bf4e668 100644
--- a/src/mga_dac3026.c
+++ b/src/mga_dac3026.c
@@ -852,8 +852,12 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr 
mgaReg,
                mgaReg->DacRegs[i]       = inTi3026(MGADACregs[i]);
        
 #ifdef XSERVER_LIBPCIACCESS
-       pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option, 
+    {
+       uint32_t Option;
+       pci_device_cfg_read_u32(pMga->PciInfo, & Option,
                                PCI_OPTION_REG);
+        mgaReg->Option = Option;
+    }
 #else
        mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
 #endif

commit f1e6c73be073c8816319104b2fde329bc286f5ec
Author: Connor Behan <connor.be...@gmail.com>
Date:   Mon Aug 24 13:48:29 2015 -0400

    Composite fixup
    
    A driver like this that tries to composite a lot will definitely need to
    avoid crashing for solid pictures.
    
    Signed-off-by: Connor Behan <connor.be...@gmail.com>

diff --git a/src/mga_exa.c b/src/mga_exa.c
index a011c91..c4e4d90 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -318,6 +318,11 @@ mgaGetTexFormat(PicturePtr pPict)
 static Bool
 mgaCheckSourceTexture(int tmu, PicturePtr pPict)
 {
+    if (!pPict->pDrawable) {
+        DEBUG_MSG(("Solid / gradient pictures not supported\n"));
+        return FALSE;
+    }
+
     int w = pPict->pDrawable->width;
     int h = pPict->pDrawable->height;
 
@@ -354,7 +359,7 @@ static Bool
 mgaCheckComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
                   PicturePtr pDstPict)
 {
-    MGAPtr pMga = 
xf86ScreenToScrn(pSrcPict->pDrawable->pScreen)->driverPrivate;
+    MGAPtr pMga = 
xf86ScreenToScrn(pDstPict->pDrawable->pScreen)->driverPrivate;
 
     if (op >= sizeof(mgaBlendOp) / sizeof(mgaBlendOp[0])) {
         DEBUG_MSG(("unsupported op %x\n", op));
@@ -521,6 +526,7 @@ mgaPrepareComposite(int op, PicturePtr pSrcPict, PicturePtr 
pMaskPict,
 {
     PMGA(pDst);
     CARD32 fcol = 0xff000000, ds0 = 0, ds1 = 0, cmd, blendcntl;
+    if (!pSrc || !pSrcPict->pDrawable) return FALSE;
 
     mgaSetup(pMga, pDst, pDstPict, 2);
     OUTREG(MGAREG_DSTORG, exaGetPixmapOffset(pDst));

commit e6770f7cc11800ab6cc2e88790f357189de7ce32
Author: Connor Behan <connor.be...@gmail.com>
Date:   Mon Aug 24 11:48:16 2015 -0400

    Remove DownloadFromScreen
    
    This hook was broken and did the same thing as a software fallback.
    
    Signed-off-by: Connor Behan <connor.be...@gmail.com>

diff --git a/src/mga_exa.c b/src/mga_exa.c
index 69ffa16..a011c91 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -723,31 +723,6 @@ mgaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int 
h,
     return TRUE;
 }
 
-static Bool
-mgaDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
-                      char *dst, int dst_pitch)
-{
-    PMGA(pSrc);
-
-    char *src = (char *) exaGetPixmapFirstPixel(pSrc);
-    int src_pitch = exaGetPixmapPitch(pSrc);
-
-    int cpp = (pSrc->drawable.bitsPerPixel + 7) / 8;
-    int bytes = w * cpp;
-
-    src += y * src_pitch + x * cpp;
-
-    QUIESCE_DMA(pSrc);
-
-    while (h--) {
-       memcpy (dst, src, bytes);
-       src += src_pitch;
-       dst += dst_pitch;
-    }
-
-    return TRUE;
-}
-
 static void
 mgaWaitMarker(ScreenPtr pScreen, int marker)
 {
@@ -895,7 +870,6 @@ mgaExaInit(ScreenPtr pScreen)
     }
 
     pExa->UploadToScreen = mgaUploadToScreen;
-    pExa->DownloadFromScreen = mgaDownloadFromScreen;
 
 #ifdef MGADRI
     if (pMga->directRenderingEnabled)

commit 04432b9c1db255e8e3d39a924f8803f83c407acc
Author: Adam Jackson <a...@redhat.com>
Date:   Tue May 5 11:05:44 2015 -0400

    Enable write-combining on the framebuffer BAR
    
    Signed-off-by: Adam Jackson <a...@redhat.com>

diff --git a/src/mga_driver.c b/src/mga_driver.c
index f0025b1..8a7186f 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2594,7 +2594,8 @@ MGAMapMem(ScrnInfoPtr pScrn)
        pciaddr_t fbsize = pMga->FbMapSize;
        err = pci_device_map_range(dev,
                                   fbaddr, fbsize,
-                                  PCI_DEV_MAP_FLAG_WRITABLE,
+                                  PCI_DEV_MAP_FLAG_WRITABLE |
+                                  PCI_DEV_MAP_FLAG_WRITE_COMBINE,
                                   (void **)&pMga->FbBase);
 
        if (err) {

commit da1223394ac9b6f3974b0b2570cbf46a2425fc11
Author: Matthew Rezny <matt...@reztek.cz>
Date:   Sun Jun 21 19:50:43 2015 +0200

    MGA DDX: make it possible to find EXA support
    
    Newer versions of the xserver stricter requirements on header order
    which caused the configure tests for EXA support to erroneously fail.
    Since XAA was already removed from an earlier version of xserver, the
    configure failure meant no acceleration was possible. Patch configure

Reply via email to