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

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



 configure.ac        |    2 
 src/Makefile.am     |    1 
 src/mga.h           |   17 -
 src/mga_2064_crtc.c |   27 +--
 src/mga_dac3026.c   |    2 
 src/mga_dacG.c      |    2 
 src/mga_dga.c       |  451 ----------------------------------------------------
 src/mga_dri.c       |    4 
 src/mga_driver.c    |   25 --
 src/mga_exa.c       |   15 -
 src/mga_g_crtc.c    |   38 ++--
 src/mga_g_crtc2.c   |   53 +-----
 src/mga_g_output.c  |   65 ++++---
 src/mga_macros.h    |    2 
 src/mga_storm.c     |   92 ++++------
 src/mga_video.c     |    2 
 16 files changed, 152 insertions(+), 646 deletions(-)

New commits:
commit ecf0c42966beddb332e432e89e808ae9ff06e039
Author: Tilman Sauerbeck <tilman@code-monkey.de>
Date:   Wed Oct 3 00:15:14 2007 +0200

    Bumped version to 1.9.100.

diff --git a/configure.ac b/configure.ac
index ec72bc1..3c5feab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ AC_PREREQ(2.57)
 
 # 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)
 

commit fda9377e5e45b4fc3190bad03e081cadc96fe231
Author: Tilman Sauerbeck <tilman@code-monkey.de>
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.

diff --git a/src/mga_g_crtc.c b/src/mga_g_crtc.c
index 7f3d90f..d428b3d 100644
--- a/src/mga_g_crtc.c
+++ b/src/mga_g_crtc.c
@@ -725,9 +725,10 @@ state_restore(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
         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
@@ -853,7 +854,7 @@ crtc_restore(xf86CrtcPtr crtc)
     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;

commit 6695dc4222bb97c0f9dffce46a54456eeb5f4b5f
Author: Tilman Sauerbeck <tilman@code-monkey.de>
Date:   Tue Oct 2 22:06:35 2007 +0200

    Don't check texture dimensions in mgaCheckSourceTexture().
    
    The server is already doing that for us.

diff --git a/src/mga_exa.c b/src/mga_exa.c
index 1c12616..5ffb553 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -322,11 +322,6 @@ mgaCheckSourceTexture(int tmu, PicturePtr pPict)
     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;

commit 4266ced619de86b3a7706f3ee6c8a24ba111b6ba
Author: Tilman Sauerbeck <tilman@code-monkey.de>
Date:   Tue Oct 2 22:05:28 2007 +0200

    Removed MGAFBLayout structure.

diff --git a/src/mga.h b/src/mga.h
index 6b18a93..5d0486b 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -222,16 +222,6 @@ typedef struct {
     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 {
@@ -484,7 +474,6 @@ typedef struct {
     int			videoKey;
     int			fifoCount;
     int			Rotate;
-    MGAFBLayout		CurrentLayout;
     Bool		DrawTransparent;
     int			MaxBlitDWORDS;
     Bool		TexturedVideo;
diff --git a/src/mga_2064_crtc.c b/src/mga_2064_crtc.c
index 0277172..dd06e25 100644
--- a/src/mga_2064_crtc.c
+++ b/src/mga_2064_crtc.c
@@ -400,7 +400,7 @@ state_set_pclk(ScrnInfoPtr scrn, MgaCrtcStatePtr state, long f_out, int bpp)
 	 * 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 @@ state_set_pclk(ScrnInfoPtr scrn, MgaCrtcStatePtr state, long f_out, int bpp)
 	}
 
         /* 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 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state, DisplayModePtr mode)
     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 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state, DisplayModePtr mode)
         initDAC = MGADACbpp24;
         break;
     case 32:
-        if(layout->Overlay8Plus24)
+        if (pMga->Overlay8Plus24)
             initDAC = MGADACbpp8plus24;
         else
             initDAC = MGADACbpp32;
@@ -511,19 +510,19 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state, DisplayModePtr mode)
             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 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state, DisplayModePtr mode)
     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 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state, DisplayModePtr mode)
                        ((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 --git a/src/mga_dac3026.c b/src/mga_dac3026.c
index a108e22..7e402de 100644
--- a/src/mga_dac3026.c
+++ b/src/mga_dac3026.c
@@ -315,7 +315,7 @@ void MGA3026LoadPalette(
     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 --git a/src/mga_dacG.c b/src/mga_dacG.c
index 100bf43..2b7fb8c 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -76,7 +76,7 @@ void MGAGLoadPalette(
 ){
     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 --git a/src/mga_dri.c b/src/mga_dri.c
index c438e3b..b35790c 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -359,8 +359,6 @@ void MGAGetQuiescence( ScrnInfoPtr pScrn )
    pMga->haveQuiescense = 1;
 
    if ( pMga->directRenderingEnabled ) {
-      MGAFBLayout *pLayout = &pMga->CurrentLayout;
-
       MGAWaitForIdleDMA( pScrn );
 
         /* FIXME what about EXA? */
@@ -368,7 +366,7 @@ void MGAGetQuiescence( ScrnInfoPtr pScrn )
         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 --git a/src/mga_driver.c b/src/mga_driver.c
index 209f620..f87c7b9 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2286,15 +2286,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
        }
     }
 #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]);
     
@@ -2833,15 +2824,6 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 #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;
 
diff --git a/src/mga_exa.c b/src/mga_exa.c
index 97e5b08..1c12616 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -781,7 +781,7 @@ init_dri(ScrnInfoPtr pScrn)
     }
 
     maxlines = (min(pMga->FbUsableSize, mb * 1024 * 1024)) /
-               (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8);
+               (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
 
     dri->frontOffset = 0;
     dri->frontPitch = widthBytes;
diff --git a/src/mga_g_crtc.c b/src/mga_g_crtc.c
index d4dfe99..7f3d90f 100644
--- a/src/mga_g_crtc.c
+++ b/src/mga_g_crtc.c
@@ -325,11 +325,10 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
     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];
@@ -467,7 +466,7 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
        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;
@@ -475,8 +474,8 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
     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;
         }
 
@@ -487,7 +486,7 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
         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;
@@ -529,10 +528,10 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
     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;
@@ -557,7 +556,7 @@ state_set(xf86CrtcPtr crtc, MgaCrtcStatePtr state,
                        ((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;
diff --git a/src/mga_macros.h b/src/mga_macros.h
index 549c448..b33a250 100644
--- a/src/mga_macros.h
+++ b/src/mga_macros.h
@@ -41,7 +41,7 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \
    }
 
 #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 --git a/src/mga_storm.c b/src/mga_storm.c
index dfdebeb..6b9ecbd 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -601,7 +601,7 @@ Bool mgaAccelInit( ScreenPtr pScreen )
     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 @@ Bool mgaAccelInit( ScreenPtr pScreen )
 	pMga->AccelFlags |= LARGE_ADDRESSES;
     }
 
-    if (pMga->CurrentLayout.bitsPerPixel == 24) {
+    if (pScrn->bitsPerPixel == 24) {
 	pMga->AccelFlags |= MGA_NO_PLANEMASK;
     }
 
@@ -728,13 +728,13 @@ Bool mgaAccelInit( ScreenPtr pScreen )
 	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 @@ Bool mgaAccelInit( ScreenPtr pScreen )
     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 @@ Bool mgaAccelInit( ScreenPtr pScreen )
 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 @@ static void mgaRestoreAccelState(ScrnInfoPtr pScrn)
    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 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
 {
     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 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
 
     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 @@ void MGAStormEngineInit( ScrnInfoPtr pScrn )
 						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 @@ MGADisableClipping(ScrnInfoPtr pScrn)
 
 
 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 @@ common_setup_for_pattern_fill( MGAPtr pMga, int fg, int bg, int rop,
 	 */
 
 	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 @@ common_setup_for_pattern_fill( MGAPtr pMga, int fg, int bg, int rop,
 
     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 @@ void mgaDoSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, int xdir, int ydir,
     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 @@ void mgaSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, int xdir, int ydir,
 				    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 @@ void mgaSubsequentScreenToScreenCopy( ScrnInfoPtr pScrn,
 
     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 @@ void mgaSubsequentScreenToScreenCopy( ScrnInfoPtr pScrn,
 	    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 @@ void mgaSubsequentScreenToScreenCopy_FastBlit( ScrnInfoPtr pScrn,
 
     /* 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 @@ void mgaSubsequentScreenToScreenCopy_FastBlit( ScrnInfoPtr pScrn,
 	    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 @@ void mgaSubsequentScreenToScreenCopy_FastBlit( ScrnInfoPtr pScrn,
            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 mgaDoSetupForSolidFill( ScrnInfoPtr pScrn, int color, int rop,
 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 @@ void mgaSetupForMono8x8PatternFill( ScrnInfoPtr pScrn,
     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 @@ void mgaSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn,
 
     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 @@ void mgaSetupForScanlineImageWrite( ScrnInfoPtr pScrn, int rop,
     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 @@ void mgaSetupForScanlineImageWrite( ScrnInfoPtr pScrn, int rop,
     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 @@ void mgaSubsequentScanlineImageWriteRect( ScrnInfoPtr pScrn,
 
     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 @@ void mgaSetupForDashedLine( ScrnInfoPtr pScrn,
 
 
     common_replicate_colors_and_mask( fg, bg, planemask,
-				      pMga->CurrentLayout.bitsPerPixel,
+				      pScrn->bitsPerPixel,
 				      & replicate_fg, & replicate_bg,
 				      & replicate_pm );
 
@@ -1938,7 +1932,7 @@ void mgaSetupForDashedLine( ScrnInfoPtr pScrn,
     }
 
     SET_PLANEMASK_REPLICATED( planemask, replicate_pm,
-			      pMga->CurrentLayout.bitsPerPixel );
+			      pScrn->bitsPerPixel );
     SET_FOREGROUND_REPLICATED( fg, replicate_fg );
 
 
@@ -1958,7 +1952,7 @@ void mgaSetupForDashedLine( ScrnInfoPtr pScrn,
 	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 @@ void mgaSetupForDashedLine( ScrnInfoPtr pScrn,
 	     */
 
 	    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 @@ void mgaSetupForPlanarScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
 
     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 @@ void mgaSetupForScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
     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 @@ void mgaSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
 {
     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 @@ void mgaSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
     }
 
     w--;
-    start = (XYADDRESS(srcx, srcy) * pMga->CurrentLayout.bitsPerPixel)
+    start = (XYADDRESS(srcx, srcy) * pScrn->bitsPerPixel)
       + skipleft;
     end = start + w + (display_bit_width * (h - 1));
 
diff --git a/src/mga_video.c b/src/mga_video.c
index a2d7979..11d017c 100644
--- a/src/mga_video.c
+++ b/src/mga_video.c
@@ -597,7 +597,7 @@ MGAAllocateMemory(
 #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.

commit 38d25dc9128c384d12bfc1f711a4fb6b2937dea7
Author: Tilman Sauerbeck <tilman@code-monkey.de>
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.

diff --git a/src/Makefile.am b/src/Makefile.am
index 1d42c2e..192184c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,6 @@ mga_drv_la_SOURCES = \
          mga_dac3026.h \
          mga_dacG.c \
          mga_dacG.h \
-         mga_dga.c \
          mga_driver.c \
          mga_g450pll.c \
          mga.h \
diff --git a/src/mga.h b/src/mga.h
index d49fa66..6b18a93 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -463,10 +463,6 @@ typedef struct {
     int			StyleLen;
     XAAInfoRecPtr	AccelInfoRec;
     xf86CursorInfoPtr	CursorInfoRec;
-    DGAModePtr		DGAModes;
-    int			numDGAModes;
-    Bool		DGAactive;
-    int			DGAViewportStatus;
     CARD32		*Atype;
     CARD32		*AtypeNoBLK;
     void		(*PreInit)(ScrnInfoPtr pScrn);
@@ -611,8 +607,6 @@ Bool MGAHWCursorInit(ScreenPtr pScreen);
 
 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 --git a/src/mga_dga.c b/src/mga_dga.c
deleted file mode 100644
index 6bae9dc..0000000
--- a/src/mga_dga.c
+++ /dev/null
@@ -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) {



Reply to: