diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-10-02 22:05:28 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-10-02 22:05:28 +0200 |
commit | 4266ced619de86b3a7706f3ee6c8a24ba111b6ba (patch) | |
tree | c5355e4090d262073139a7e535d38988a6e73bb2 | |
parent | 38d25dc9128c384d12bfc1f711a4fb6b2937dea7 (diff) |
Removed MGAFBLayout structure.
-rw-r--r-- | src/mga.h | 11 | ||||
-rw-r--r-- | src/mga_2064_crtc.c | 27 | ||||
-rw-r--r-- | src/mga_dac3026.c | 2 | ||||
-rw-r--r-- | src/mga_dacG.c | 2 | ||||
-rw-r--r-- | src/mga_dri.c | 4 | ||||
-rw-r--r-- | src/mga_driver.c | 18 | ||||
-rw-r--r-- | src/mga_exa.c | 2 | ||||
-rw-r--r-- | src/mga_g_crtc.c | 19 | ||||
-rw-r--r-- | src/mga_macros.h | 2 | ||||
-rw-r--r-- | src/mga_storm.c | 92 | ||||
-rw-r--r-- | src/mga_video.c | 2 |
11 files changed, 71 insertions, 110 deletions
@@ -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. |