Mailinglist Archive: opensuse-commit (1159 mails)

< Previous Next >
commit xorg-x11-driver-video
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Wed, 03 Oct 2007 17:05:46 +0200
  • Message-id: <20071003150546.8DA3D67817A@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package xorg-x11-driver-video
checked in at Wed Oct 3 17:05:46 CEST 2007.

--------
--- xorg-x11-driver-video/xorg-x11-driver-video.changes 2007-09-29 14:11:50.000000000 +0200
+++ /mounts/work_src_done/STABLE/xorg-x11-driver-video/xorg-x11-driver-video.changes    2007-10-03 11:55:28.434927000 +0200
@@ -1,0 +2,18 @@
+Wed Oct  3 11:56:35 CEST 2007 - sndirsch@xxxxxxx
+
+- xf86-video-mga 1.9.100
+  * This is the second test release of the MGA driver that features
+    RandR 1.2 support. Since the last release, a few bugs have been
+    fixed that affected dual head mode.
+    - Fixed initialization of the second head of the G550.
+    - Made DAC2 return to clone mode on restore.
+    - Set SYNC_CTL to 0xcc when CRTC2 is active.
+    - Bug #12575: Evaluate the x and y arguments to crtc_mode_set().
+    - Don't crash in DownloadFromScreen.
+    - Set maxPitchPixels if available.
+    - Removed DGA support.
+    - Removed MGAFBLayout structure.
+    - Don't check texture dimensions in mgaCheckSourceTexture().
+    - Bug #12598: Only write palette data when available.
+
+-------------------------------------------------------------------

Old:
----
  xf86-video-mga-1.9.99.tar.bz2

New:
----
  xf86-video-mga-1.9.100.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xorg-x11-driver-video.spec ++++++
--- /var/tmp/diff_new_pack.A32544/_old  2007-10-03 17:03:00.000000000 +0200
+++ /var/tmp/diff_new_pack.A32544/_new  2007-10-03 17:03:00.000000000 +0200
@@ -14,7 +14,7 @@
 BuildRequires:  Mesa-devel libdrm-devel pkgconfig xorg-x11-proto-devel xorg-x11-server-sdk
 Url:            http://xorg.freedesktop.org/
 Version:        7.3
-Release:        1
+Release:        2
 License:        X11/MIT
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Group:          System/X11/Servers/XF86_4
@@ -61,7 +61,7 @@
 Source44:       HALlib-4.1.tar.gz
 Source45:       xf86-video-intel-2.1.1.tar.bz2
 Source46:       xf86-video-ati-6.7.194.tar.bz2
-Source48:       xf86-video-mga-1.9.99.tar.bz2
+Source48:       xf86-video-mga-1.9.100.tar.bz2
 Source49:       xf86-video-unichrome-20070511.tar.bz2
 Source50:       xf86-video-xgi-1.5.0.tar.bz2
 Source51:       xf86-video-amd-2.7.7.2.tar.bz2
@@ -108,7 +108,7 @@
 ln -snf ati.man xf86-video-ati-6.7.194/man/atirandr12.man
 ln -snf r128.man xf86-video-ati-6.7.194/man/r128randr12.man
 ln -snf radeon.man xf86-video-ati-6.7.194/man/radeonrandr12.man
-ln -snf mga.man xf86-video-mga-1.9.99/man/mgarandr12.man
+ln -snf mga.man xf86-video-mga-1.9.100/man/mgarandr12.man
 pushd xf86-video-ati-6.7.194
 %patch28 -p1
 popd
@@ -118,7 +118,7 @@
 pushd xf86-video-ati-6.6.3
 %patch44 -p1
 popd
-pushd xf86-video-mga-1.9.99
+pushd xf86-video-mga-1.9.100
 %patch30 -p1
 popd
 pushd xf86-video-intel-*
@@ -174,11 +174,11 @@
 
 %build
 for dir in xf86-video-nv-* \
-           xf86-video-mga-1.9.99 xf86-video-ati-6.7.* xf86-video-ati-6.6.3 \
+           xf86-video-mga-1.9.100 xf86-video-ati-6.7.* xf86-video-ati-6.6.3 \
            xf86-video-unichrome \
            $(ls | grep -v -e xf86-video-impact \
                           -e xf86-video-nv \
-                          -e xf86-video-mga-1.9.99 \
+                          -e xf86-video-mga-1.9.100 \
                           -e xf86-video-ati-6.6.3 \
                           -e xf86-video-ati-6.7 \
                           -e xf86-video-unichrome \
@@ -187,7 +187,7 @@
     case $dir in
       xf86-video-mga-1.4.7  | \
       xf86-video-intel-*    | \
-      xf86-video-mga-1.9.99 | \
+      xf86-video-mga-1.9.100 | \
       xf86-video-ati-6.6.3  | \
       xf86-video-ati-6.7.*  | \
       xf86-video-unichrome  | \
@@ -202,13 +202,13 @@
 
 %install
 for dir in xf86-video-nv-* \
-           xf86-video-mga-1.9.99 \
+           xf86-video-mga-1.9.100 \
            xf86-video-ati-6.6.3 \
            xf86-video-ati-6.7.* \
            xf86-video-unichrome \
            $(ls | grep -v -e xf86-video-impact \
                           -e xf86-video-nv \
-                          -e xf86-video-mga-1.9.99 \
+                          -e xf86-video-mga-1.9.100 \
                           -e xf86-video-ati-6.6.3 \
                           -e xf86-video-ati-6.7 \
                           -e xf86-video-unichrome \
@@ -242,6 +242,21 @@
 /usr/%{_lib}/xorg/modules/
 %{_mandir}/man4/*
 %changelog
+* Wed Oct 03 2007 - sndirsch@xxxxxxx
+- xf86-video-mga 1.9.100
+  * This is the second test release of the MGA driver that features
+  RandR 1.2 support. Since the last release, a few bugs have been
+  fixed that affected dual head mode.
+    - Fixed initialization of the second head of the G550.
+    - Made DAC2 return to clone mode on restore.
+    - Set SYNC_CTL to 0xcc when CRTC2 is active.
+    - Bug #12575: Evaluate the x and y arguments to crtc_mode_set().
+    - Don't crash in DownloadFromScreen.
+    - Set maxPitchPixels if available.
+    - Removed DGA support.
+    - Removed MGAFBLayout structure.
+    - Don't check texture dimensions in mgaCheckSourceTexture().
+    - Bug #12598: Only write palette data when available.
 * Sat Sep 29 2007 - sndirsch@xxxxxxx
 - xf86-video-nv 2.1.5
   * preliminary pci-rework support

++++++ xf86-video-mga-1.9.99.tar.bz2 -> xf86-video-mga-1.9.100.tar.bz2 ++++++
++++ 1851 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/ChangeLog new/xf86-video-mga-1.9.100/ChangeLog
--- old/xf86-video-mga-1.9.99/ChangeLog 2007-09-15 00:40:59.000000000 +0200
+++ new/xf86-video-mga-1.9.100/ChangeLog        2007-10-03 00:14:11.000000000 +0200
@@ -1,3 +1,84 @@
+commit fda9377e5e45b4fc3190bad03e081cadc96fe231
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Wed Oct 3 00:03:20 2007 +0200
+
+    Bug #12598: Only write palette data when available.
+    
+    When we're restoring a CRTC state from crtc_mode_set(), the palette
+    data is initialized to zero. Don't write it to the hardware in that case.
+
+commit 6695dc4222bb97c0f9dffce46a54456eeb5f4b5f
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Tue Oct 2 22:06:35 2007 +0200
+
+    Don't check texture dimensions in mgaCheckSourceTexture().
+    
+    The server is already doing that for us.
+
+commit 4266ced619de86b3a7706f3ee6c8a24ba111b6ba
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Tue Oct 2 22:05:28 2007 +0200
+
+    Removed MGAFBLayout structure.
+
+commit 38d25dc9128c384d12bfc1f711a4fb6b2937dea7
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Tue Oct 2 21:50:58 2007 +0200
+
+    Removed DGA support.
+    
+    Our current implementation depends on XAA and doesn't seem to work.
+    Maybe use generic DGA routines using xf86DiDGA sometime.
+
+commit b45d585f07c7da283b6ded2d5f294d097391b942
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Mon Oct 1 19:46:23 2007 +0200
+
+    Set maxPitchPixels if available.
+
+commit f7aa8c703443902373baad60d5927e6a3b77298c
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Mon Oct 1 19:21:36 2007 +0200
+
+    Don't crash in DownloadFromScreen.
+    
+    With the latest xserver bits, we may not rely on pSrc->devPrivate.ptr
+    to get the pixmap address in the framebuffer. Use exaGetPixmapOffset()
+    instead.
+    Also added a missing exaWaitSync().
+
+commit 88d4290a88362df9f37890ff8863b93d3abf2866
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Wed Sep 26 19:58:52 2007 +0200
+
+    Bug #12575: Evaluate the x and y arguments to crtc_mode_set().
+
+commit a4e4ecc9e04f8d6a4c338f5a0aa7e93143d3d94b
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Sat Sep 22 00:29:38 2007 +0200
+
+    Set SYNC_CTL to 0xcc when CRTC2 is active.
+    
+    In crtc_restore(), restore its original value.
+
+commit 722f4ecda3cbf0ee0acebde2bce0c989340b3db2
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Fri Sep 21 23:58:10 2007 +0200
+
+    Made DAC2 return to clone mode on restore.
+    
+    Removed a chunk of code from crtc_restore() that was kept as a template
+    for this.
+
+commit 083d498b86fdc26cc915593ba6b17a00343881ea
+Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
+Date:   Fri Sep 21 23:40:01 2007 +0200
+
+    Fixed initialization of the second head of the G550.
+    
+    MISC_CTL_DAC_EN and DISP_CTL_DAC1OUTSEL_EN also need to be set
+    if our first output is a panel, they are not DAC specific.
+
 commit 94ed9651ebb2da7b845f836aee3a294adba37ad9
 Author: Tilman Sauerbeck <tilman@xxxxxxxxxxxxxx>
 Date:   Sat Sep 15 00:36:12 2007 +0200
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/configure.ac new/xf86-video-mga-1.9.100/configure.ac
--- old/xf86-video-mga-1.9.99/configure.ac      2007-09-15 00:34:13.000000000 +0200
+++ new/xf86-video-mga-1.9.100/configure.ac     2007-10-03 00:13:35.000000000 +0200
@@ -24,7 +24,7 @@
 
 # When the version number is modified here, also modify it in src/mga.h.
 AC_INIT([xf86-video-mga],
-        1.9.99,
+        1.9.100,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-mga)
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/Makefile.am new/xf86-video-mga-1.9.100/src/Makefile.am
--- old/xf86-video-mga-1.9.99/src/Makefile.am   2007-09-15 00:28:01.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/Makefile.am  2007-10-02 21:47:37.000000000 +0200
@@ -37,7 +37,6 @@
          mga_dac3026.h \
          mga_dacG.c \
          mga_dacG.h \
-         mga_dga.c \
          mga_driver.c \
          mga_g450pll.c \
          mga.h \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_2064_crtc.c new/xf86-video-mga-1.9.100/src/mga_2064_crtc.c
--- old/xf86-video-mga-1.9.99/src/mga_2064_crtc.c       2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_2064_crtc.c      2007-10-02 21:51:30.000000000 +0200
@@ -400,7 +400,7 @@
         * First we figure out lm, ln, and z.
         * Things are different in packed pixel mode (24bpp) though.
         */
-        if ( pMga->CurrentLayout.bitsPerPixel == 24 ) {
+        if (scrn->bitsPerPixel == 24) {
 
                /* ln:lm = ln:3 */
                lm = 65 - 3;
@@ -450,7 +450,7 @@
        }
 
         /* Values for the loop clock PLL registers */
-        if ( pMga->CurrentLayout.bitsPerPixel == 24 ) {
+        if (scrn->bitsPerPixel == 24 ) {
             /* Packed pixel mode values */
             state->DacClk[ 3 ] = ( ln & 0x3f ) | 0x80;
             state->DacClk[ 4 ] = ( lm & 0x3f ) | 0x80;
@@ -478,12 +478,11 @@
     const unsigned char* initDAC;
     MGAPtr pMga = MGAPTR(scrn);
     MGARamdacPtr MGAdac = &pMga->Dac;
-    MGAFBLayout *layout = &pMga->CurrentLayout;
     vgaRegPtr pVga = &VGAHWPTR(scrn)->ModeReg;
 
-    BppShift = pMga->BppShifts[(layout->bitsPerPixel >> 3) - 1];
+    BppShift = pMga->BppShifts[(scrn->bitsPerPixel >> 3) - 1];
 
-    switch (layout->bitsPerPixel) {
+    switch (scrn->bitsPerPixel) {
     case 8:
         initDAC = MGADACbpp8;
         break;
@@ -494,7 +493,7 @@
         initDAC = MGADACbpp24;
         break;
     case 32:
-        if(layout->Overlay8Plus24)
+        if (pMga->Overlay8Plus24)
             initDAC = MGADACbpp8plus24;
         else
             initDAC = MGADACbpp32;
@@ -511,19 +510,19 @@
             index_1d = i;
     }
 
-    if ((layout->bitsPerPixel == 32) && layout->Overlay8Plus24) {
+    if ((scrn->bitsPerPixel == 32) && pMga->Overlay8Plus24) {
         state->DacRegs[9] = pMga->colorKey;
         state->DacRegs[10] = pMga->colorKey;
     }
 
-    if ((layout->bitsPerPixel == 16) && (layout->weight.red == 5) &&
-        (layout->weight.green == 5) && (layout->weight.blue == 5))
+    if ((scrn->bitsPerPixel == 16) && (scrn->weight.red == 5) &&
+        (scrn->weight.green == 5) && (scrn->weight.blue == 5))
         state->DacRegs[1] &= ~0x01;
 
     if (pMga->Interleave)
         state->DacRegs[2] += 1;
 
-    if (layout->bitsPerPixel == 24) {
+    if (scrn->bitsPerPixel == 24) {
         int silicon_rev;
 
         /* we need to set DacRegs[0] differently based on the silicon
@@ -568,10 +567,10 @@
     if ((ht & 0x07) == 0x06 || (ht & 0x07) == 0x04)
         ht++;
 
-    if (layout->bitsPerPixel == 24)
-        wd = (layout->displayWidth * 3) >> (4 - BppShift);
+    if (scrn->bitsPerPixel == 24)
+        wd = (scrn->displayWidth * 3) >> (4 - BppShift);
     else
-        wd = layout->displayWidth >> (4 - BppShift);
+        wd = scrn->displayWidth >> (4 - BppShift);
 
     state->ExtVga[0] = 0;
     state->ExtVga[5] = 0;
@@ -597,7 +596,7 @@
                        ((vd & 0xc00) >> 7) |
                        ((vs & 0xc00) >> 5);
 
-    if (layout->bitsPerPixel == 24)
+    if (scrn->bitsPerPixel == 24)
         state->ExtVga[3] = (((1 << BppShift) * 3) - 1) | 0x80;
     else
         state->ExtVga[3] = ((1 << BppShift) - 1) | 0x80;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_dac3026.c new/xf86-video-mga-1.9.100/src/mga_dac3026.c
--- old/xf86-video-mga-1.9.99/src/mga_dac3026.c 2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_dac3026.c        2007-10-02 21:51:30.000000000 +0200
@@ -315,7 +315,7 @@
     MGAPtr pMga = MGAPTR(pScrn);
     int i, index;
 
-    if(pMga->CurrentLayout.Overlay8Plus24 && (pVisual->nplanes != 8))
+    if (pMga->Overlay8Plus24 && (pVisual->nplanes != 8))
        return;
 
     if (pVisual->nplanes == 16) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_dacG.c new/xf86-video-mga-1.9.100/src/mga_dacG.c
--- old/xf86-video-mga-1.9.99/src/mga_dacG.c    2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_dacG.c   2007-10-02 23:35:57.000000000 +0200
@@ -76,7 +76,7 @@
 ){
     MGAPtr pMga = MGAPTR(pScrn);
 
-    if((pMga->CurrentLayout.Overlay8Plus24) && (pVisual->nplanes != 8)) 
+    if((pMga->Overlay8Plus24) && (pVisual->nplanes != 8)) 
        return;
 
      if(pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550){ 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_dga.c new/xf86-video-mga-1.9.100/src/mga_dga.c
--- old/xf86-video-mga-1.9.99/src/mga_dga.c     2007-09-14 20:42:39.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_dga.c    1970-01-01 01:00:00.000000000 +0100
@@ -1,451 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.14 1999/11/02 23:12:00 mvojkovi Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86Pci.h"
-#include "xf86PciInfo.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "mga.h"
-#include "mga_reg.h"
-#include "dgaproc.h"
-
-
-static Bool MGA_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, 
-                                       int *, int *, int *);
-static Bool MGA_SetMode(ScrnInfoPtr, DGAModePtr);
-static int  MGA_GetViewport(ScrnInfoPtr);
-static void MGA_SetViewport(ScrnInfoPtr, int, int, int);
-static void MGA_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
-static void MGA_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
-static void MGA_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, 
-                                       unsigned long);
-
-static
-DGAFunctionRec MGA_DGAFuncs = {
-   MGA_OpenFramebuffer,
-   NULL,
-   MGA_SetMode,
-   MGA_SetViewport,
-   MGA_GetViewport,
-   MGAStormSync,
-   MGA_FillRect,
-   MGA_BlitRect,
-   MGA_BlitTransRect
-};
-
-
-static int
-FindSmallestPitch(
-   MGAPtr pMga,
-   int Bpp,
-   int width
-){
-   int Pitches1[] = 
-         {640, 768, 800, 960, 1024, 1152, 1280, 1600, 1920, 2048, 0};
-   int Pitches2[] = 
-         {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664, 
-               1920, 2048, 0};
-   int *linePitches = NULL;
-   int pitch;
-        
-
-   if(!pMga->NoAccel) {
-       switch(pMga->Chipset) {
-       case PCI_CHIP_MGA2064:
-           linePitches = Pitches1;
-           break;
-       case PCI_CHIP_MGA2164:
-       case PCI_CHIP_MGA2164_AGP:
-       case PCI_CHIP_MGA1064:
-           linePitches = Pitches2;
-           break;
-       }
-   }
-
-   pitch = pMga->Roundings[Bpp - 1] - 1;
-
-   if(linePitches) {
-       while((*linePitches < width) || (*linePitches & pitch))
-          linePitches++;
-       return *linePitches;
-   } 
-
-   return ((width + pitch) & ~pitch); 
-}
-
-static DGAModePtr
-MGASetupDGAMode(
-   ScrnInfoPtr pScrn,
-   DGAModePtr modes,
-   int *num,
-   int bitsPerPixel,
-   int depth,
-   Bool pixmap,
-   int secondPitch,
-   unsigned long red,
-   unsigned long green,
-   unsigned long blue,
-   short visualClass
-){
-   DisplayModePtr firstMode, pMode;
-   MGAPtr pMga = MGAPTR(pScrn);
-   DGAModePtr mode, newmodes;
-   int size, pitch, Bpp = bitsPerPixel >> 3;
-
-SECOND_PASS:
-
-   pMode = firstMode = pScrn->modes;
-
-   while(1) {
-
-        
-       pitch = FindSmallestPitch(pMga, Bpp, pMode->HDisplay);
-       size = pitch * Bpp * pMode->VDisplay;
-
-       if((!secondPitch || (pitch != secondPitch)) &&
-               (size <= pMga->FbUsableSize)) {
-
-           if(secondPitch)
-               pitch = secondPitch; 
-
-           if(!(newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec))))
-               break;
-
-           modes = newmodes;
-           mode = modes + *num;
-
-           mode->mode = pMode;
-           mode->flags = DGA_CONCURRENT_ACCESS;
-            if(pixmap)
-               mode->flags |= DGA_PIXMAP_AVAILABLE;
-           if(!pMga->NoAccel) {
-               mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
-               if((Bpp != 3) && (pMga->Chipset != PCI_CHIP_MGA2064))
-                   mode->flags |= DGA_BLIT_RECT_TRANS;
-           }
-           if(pMode->Flags & V_DBLSCAN)
-               mode->flags |= DGA_DOUBLESCAN;
-           if(pMode->Flags & V_INTERLACE)
-               mode->flags |= DGA_INTERLACED;
-           mode->byteOrder = pScrn->imageByteOrder;
-           mode->depth = depth;
-           mode->bitsPerPixel = bitsPerPixel;
-           mode->red_mask = red;
-           mode->green_mask = green;
-           mode->blue_mask = blue;
-           mode->visualClass = visualClass;
-           mode->viewportWidth = pMode->HDisplay;
-           mode->viewportHeight = pMode->VDisplay;
-           mode->xViewportStep = (3 - pMga->BppShifts[Bpp - 1]);
-           if((Bpp == 3) && 
-                   (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550))
-               mode->xViewportStep <<= 1;
-           mode->yViewportStep = 1;
-           mode->viewportFlags = DGA_FLIP_RETRACE;
-           mode->offset = pMga->YDstOrg * Bpp;  /* gonna need to fix that */
-           mode->address = pMga->FbStart;
-           mode->bytesPerScanline = pitch * Bpp;
-           mode->imageWidth = pitch;
-           mode->imageHeight =  pMga->FbUsableSize / mode->bytesPerScanline; 
-           mode->pixmapWidth = pitch;
-           switch (pMga->Chipset) {
-           case PCI_CHIP_MGAG200_SE_A_PCI:
-           case PCI_CHIP_MGAG200_SE_B_PCI:
-               mode->pixmapHeight = (min(pMga->FbUsableSize, 1*1024*1024)) /
-                                    mode->bytesPerScanline;
-               break;
-           default:
-               mode->pixmapHeight = (min(pMga->FbUsableSize, 16*1024*1024)) / 
-                                    mode->bytesPerScanline;
-           }
-           mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
-           mode->maxViewportY = (pMga->FbUsableSize / mode->bytesPerScanline) -
-                                       mode->viewportHeight;
-
-           if( (pMga->Chipset == PCI_CHIP_MGA2064) ||
-               (pMga->Chipset == PCI_CHIP_MGA2164) ||
-               (pMga->Chipset == PCI_CHIP_MGA2164_AGP)) 
-           {
-               int tmp;
-
-               tmp = (8*1024*1024 / mode->bytesPerScanline) -
-                                       mode->viewportHeight;
-               if(tmp < 0) tmp = 0;
-               if(tmp < mode->maxViewportY)
-                   mode->maxViewportY = tmp;
-           }
-
-           (*num)++;
-       }
-
-       pMode = pMode->next;
-       if(pMode == firstMode)
-          break;
-    }
-
-    if(secondPitch) {
-       secondPitch = 0;
-       goto SECOND_PASS;
-    }
-
-    return modes;
-}
-
-
-Bool
-MGADGAInit(ScreenPtr pScreen)
-{   
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   MGAPtr pMga = MGAPTR(pScrn);
-   DGAModePtr modes = NULL;
-   int num = 0;
-
-   /* 8 */
-   modes = MGASetupDGAMode (pScrn, modes, &num, 8, 8, 
-               (pScrn->bitsPerPixel == 8),
-               (pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
-               0, 0, 0, PseudoColor);
-
-   /* 15 */
-   modes = MGASetupDGAMode (pScrn, modes, &num, 16, 15, 
-               (pScrn->bitsPerPixel == 16),
-               (pScrn->depth != 15) ? 0 : pScrn->displayWidth,
-               0x7c00, 0x03e0, 0x001f, TrueColor);
-
-   modes = MGASetupDGAMode (pScrn, modes, &num, 16, 15, 
-               (pScrn->bitsPerPixel == 16),
-               (pScrn->depth != 15) ? 0 : pScrn->displayWidth,
-               0x7c00, 0x03e0, 0x001f, DirectColor);
-
-   /* 16 */
-   modes = MGASetupDGAMode (pScrn, modes, &num, 16, 16, 
-               (pScrn->bitsPerPixel == 16),
-               (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
-               0xf800, 0x07e0, 0x001f, TrueColor);
-
-   modes = MGASetupDGAMode (pScrn, modes, &num, 16, 16, 
-               (pScrn->bitsPerPixel == 16),
-               (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
-               0xf800, 0x07e0, 0x001f, DirectColor);
-
-   /* 24 */
-   modes = MGASetupDGAMode (pScrn, modes, &num, 24, 24, 
-               (pScrn->bitsPerPixel == 24),
-               (pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
-               0xff0000, 0x00ff00, 0x0000ff, TrueColor);
-
-   modes = MGASetupDGAMode (pScrn, modes, &num, 24, 24, 
-               (pScrn->bitsPerPixel == 24),
-               (pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth,
-               0xff0000, 0x00ff00, 0x0000ff, DirectColor);
-
-   /* 32 */
-   modes = MGASetupDGAMode (pScrn, modes, &num, 32, 24, 
-               (pScrn->bitsPerPixel == 32),
-               (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
-               0xff0000, 0x00ff00, 0x0000ff, TrueColor);
-
-   modes = MGASetupDGAMode (pScrn, modes, &num, 32, 24, 
-               (pScrn->bitsPerPixel == 32),
-               (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
-               0xff0000, 0x00ff00, 0x0000ff, DirectColor);
-
-   pMga->numDGAModes = num;
-   pMga->DGAModes = modes;
-
-   return DGAInit(pScreen, &MGA_DGAFuncs, modes, num);  
-}
-
-
-static int 
-BitsSet(unsigned long data)
-{
-   unsigned long mask;
-   int set = 0;
-
-   for(mask = 1; mask; mask <<= 1)
-        if(mask & data) set++;   
-
-   return set;
-}
-
-/*
- * This is not strictly required - but it will load a 'sane'
- * palette when starting DGA.
- */
-static void
-mgaDGASetPalette(ScrnInfoPtr pScrn)
-{
-    MGAPtr pMga = MGAPTR(pScrn);
-    MGARamdacPtr MGAdac = &pMga->Dac;
-    unsigned char DAC[256*3];
-    int i;
-    
-    if (!MGAdac->RestorePalette)
-       return;
-    
-    for (i = 0; i < 256; i++) {
-       DAC[i*3] = i;
-       DAC[i*3 + 1] = i;
-       DAC[i*3 + 2] = i;
-    }
-    MGAdac->RestorePalette(pScrn, DAC);
-}
-
-
-static Bool
-MGA_SetMode(
-   ScrnInfoPtr pScrn,
-   DGAModePtr pMode
-){
-   static MGAFBLayout SavedLayouts[MAXSCREENS];
-   int index = pScrn->pScreen->myNum;
-
-   MGAPtr pMga = MGAPTR(pScrn);
-
-   if(!pMode) { /* restore the original mode */
-      if(pMga->DGAactive)
-        memcpy(&pMga->CurrentLayout, &SavedLayouts[index], sizeof(MGAFBLayout));
-                
-      pScrn->currentMode = pMga->CurrentLayout.mode;
-      pScrn->SwitchMode(index, pScrn->currentMode, 0);
-      MGAAdjustFrame(index, pScrn->frameX0, pScrn->frameY0, 0);
-      pMga->DGAactive = FALSE;
-   } else {
-      if(!pMga->DGAactive) {  /* save the old parameters */
-       memcpy(&SavedLayouts[index], &pMga->CurrentLayout, sizeof(MGAFBLayout));
-       pMga->DGAactive = TRUE;
-      }
-      /* update CurrentLayout */
-      pMga->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
-      pMga->CurrentLayout.depth = pMode->depth;
-      pMga->CurrentLayout.displayWidth = pMode->bytesPerScanline / 
-                              (pMode->bitsPerPixel >> 3);
-      pMga->CurrentLayout.weight.red = BitsSet(pMode->red_mask);
-      pMga->CurrentLayout.weight.green = BitsSet(pMode->green_mask);
-      pMga->CurrentLayout.weight.blue = BitsSet(pMode->blue_mask);
-      pMga->CurrentLayout.Overlay8Plus24 = FALSE;
-      /* MGAModeInit() will set the mode field */
-
-      pScrn->SwitchMode(index, pMode->mode, 0);
-      /* not strictly required but nice */
-      mgaDGASetPalette(pScrn);
-   }
-   
-   return TRUE;
-}
-
-
-
-static int  
-MGA_GetViewport(
-  ScrnInfoPtr pScrn
-){
-    MGAPtr pMga = MGAPTR(pScrn);
-
-    return pMga->DGAViewportStatus;
-}
-
-static void 
-MGA_SetViewport(
-   ScrnInfoPtr pScrn, 
-   int x, int y, 
-   int flags
-){
-   MGAPtr pMga = MGAPTR(pScrn);
-
-   MGAAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
-   pMga->DGAViewportStatus = 0;  /* MGAAdjustFrame loops until finished */
-}
-
-static void 
-MGA_FillRect (
-   ScrnInfoPtr pScrn, 
-   int x, int y, int w, int h, 
-   unsigned long color
-){
-    MGAPtr pMga = MGAPTR(pScrn);
-
-    if(!pMga->AccelInfoRec) return;
-
-    mgaDoSetupForSolidFill(pScrn, color, GXcopy, ~0, 
-                          pMga->CurrentLayout.bitsPerPixel);
-    (*pMga->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
-
-    SET_SYNC_FLAG(pMga->AccelInfoRec);
-}
-
-static void 
-MGA_BlitRect(
-   ScrnInfoPtr pScrn, 
-   int srcx, int srcy, 
-   int w, int h, 
-   int dstx, int dsty
-){
-    MGAPtr pMga = MGAPTR(pScrn);
-    int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
-    int ydir = (srcy < dsty) ? -1 : 1;
-
-    if(!pMga->AccelInfoRec) return;
-
-    mgaDoSetupForScreenToScreenCopy( pScrn, xdir, ydir, GXcopy, ~0, -1,
-                                    pMga->CurrentLayout.bitsPerPixel );
-
-    (*pMga->AccelInfoRec->SubsequentScreenToScreenCopy)(
-               pScrn, srcx, srcy, dstx, dsty, w, h);
-
-    SET_SYNC_FLAG(pMga->AccelInfoRec);
-}
-
-
-static void MGA_BlitTransRect( ScrnInfoPtr pScrn, int srcx, int srcy, 
-                              int w, int h, int dstx, int dsty,
-                              unsigned long color )
-{
-    MGAPtr pMga = MGAPTR(pScrn);
-
-    if( (pMga->AccelInfoRec != NULL)
-       && (pMga->CurrentLayout.bitsPerPixel != 24)
-       && (pMga->Chipset != PCI_CHIP_MGA2064) ) {
-       const int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
-       const int ydir = (srcy < dsty) ? -1 : 1;
-
-       pMga->DrawTransparent = TRUE;
-
-       mgaDoSetupForScreenToScreenCopy( pScrn, xdir, ydir, GXcopy, ~0, color,
-                                        pMga->CurrentLayout.bitsPerPixel );
-
-       pMga->DrawTransparent = FALSE;
-
-       (*pMga->AccelInfoRec->SubsequentScreenToScreenCopy)(
-           pScrn, srcx, srcy, dstx, dsty, w, h);
-
-       SET_SYNC_FLAG(pMga->AccelInfoRec);
-    }
-}
-
-
-static Bool 
-MGA_OpenFramebuffer(
-   ScrnInfoPtr pScrn, 
-   char **name,
-   unsigned char **mem,
-   int *size,
-   int *offset,
-   int *flags
-){
-    MGAPtr pMga = MGAPTR(pScrn);
-
-    *name = NULL;              /* no special device */
-    *mem = (unsigned char*)pMga->FbAddress;
-    *size = pMga->FbMapSize;
-    *offset = 0;
-    *flags = DGA_NEED_ROOT;
-
-    return TRUE;
-}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_dri.c new/xf86-video-mga-1.9.100/src/mga_dri.c
--- old/xf86-video-mga-1.9.99/src/mga_dri.c     2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_dri.c    2007-10-02 21:53:00.000000000 +0200
@@ -359,8 +359,6 @@
    pMga->haveQuiescense = 1;
 
    if ( pMga->directRenderingEnabled ) {
-      MGAFBLayout *pLayout = &pMga->CurrentLayout;
-
       MGAWaitForIdleDMA( pScrn );
 
         /* FIXME what about EXA? */
@@ -368,7 +366,7 @@
         if (!pMga->Exa && pMga->AccelInfoRec) {
       WAITFIFO( 11 );
       OUTREG( MGAREG_MACCESS, pMga->MAccess );
-      OUTREG( MGAREG_PITCH, pLayout->displayWidth );
+      OUTREG(MGAREG_PITCH, pScrn->displayWidth);
 
       pMga->PlaneMask = ~0;
       OUTREG( MGAREG_PLNWT, pMga->PlaneMask );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_driver.c new/xf86-video-mga-1.9.100/src/mga_driver.c
--- old/xf86-video-mga-1.9.99/src/mga_driver.c  2007-09-15 00:17:19.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_driver.c 2007-10-02 23:11:28.000000000 +0200
@@ -2286,15 +2286,6 @@
        }
     }
 #endif
-    pMga->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel;
-    pMga->CurrentLayout.depth = pScrn->depth;
-    pMga->CurrentLayout.displayWidth = pScrn->displayWidth;
-    pMga->CurrentLayout.weight.red = pScrn->weight.red;
-    pMga->CurrentLayout.weight.green = pScrn->weight.green;
-    pMga->CurrentLayout.weight.blue = pScrn->weight.blue;
-    pMga->CurrentLayout.Overlay8Plus24 = pMga->Overlay8Plus24;
-    pMga->CurrentLayout.mode = pScrn->currentMode;
-       
 
     xf86SetPrimInitDone(pScrn->entityList[0]);
     
@@ -2822,11 +2813,6 @@
     pMga->BlockHandler = pScreen->BlockHandler;
     pScreen->BlockHandler = MGABlockHandler;
 
-#if 0
-    if(!pMga->ShadowFB) /* hardware cursor needs to wrap this layer */
-       MGADGAInit(pScreen);
-#endif
-
     if (!pMga->NoAccel) {
 #ifdef USE_EXA
        if (pMga->Exa)
@@ -2838,15 +2824,6 @@
 #endif
     }
 
-    pMga->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel;
-    pMga->CurrentLayout.depth = pScrn->depth;
-    pMga->CurrentLayout.displayWidth = pScrn->displayWidth;
-    pMga->CurrentLayout.weight.red = pScrn->weight.red;
-    pMga->CurrentLayout.weight.green = pScrn->weight.green;
-    pMga->CurrentLayout.weight.blue = pScrn->weight.blue;
-    pMga->CurrentLayout.Overlay8Plus24 = pMga->Overlay8Plus24;
-    pMga->CurrentLayout.mode = pScrn->currentMode;
-
     if (!MGAEnterVT(scrnIndex, 0))
         return FALSE;
 
@@ -3112,8 +3089,6 @@
        xf86DestroyCursorInfoRec(pMga->CursorInfoRec);
     if (pMga->ShadowPtr)
        xfree(pMga->ShadowPtr);
-    if (pMga->DGAModes)
-       xfree(pMga->DGAModes);
     if (pMga->adaptor)
        xfree(pMga->adaptor);
     if (pMga->portPrivate)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_exa.c new/xf86-video-mga-1.9.100/src/mga_exa.c
--- old/xf86-video-mga-1.9.99/src/mga_exa.c     2007-09-14 23:20:52.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_exa.c    2007-10-02 22:06:08.000000000 +0200
@@ -322,11 +322,6 @@
     int w = pPict->pDrawable->width;
     int h = pPict->pDrawable->height;
 
-    if ((w > 2047) || (h > 2047)){
-        DEBUG_MSG(("Picture w/h too large (%dx%d)\n", w, h));
-        return FALSE;
-    }
-
     if (!mgaGetTexFormat(pPict)) {
         DEBUG_MSG(("Unsupported picture format 0x%x\n", pPict->format));
         return FALSE;
@@ -725,7 +720,7 @@
 {
     PMGA(pSrc);
 
-    char *src = pSrc->devPrivate.ptr;
+    CARD8 *src = pMga->FbStart + exaGetPixmapOffset(pSrc);
     int src_pitch = exaGetPixmapPitch(pSrc);
 
     int cpp = (pSrc->drawable.bitsPerPixel + 7) / 8;
@@ -734,6 +729,7 @@
     src += y * src_pitch + x * cpp;
 
     QUIESCE_DMA(pSrc);
+    exaWaitSync(pSrc->drawable.pScreen);
 
     while (h--) {
        memcpy (dst, src, bytes);
@@ -780,7 +776,7 @@
     }
 
     maxlines = (min(pMga->FbUsableSize, mb * 1024 * 1024)) /
-               (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8);
+               (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
 
     dri->frontOffset = 0;
     dri->frontPitch = widthBytes;
@@ -872,6 +868,11 @@
     pExa->maxX = 2048;
     pExa->maxY = 2048;
 
+#if EXA_VERSION_MAJOR > 2 || \
+    (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR > 2)
+    pExa->maxPitchPixels = 4096;
+#endif
+
     pExa->WaitMarker = mgaWaitMarker;
     pExa->PrepareSolid = mgaPrepareSolid;
     pExa->Solid = mgaSolid;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_g_crtc2.c new/xf86-video-mga-1.9.100/src/mga_g_crtc2.c
--- old/xf86-video-mga-1.9.99/src/mga_g_crtc2.c 2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_g_crtc2.c        2007-10-02 22:01:52.000000000 +0200
@@ -59,6 +59,7 @@
     CARD32 c2datactl;
 
     /* DAC registers */
+    CARD8 sync_ctl;
     CARD8 pwr_ctl;
 } MgaCrtcState, *MgaCrtcStatePtr;
 
@@ -167,10 +168,10 @@
 static void
 state_save(xf86CrtcPtr crtc, MgaCrtcStatePtr state)
 {
-    state->clock = MGAG450SavePLLFreq(crtc->scrn, MGA_VIDEO_PLL);
+    MGAPtr pMga = MGAPTR(crtc->scrn);
 
-    // output?
-    //state->sync_ctl = inMGAdac(MGA1064_SYNC_CTL);
+    state->clock = MGAG450SavePLLFreq(crtc->scrn, MGA_VIDEO_PLL);
+    state->sync_ctl = inMGAdac(MGA1064_SYNC_CTL);
 
     // output?
     //state->pwr_ctl = inMGAdac(MGA1064_PWR_CTL);
@@ -264,43 +265,10 @@
 static void
 crtc_restore(xf86CrtcPtr crtc)
 {
-#if 0
+    MgaCrtcDataPtr data = MGACRTCDATAPTR(crtc);
     MGAPtr pMga = MGAPTR(crtc->scrn);
 
-    /* since we cannot save the state in crtc_save(), we just
-     * return to clone mode here.
-     */
-
-    if (pMga->SecondOutput
-            && (xf86IsEntityShared(crtc->scrn->entityList[0]) || pMga->SecondCrtc)
-            && !pMga->MergedFB) {
-        /* Do this branch if
-         * SecondOutput
-         * and not Unshared Primary
-         * and not Merged Mode (usualy means Unshared Primary)
-         */
-        CARD8 disp_ctl = inMGAdac(MGA1064_DISP_CTL);
-
-        disp_ctl &= ~MGA1064_DISP_CTL_DAC2OUTSEL_MASK;
-        disp_ctl |= MGA1064_DISP_CTL_DAC2OUTSEL_CRTC1;
-
-        outMGAdac(MGA1064_DISP_CTL, disp_ctl);
-    } else {
-        CARD8 disp_ctl = inMGAdac(MGA1064_DISP_CTL);
-        CARD32 c2ctl = INREG(MGAREG_C2CTL);
-
-        disp_ctl &= ~MGA1064_DISP_CTL_DAC2OUTSEL_MASK;
-        disp_ctl |= MGA1064_DISP_CTL_DAC1OUTSEL_EN;
-        disp_ctl |= MGA1064_DISP_CTL_DAC2OUTSEL_CRTC1;
-
-        /* crtcdacsel -> crtc1 */
-        c2ctl &= ~MGAREG_C2CTL_CRTCDACSEL_CRTC2;
-        c2ctl |= MGAREG_C2CTL_CRTCDACSEL_CRTC1;
-
-        outMGAdac(MGA1064_DISP_CTL, disp_ctl);
-        OUTREG(MGAREG_C2CTL, c2ctl);
-    }
-#endif
+    outMGAdac(MGA1064_SYNC_CTL, data->saved_state.sync_ctl);
 }
 
 static Bool
@@ -336,12 +304,21 @@
 crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
               DisplayModePtr adjusted_mode, int x, int y)
 {
+    MGAPtr pMga = MGAPTR(crtc->scrn);
     MgaCrtcState state;
 
     memset (&state, 0, sizeof (state));
 
     state_set(crtc, &state, mode, x, y);
     state_restore(crtc, &state);
+
+    /* FIXME:
+     * Don't use magic numbers here. The bits in SYNC_CTL were
+     * documented in mga_dh.c.
+     *
+     * Also I'm not sure whether this is the best place to set SYNC_CTL.
+     */
+    outMGAdac(MGA1064_SYNC_CTL, 0xcc);
 }
 
 static void
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_g_crtc.c new/xf86-video-mga-1.9.100/src/mga_g_crtc.c
--- old/xf86-video-mga-1.9.99/src/mga_g_crtc.c  2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_g_crtc.c 2007-10-02 23:56:04.000000000 +0200
@@ -325,10 +325,10 @@
     int hd, hs, he, ht, vd, vs, ve, vt, wd;
     int BppShift;
     MGAPtr pMga = MGAPTR(crtc->scrn);
-    MGAFBLayout *pLayout = &pMga->CurrentLayout;
     vgaRegPtr vga = &VGAHWPTR(crtc->scrn)->ModeReg;
+    unsigned int startadd = (y * crtc->scrn->virtualX) + x;
 
-    BppShift = pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1];
+    BppShift = pMga->BppShifts[(crtc->scrn->bitsPerPixel >> 3) - 1];
 
     for (i = 0; i < sizeof(state->DacRegs); i++)
         state->DacRegs[i] = initDAC[i];
@@ -466,35 +466,42 @@
        polling to keep them from occuring */
     state->Option &= ~0x20000000;
 
-    switch (pLayout->bitsPerPixel) {
+    switch (crtc->scrn->bitsPerPixel) {
     case 8:
         state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_8bits;
+        startadd /= 8;
         break;
     case 16:
         state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_16bits;
 
-        if ((pLayout->weight.red == 5) && (pLayout->weight.green == 5)
-            && (pLayout->weight.blue == 5)) {
+        if ((crtc->scrn->weight.red == 5) && (crtc->scrn->weight.green == 5)
+            && (crtc->scrn->weight.blue == 5)) {
             state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_15bits;
         }
 
+        startadd /= 4;
         break;
     case 24:
         state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_24bits;
+        startadd /= 8;
         break;
     case 32:
-        if (pLayout->Overlay8Plus24) {
+        if (pMga->Overlay8Plus24) {
             state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_32bits;
             state->DacRegs[MGA1064_COL_KEY_MSK_LSB] = 0xFF;
             state->DacRegs[MGA1064_COL_KEY_LSB] = pMga->colorKey;
         } else
             state->DacRegs[MGA1064_MUL_CTL] = MGA1064_MUL_CTL_32_24bits;
 
+        startadd /= 2;
         break;
     default:
         FatalError("MGA: unsupported depth\n");
     }
 
+    /* we only have 20 bits to store the start address */
+    startadd &= 0xfffff;
+
     /*
      * This will initialize all of the generic VGA registers.
      */
@@ -521,10 +528,10 @@
     if ((ht & 0x07) == 0x06 || (ht & 0x07) == 0x04)
         ht++;
 
-    if (pLayout->bitsPerPixel == 24)
-        wd = (pLayout->displayWidth * 3) >> (4 - BppShift);
+    if (crtc->scrn->bitsPerPixel == 24)
+        wd = (crtc->scrn->displayWidth * 3) >> (4 - BppShift);
     else
-        wd = pLayout->displayWidth >> (4 - BppShift);
+        wd = crtc->scrn->displayWidth >> (4 - BppShift);
 
     state->ExtVga[0] = 0;
     state->ExtVga[5] = 0;
@@ -537,6 +544,7 @@
     }
 
     state->ExtVga[0] |= (wd & 0x300) >> 4;
+    state->ExtVga[0] |= (startadd >> 16) & 0x0f;
 
     state->ExtVga[1] = (((ht - 4) & 0x100) >> 8) |
                        ((hd & 0x100) >> 7) |
@@ -548,7 +556,7 @@
                        ((vs & 0xc00) >> 5) |
                        ((vd & 0x400) >> 3); /* linecomp */
 
-    if (pLayout->bitsPerPixel == 24)
+    if (crtc->scrn->bitsPerPixel == 24)
         state->ExtVga[3] = (((1 << BppShift) * 3) - 1) | 0x80;
     else
         state->ExtVga[3] = ((1 << BppShift) - 1) | 0x80;
@@ -573,6 +581,9 @@
     vga->CRTC[9] = ((vd & 0x200) >> 4) |
                    ((vd & 0x200) >> 3); /* linecomp */
 
+    vga->CRTC[12] = (startadd & 0xff00) >> 8;
+    vga->CRTC[13] = startadd & 0xff;
+
     vga->CRTC[16] = vs & 0xFF;
     vga->CRTC[17] = (ve & 0x0F) | 0x20;
     vga->CRTC[18] = vd & 0xFF;
@@ -714,9 +725,10 @@
         if (vga_flags & VGA_SR_FONTS)
             MGAG200SERestoreFonts(scrn, vga);
     } else
-        vgaHWRestore(scrn, vga, vga_flags);
+        vgaHWRestore(scrn, vga, vga_flags & ~VGA_SR_CMAP);
 
-    MGAGRestorePalette(scrn, vga->DAC);
+    if (vga_flags & VGA_SR_CMAP)
+        MGAGRestorePalette(scrn, vga->DAC);
 
     /*
      * this is needed to properly restore start address
@@ -842,7 +854,7 @@
     MgaCrtcDataPtr data = MGACRTCDATAPTR(crtc);
     MGAPtr pMga = MGAPTR(crtc->scrn);
     vgaHWPtr vga = VGAHWPTR(crtc->scrn);
-    int vga_flags = VGA_SR_MODE;
+    int vga_flags = VGA_SR_MODE | VGA_SR_CMAP;
 
     if (pMga->Primary)
         vga_flags |= VGA_SR_FONTS;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_g_output.c new/xf86-video-mga-1.9.100/src/mga_g_output.c
--- old/xf86-video-mga-1.9.99/src/mga_g_output.c        2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_g_output.c       2007-10-02 22:01:40.000000000 +0200
@@ -48,6 +48,7 @@
 static void output_panel2_dpms(xf86OutputPtr output, int mode);
 static void output_save(xf86OutputPtr output);
 static void output_restore(xf86OutputPtr output);
+static void output_dac2_restore(xf86OutputPtr output);
 static void output_panel_restore(xf86OutputPtr output);
 static int output_mode_valid(xf86OutputPtr output, DisplayModePtr mode);
 static Bool output_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
@@ -83,7 +84,7 @@
 static const xf86OutputFuncsRec output_dac2_funcs = {
     .dpms = output_dac2_dpms,
     .save = output_save,
-    .restore = output_restore,
+    .restore = output_dac2_restore,
     .mode_valid = output_mode_valid,
     .mode_fixup = output_mode_fixup,
     .prepare = output_prepare,
@@ -124,6 +125,30 @@
 
 static int panel_users = 0;
 
+/* enable/disable primary output. */
+static void
+output1_dpms(xf86OutputPtr output, int mode)
+{
+    MGAPtr pMga = MGAPTR(output->scrn);
+    CARD8 misc_ctl, disp_ctl, mask;
+
+    misc_ctl = inMGAdac(MGA1064_MISC_CTL);
+    mask = MGA1064_MISC_CTL_DAC_EN;
+
+    if (mode == DPMSModeOn)
+        outMGAdac(MGA1064_MISC_CTL, misc_ctl | mask);
+    else
+        outMGAdac(MGA1064_MISC_CTL, misc_ctl & ~mask);
+
+    disp_ctl = inMGAdac(MGA1064_DISP_CTL);
+    mask = MGA1064_DISP_CTL_DAC1OUTSEL_EN;
+
+    if (mode == DPMSModeOn)
+        outMGAdac(MGA1064_DISP_CTL, disp_ctl | mask);
+    else
+        outMGAdac(MGA1064_DISP_CTL, disp_ctl & ~mask);
+}
+
 static void
 output_dac1_dpms(xf86OutputPtr output, int mode)
 {
@@ -135,7 +160,6 @@
      */
 
     MGAPtr pMga = MGAPTR(output->scrn);
-    CARD8 misc_ctl, disp_ctl, mask;
 
 #if 0
     CARD8 val, seq1, crtcext1;
@@ -179,27 +203,7 @@
     OUTREG8(MGAREG_CRTCEXT_DATA, crtcext1);
 #endif
 
-    /* enable/disable DAC.
-     *
-     * FIXME:
-     * does this affect DAC2 too?
-     */
-    misc_ctl = inMGAdac(MGA1064_MISC_CTL);
-    mask = MGA1064_MISC_CTL_DAC_EN;
-
-    if (mode == DPMSModeOn)
-        outMGAdac(MGA1064_MISC_CTL, misc_ctl | mask);
-    else
-        outMGAdac(MGA1064_MISC_CTL, misc_ctl & ~mask);
-
-    disp_ctl = inMGAdac(MGA1064_DISP_CTL);
-    mask = MGA1064_DISP_CTL_DAC1OUTSEL_EN;
-
-    if (mode == DPMSModeOn)
-        outMGAdac(MGA1064_DISP_CTL, disp_ctl | mask);
-    else
-        outMGAdac(MGA1064_DISP_CTL, disp_ctl & ~mask);
-
+    output1_dpms(output, mode);
 }
 
 static void
@@ -241,6 +245,8 @@
         if (!panel_users)
             outMGAdac(MGA1064_PWR_CTL, pwr_ctl & ~mask);
     }
+
+    output1_dpms(output, mode);
 }
 
 static void
@@ -278,6 +284,19 @@
 }
 
 static void
+output_dac2_restore(xf86OutputPtr output)
+{
+    MGAPtr pMga = MGAPTR(output->scrn);
+    CARD8 disp_ctl;
+
+    disp_ctl = inMGAdac(MGA1064_DISP_CTL);
+    disp_ctl &= ~MGA1064_DISP_CTL_DAC2OUTSEL_MASK;
+    disp_ctl |= MGA1064_DISP_CTL_DAC2OUTSEL_CRTC1;
+
+    outMGAdac(MGA1064_DISP_CTL, disp_ctl);
+}
+
+static void
 output_panel_restore(xf86OutputPtr output)
 {
     MGAPtr pMga = MGAPTR(output->scrn);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga.h new/xf86-video-mga-1.9.100/src/mga.h
--- old/xf86-video-mga-1.9.99/src/mga.h 2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga.h        2007-10-02 21:51:55.000000000 +0200
@@ -222,16 +222,6 @@
     void       (*PreInit)(ScrnInfoPtr);
 } MGARamdacRec, *MGARamdacPtr;
 
-
-typedef struct {
-    int bitsPerPixel;
-    int depth;
-    int displayWidth;
-    rgb weight;
-    Bool Overlay8Plus24;
-    DisplayModePtr mode;
-} MGAFBLayout;
-
 /* Card-specific driver information */
 
 typedef struct {
@@ -463,10 +453,6 @@
     int                        StyleLen;
     XAAInfoRecPtr      AccelInfoRec;
     xf86CursorInfoPtr  CursorInfoRec;
-    DGAModePtr         DGAModes;
-    int                        numDGAModes;
-    Bool               DGAactive;
-    int                        DGAViewportStatus;
     CARD32             *Atype;
     CARD32             *AtypeNoBLK;
     void               (*PreInit)(ScrnInfoPtr pScrn);
@@ -488,7 +474,6 @@
     int                        videoKey;
     int                        fifoCount;
     int                        Rotate;
-    MGAFBLayout                CurrentLayout;
     Bool               DrawTransparent;
     int                        MaxBlitDWORDS;
     Bool               TexturedVideo;
@@ -611,8 +596,6 @@
 
 void MGAPolyArcThinSolid(DrawablePtr, GCPtr, int, xArc*);
 
-Bool MGADGAInit(ScreenPtr pScreen);
-
 void MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
 void MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
 void MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_macros.h new/xf86-video-mga-1.9.100/src/mga_macros.h
--- old/xf86-video-mga-1.9.99/src/mga_macros.h  2007-09-15 00:16:57.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_macros.h 2007-10-02 21:51:30.000000000 +0200
@@ -41,7 +41,7 @@
    }
 
 #define XYADDRESS(x,y) \
-    ((y) * pMga->CurrentLayout.displayWidth + (x) + pMga->YDstOrg)
+    ((y) * pScrn->displayWidth + (x) + pMga->YDstOrg)
 
 #define MAKEDMAINDEX(index)  ((((index) >> 2) & 0x7f) | (((index) >> 6) & 0x80))
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_storm.c new/xf86-video-mga-1.9.100/src/mga_storm.c
--- old/xf86-video-mga-1.9.99/src/mga_storm.c   2007-09-14 20:44:28.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_storm.c  2007-10-02 21:59:18.000000000 +0200
@@ -601,7 +601,7 @@
     BoxRec AvailFBArea;
     int i;
 
-    pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel) + 127) >> 3);
+    pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * pScrn->bitsPerPixel) + 127) >> 3);
     if(!pMga->ScratchBuffer) return FALSE;
 
     pMga->AccelInfoRec = infoPtr = XAACreateInfoRec();
@@ -622,7 +622,7 @@
        pMga->AccelFlags |= LARGE_ADDRESSES;
     }
 
-    if (pMga->CurrentLayout.bitsPerPixel == 24) {
+    if (pScrn->bitsPerPixel == 24) {
        pMga->AccelFlags |= MGA_NO_PLANEMASK;
     }
 
@@ -728,13 +728,13 @@
        infoPtr->SubsequentScreenToScreenColorExpandFill =
                mgaSubsequentScreenToScreenColorExpandFill;
     } 
-    else if ( pMga->CurrentLayout.bitsPerPixel != 24 ) {
+    else if (pScrn->bitsPerPixel != 24 ) {
        /* Alternate (but slower) planar expansions */
        infoPtr->SetupForScreenToScreenColorExpandFill =
          mgaSetupForPlanarScreenToScreenColorExpandFill;
        infoPtr->SubsequentScreenToScreenColorExpandFill =
          mgaSubsequentPlanarScreenToScreenColorExpandFill;
-       infoPtr->CacheColorExpandDensity = pMga->CurrentLayout.bitsPerPixel;
+       infoPtr->CacheColorExpandDensity = pScrn->bitsPerPixel;
        infoPtr->CacheMonoStipple = XAAGetCachePlanarMonoStipple();
 
        /* It's faster to blit the stipples if you have fastbilt 
@@ -800,18 +800,18 @@
     maxFastBlitMem = (pMga->Interleave ? 4096 : 2048) * 1024;
 
     if(pMga->FbMapSize > maxFastBlitMem) {
-       pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8);
+       pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
     }
 
     switch (pMga->Chipset) {
     case PCI_CHIP_MGAG200_SE_A_PCI:
     case PCI_CHIP_MGAG200_SE_B_PCI:
        maxlines = (min(pMga->FbUsableSize, 1*1024*1024)) /
-                  (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8);
+                  (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
        break;
     default:
        maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) /
-                  (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8);
+                  (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
        break;
     }
 
@@ -977,7 +977,6 @@
 static void mgaRestoreAccelState(ScrnInfoPtr pScrn)
 {
    MGAPtr pMga = MGAPTR(pScrn);
-   MGAFBLayout *pLayout = &pMga->CurrentLayout;
     unsigned int replicate_fg = 0;
     unsigned int replicate_bg = 0;
     unsigned int replicate_pm = 0;
@@ -986,16 +985,16 @@
    WAITFIFO(12);
    pMga->SrcOrg = 0;
    OUTREG(MGAREG_MACCESS, pMga->MAccess);
-   OUTREG(MGAREG_PITCH, pLayout->displayWidth);
+   OUTREG(MGAREG_PITCH, pScrn->displayWidth);
    OUTREG(MGAREG_YDSTORG, pMga->YDstOrg);
 
 
     common_replicate_colors_and_mask( pMga->FgColor, pMga->BgColor,
-                                     pMga->PlaneMask, pLayout->bitsPerPixel,
+                                     pMga->PlaneMask, pScrn->bitsPerPixel,
                                      & replicate_fg, & replicate_bg,
                                      & replicate_pm );
 
-    if( (pLayout->bitsPerPixel != 24)
+    if ((pScrn->bitsPerPixel != 24)
        && ((pMga->AccelFlags & MGA_NO_PLANEMASK) == 0) ) {
        OUTREG( MGAREG_PLNWT, replicate_pm );
     }
@@ -1072,7 +1071,6 @@
 {
     long maccess = 0;
     MGAPtr pMga = MGAPTR(pScrn);
-    MGAFBLayout *pLayout = &pMga->CurrentLayout;
     CARD32 opmode;
     static const unsigned int maccess_table[5] = {
    /* bpp:  8  16  24  32 */
@@ -1091,12 +1089,12 @@
 
     opmode = INREG(MGAREG_OPMODE);
 
-    maccess |= maccess_table[ pLayout->bitsPerPixel / 8 ];
-    if ( pLayout->depth == 15 ) {
+    maccess |= maccess_table[pScrn->bitsPerPixel / 8];
+    if (pScrn->depth == 15) {
         maccess |= (1 << 31);
     }
 
-    opmode |= opmode_table[ pLayout->bitsPerPixel / 8 ];
+    opmode |= opmode_table[pScrn->bitsPerPixel / 8];
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
     opmode &= ~0x30000;
 #endif
@@ -1116,7 +1114,7 @@
                                                pMga->FifoSize);
     }
 
-    OUTREG(MGAREG_PITCH, pLayout->displayWidth);
+    OUTREG(MGAREG_PITCH, pScrn->displayWidth);
     OUTREG(MGAREG_YDSTORG, pMga->YDstOrg);
     OUTREG(MGAREG_MACCESS, maccess);
     pMga->MAccess = maccess;
@@ -1190,25 +1188,25 @@
 
 
 static CARD32
-common_setup_for_pattern_fill( MGAPtr pMga, int fg, int bg, int rop,
+common_setup_for_pattern_fill(ScrnInfoPtr pScrn, int fg, int bg, int rop,
                               int planemask,
                               CARD32 * reg_data, unsigned int count,
                               CARD32 cmd )
 {
+    MGAPtr pMga = MGAPTR(pScrn);
     unsigned int replicate_fg = 0;
     unsigned int replicate_bg = 0;
     unsigned int replicate_pm = 0;
     unsigned int i;
 
-
     common_replicate_colors_and_mask( fg, bg, planemask,
-                                     pMga->CurrentLayout.bitsPerPixel,
+                                     pScrn->bitsPerPixel,
                                      & replicate_fg, & replicate_bg,
                                      & replicate_pm );
 
 
     if( bg == -1 ) {
-       if ( (pMga->CurrentLayout.bitsPerPixel == 24) && !RGBEQUAL(fg) ) {
+       if ((pScrn->bitsPerPixel == 24) && !RGBEQUAL(fg) ) {
             cmd |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop];
        }
        else {
@@ -1225,7 +1223,7 @@
         */
 
        if( ((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) != 0)
-           && ((pMga->CurrentLayout.bitsPerPixel != 24)
+           && ((pScrn->bitsPerPixel != 24)
                || (RGBEQUAL(fg) && RGBEQUAL(bg))) ) {
            cmd |= pMga->Atype[rop];
        }
@@ -1239,7 +1237,7 @@
 
     SET_FOREGROUND_REPLICATED( fg, replicate_fg );
     SET_PLANEMASK_REPLICATED( planemask, replicate_pm,
-                             pMga->CurrentLayout.bitsPerPixel );
+                             pScrn->bitsPerPixel );
 
     /* FIXME: Is this the right order? */
 
@@ -1304,7 +1302,7 @@
     OUTREG(MGAREG_SGN, pMga->BltScanDirection);
 
     SET_PLANEMASK_REPLICATED( planemask, replicated_mask, bpp );
-    OUTREG(MGAREG_AR5, ydir * pMga->CurrentLayout.displayWidth);
+    OUTREG(MGAREG_AR5, ydir * pScrn->displayWidth);
 }
 
 
@@ -1312,10 +1310,8 @@
                                    int rop, unsigned int planemask,
                                    int trans )
 {
-    MGAPtr pMga = MGAPTR(pScrn);
-
     mgaDoSetupForScreenToScreenCopy( pScrn, xdir, ydir, rop, planemask, trans,
-                                    pMga->CurrentLayout.bitsPerPixel );
+                                    pScrn->bitsPerPixel );
 }
 
 
@@ -1328,7 +1324,7 @@
 
     if (pMga->AccelFlags & LARGE_ADDRESSES) {
        const unsigned int display_bit_width =
-         (pMga->CurrentLayout.displayWidth * pMga->CurrentLayout.bitsPerPixel);
+         (pScrn->displayWidth * pScrn->bitsPerPixel);
 
        SrcOrg = ((srcY & ~1023) * display_bit_width) >> 9;
        DstOrg = ((dstY & ~1023) * display_bit_width) >> 9;
@@ -1355,7 +1351,7 @@
            OUTREG(MGAREG_SRCORG, (SrcOrg << 6) + pMga->realSrcOrg);
        }
        if(SrcOrg) {
-           SrcOrg = (SrcOrg << 9) / pMga->CurrentLayout.bitsPerPixel;
+           SrcOrg = (SrcOrg << 9) / pScrn->bitsPerPixel;
            end -= SrcOrg;
            start -= SrcOrg;
        }
@@ -1397,7 +1393,7 @@
 
     /* we assume the driver asserts screen pitches such that
        we can always use fastblit for scrolling */
-    if(((srcX ^ dstX) & masks[ pMga->CurrentLayout.bitsPerPixel / 8 ]) == 0) {
+    if(((srcX ^ dstX) & masks[pScrn->bitsPerPixel / 8]) == 0) {
        if(pMga->MaxFastBlitY) {
           if(pMga->BltScanDirection & BLIT_UP) {
                if((srcY >= pMga->MaxFastBlitY) ||
@@ -1418,9 +1414,9 @@
            static const unsigned shift_tab[5] = {
                0, 6, 5, 6, 4
            };
-           const unsigned shift = shift_tab[pMga->CurrentLayout.bitsPerPixel / 8];
+           const unsigned shift = shift_tab[pScrn->bitsPerPixel / 8];
            
-          if (pMga->CurrentLayout.bitsPerPixel == 24) {
+          if (pScrn->bitsPerPixel == 24) {
               tmp_dstX *= 3;
               tmp_fxright = fxright * 3 + 2;
           }
@@ -1428,7 +1424,7 @@
            if( (tmp_dstX & (1 << shift)) 
               && (((tmp_fxright >> shift) - (tmp_dstX >> shift)) & 7) == 7) {
               fxright = (tmp_fxright | (1 << shift));
-              if (pMga->CurrentLayout.bitsPerPixel == 24) {
+              if (pScrn->bitsPerPixel == 24) {
                   fxright /= 3;
               }
 
@@ -1520,10 +1516,8 @@
 void mgaSetupForSolidFill( ScrnInfoPtr pScrn, int color, int rop,
                           unsigned int planemask )
 {
-    MGAPtr pMga = MGAPTR(pScrn);
-
     mgaDoSetupForSolidFill( pScrn, color, rop, planemask, 
-                           pMga->CurrentLayout.bitsPerPixel );
+                           pScrn->bitsPerPixel);
 }
 
 void mgaSubsequentSolidFillRect( ScrnInfoPtr pScrn, 
@@ -1626,7 +1620,7 @@
     regs[2] = MGAREG_PAT1;
     regs[3] = paty;
 
-    pMga->PatternRectCMD = common_setup_for_pattern_fill( pMga, fg, bg, rop,
+    pMga->PatternRectCMD = common_setup_for_pattern_fill(pScrn, fg, bg, rop,
                                                          planemask, regs, 2,
                                                          (MGADWG_TRAP
                                                           | MGADWG_ARZERO
@@ -1706,7 +1700,7 @@
 
     CHECK_DMA_QUIESCENT(pMga, pScrn);
 
-    (void) common_setup_for_pattern_fill( pMga, fg, bg, rop,
+    (void) common_setup_for_pattern_fill( pScrn, fg, bg, rop,
                                          planemask, NULL, 0,
                                          MGADWG_ILOAD | MGADWG_LINEAR 
                                          | MGADWG_SGNZERO | MGADWG_SHIFTZERO
@@ -1832,7 +1826,7 @@
     MGAPtr pMga = MGAPTR(pScrn);
     unsigned int replicate_pm = 0;
 
-    switch( pMga->CurrentLayout.bitsPerPixel ) {
+    switch (pScrn->bitsPerPixel) {
     case 8:
        replicate_pm = REPLICATE_8( planemask );
        break;
@@ -1852,7 +1846,7 @@
     WAITFIFO(3);
     OUTREG(MGAREG_AR5, 0);
     SET_PLANEMASK_REPLICATED( planemask, replicate_pm,
-                             pMga->CurrentLayout.bitsPerPixel );
+                             pScrn->bitsPerPixel );
     OUTREG(MGAREG_DWGCTL, MGADWG_ILOAD | MGADWG_BFCOL | MGADWG_SHIFTZERO |
                        MGADWG_SGNZERO | pMga->AtypeNoBLK[rop]);
 }
@@ -1866,7 +1860,7 @@
 
     pMga->AccelFlags |= CLIPPER_ON;
     pMga->expandRows = h;
-    pMga->expandDWORDs = ((w * pMga->CurrentLayout.bitsPerPixel) + 31) >> 5;
+    pMga->expandDWORDs = ((w * pScrn->bitsPerPixel) + 31) >> 5;
 
     WAITFIFO(5);
     OUTREG(MGAREG_CXBNDRY, 0xFFFF0000 | ((x + skipleft) & 0xFFFF));
@@ -1920,7 +1914,7 @@
 
 
     common_replicate_colors_and_mask( fg, bg, planemask,
-                                     pMga->CurrentLayout.bitsPerPixel,
+                                     pScrn->bitsPerPixel,
                                      & replicate_fg, & replicate_bg,
                                      & replicate_pm );
 
@@ -1938,7 +1932,7 @@
     }
 
     SET_PLANEMASK_REPLICATED( planemask, replicate_pm,
-                             pMga->CurrentLayout.bitsPerPixel );
+                             pScrn->bitsPerPixel );
     SET_FOREGROUND_REPLICATED( fg, replicate_fg );
 
 
@@ -1958,7 +1952,7 @@
        pMga->AccelFlags |= NICE_DASH_PATTERN;
 
        if( bg == -1 ) {
-           if ( (pMga->CurrentLayout.bitsPerPixel == 24) && !RGBEQUAL(fg) ) {
+           if ((pScrn->bitsPerPixel == 24) && !RGBEQUAL(fg)) {
                pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop];
            }
            else {
@@ -1973,7 +1967,7 @@
             */
 
            if( ((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) != 0)
-               && ((pMga->CurrentLayout.bitsPerPixel != 24)
+               && ((pScrn->bitsPerPixel != 24)
                    || (RGBEQUAL(fg) && RGBEQUAL(bg))) ) {
                pMga->NiceDashCMD |= pMga->Atype[rop];
            }
@@ -2050,7 +2044,7 @@
 
     CHECK_DMA_QUIESCENT(pMga, pScrn);
 
-    (void) common_setup_for_pattern_fill( pMga, fg, bg, 0, planemask, regs, 1,
+    (void) common_setup_for_pattern_fill( pScrn, fg, bg, 0, planemask, regs, 1,
                                          mgaCMD );
 }
 
@@ -2088,11 +2082,11 @@
     CARD32 regs[2];
    
     regs[0] = MGAREG_AR5;
-    regs[1] = pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel;
+    regs[1] = pScrn->displayWidth * pScrn->bitsPerPixel;
 
     CHECK_DMA_QUIESCENT(pMga, pScrn);
 
-    (void) common_setup_for_pattern_fill( pMga, fg, bg, rop, planemask,
+    (void) common_setup_for_pattern_fill( pScrn, fg, bg, rop, planemask,
                                          regs, 1,
                                          MGADWG_BITBLT | MGADWG_SGNZERO 
                                          | MGADWG_SHIFTZERO );
@@ -2106,7 +2100,7 @@
 {
     MGAPtr pMga = MGAPTR(pScrn);
     const unsigned int display_bit_width =
-      (pMga->CurrentLayout.displayWidth * pMga->CurrentLayout.bitsPerPixel);
+      (pScrn->displayWidth * pScrn->bitsPerPixel);
     int start, end, next, num;
     Bool resetDstOrg = FALSE;
 
@@ -2129,7 +2123,7 @@
     }
 
     w--;
-    start = (XYADDRESS(srcx, srcy) * pMga->CurrentLayout.bitsPerPixel)
+    start = (XYADDRESS(srcx, srcy) * pScrn->bitsPerPixel)
       + skipleft;
     end = start + w + (display_bit_width * (h - 1));
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/xf86-video-mga-1.9.99/src/mga_video.c new/xf86-video-mga-1.9.100/src/mga_video.c
--- old/xf86-video-mga-1.9.99/src/mga_video.c   2007-09-14 20:42:39.000000000 +0200
+++ new/xf86-video-mga-1.9.100/src/mga_video.c  2007-10-02 21:51:30.000000000 +0200
@@ -597,7 +597,7 @@
 #endif /* USE_EXA */
 #ifdef USE_XAA
    FBLinearPtr linear = *mem_struct;
-   int cpp = pMga->CurrentLayout.bitsPerPixel / 8;
+   int cpp = pScrn->bitsPerPixel / 8;
 
    /* XAA allocates in units of pixels at the screen bpp, so adjust size
     * appropriately.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >