diff options
author | Adam Jackson <ajax@nwnk.net> | 2006-03-20 19:12:50 +0000 |
---|---|---|
committer | Adam Jackson <ajax@nwnk.net> | 2006-03-20 19:12:50 +0000 |
commit | 88ece3c37c4ed529686b6cdea1bf9b6eed8fceea (patch) | |
tree | b77f097e1d11610306339690a8eb40956a4f86dc /src/mga_storm.c | |
parent | 089c7be83d6cace94a692ec46a4c3a05b32fd4f4 (diff) |
Bug #5587: Refactor mga_storm.c to only build once for all color depths.
(Ian Romanick)
Diffstat (limited to 'src/mga_storm.c')
-rw-r--r-- | src/mga_storm.c | 1250 |
1 files changed, 649 insertions, 601 deletions
diff --git a/src/mga_storm.c b/src/mga_storm.c index e094669..366bddb 100644 --- a/src/mga_storm.c +++ b/src/mga_storm.c @@ -1,5 +1,7 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.99tsi Exp $ */ +#define PSZ 8 + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -32,99 +34,120 @@ #include "mga.h" #include "mga_reg.h" -#include "mga_map.h" #include "mga_macros.h" #ifdef XF86DRI #include "mga_dri.h" #endif +#define REPLICATE_8(r) (((r) & 0x0ff) | (((r) & 0x0ff) << 8) \ + | (((r) & 0x0ff) << 16) | (((r) & 0x0ff) << 24)) +#define REPLICATE_16(r) (((r) & 0x0000ffff) | (((r) & 0x0000ffff) << 16)) +#define REPLICATE_24(r) (((r) & 0x00ffffff) | (((r) & 0x00ffffff) << 24)) +#define REPLICATE_32(r) (r) + + +#define SET_FOREGROUND_REPLICATED(c, rep_c) \ + if((c) != pMga->FgColor) { \ + pMga->FgColor = (c); \ + OUTREG(MGAREG_FCOL,(rep_c)); \ + } + +#define SET_BACKGROUND_REPLICATED(c, rep_c) \ + if((c) != pMga->BgColor) { \ + pMga->BgColor = (c); \ + OUTREG(MGAREG_BCOL,(rep_c)); \ + } + + #define MGAMoveDWORDS(d,s,c) \ do { \ write_mem_barrier(); \ XAAMoveDWORDS((d),(s),(c)); \ } while (0) -static void MGANAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, - int srcX, int srcY, int dstX, int dstY, - int w, int h); -static void MGANAME(SubsequentScreenToScreenCopy_FastBlit)(ScrnInfoPtr pScrn, - int srcX, int srcY, int dstX, int dstY, - int w, int h); -static void MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( - ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -static void MGANAME(SubsequentColorExpandScanline)(ScrnInfoPtr pScrn, - int bufno); -static void MGANAME(SubsequentColorExpandScanlineIndirect)(ScrnInfoPtr pScrn, - int bufno); -static void MGANAME(SubsequentSolidFillRect)(ScrnInfoPtr pScrn, - int x, int y, int w, int h); -static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR); -static void MGANAME(SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn, - int x, int y, int len, int dir); -static void MGANAME(SubsequentSolidTwoPointLine)(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags); -static void MGANAME(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, - int patx, int paty, int fg, int bg, - int rop, unsigned int planemask); -static void MGANAME(SubsequentMono8x8PatternFillRect)(ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h ); -static void MGANAME(SubsequentMono8x8PatternFillRect_Additional)( - ScrnInfoPtr pScrn, int patx, int paty, - int x, int y, int w, int h ); -static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn, - int patx, int paty, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR); -static void MGANAME(SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int transparency_color, int bpp, int depth); -static void MGANAME(SubsequentScanlineImageWriteRect)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -static void MGANAME(SubsequentImageWriteScanline)(ScrnInfoPtr pScrn, int num); -#if PSZ != 24 -static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, int fg, int bg, int rop, - unsigned int planemask); -static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft); -#endif -static void MGANAME(SetupForScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask); -static void MGANAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft); +static void mgaSetupForSolidFill( ScrnInfoPtr pScrn, int color, + int rop, unsigned int planemask ); + +static void mgaSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, unsigned int planemask, int trans ); + +static void mgaSubsequentScreenToScreenCopy( ScrnInfoPtr pScrn, + int srcX, int srcY, int dstX, int dstY, int w, int h ); + +static void mgaSubsequentScreenToScreenCopy_FastBlit( ScrnInfoPtr pScrn, + int srcX, int srcY, int dstX, int dstY, int w, int h ); + +static void mgaSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask ); + +static void mgaSubsequentScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, + int x, int y, int w, int h, int skipleft ); + +static void mgaSubsequentColorExpandScanline( ScrnInfoPtr pScrn, int bufno ); + +static void mgaSubsequentColorExpandScanlineIndirect( ScrnInfoPtr pScrn, + int bufno ); + +static void mgaSubsequentSolidFillRect( ScrnInfoPtr pScrn, int x, int y, + int w, int h ); + +static void mgaSubsequentSolidFillTrap( ScrnInfoPtr pScrn, int y, int h, + int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR ); + +static void mgaSubsequentSolidHorVertLine( ScrnInfoPtr pScrn, int x, int y, + int len, int dir ); + +static void mgaSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, int x1, int y1, + int x2, int y2, int flags ); + +static void mgaSetupForMono8x8PatternFill( ScrnInfoPtr pScrn, + int patx, int paty, int fg, int bg, int rop, unsigned int planemask ); + +static void mgaSubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn, + int patx, int paty, int x, int y, int w, int h ); + +static void mgaSubsequentMono8x8PatternFillRect_Additional( ScrnInfoPtr pScrn, + int patx, int paty, int x, int y, int w, int h ); + +static void mgaSubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn, + int patx, int paty, int y, int h, int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ); + +static void mgaSetupForScanlineImageWrite( ScrnInfoPtr pScrn, int rop, + unsigned int planemask, int transparency_color, int bpp, int depth ); + +static void mgaSubsequentScanlineImageWriteRect( ScrnInfoPtr pScrn, + int x, int y, int w, int h, int skipleft ); + +static void mgaSubsequentImageWriteScanline( ScrnInfoPtr pScrn, int num ); + +static void mgaSetupForPlanarScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask ); + +static void mgaSubsequentPlanarScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int x, int y, int w, int h, int srcx, int srcy, int skipleft ); + +static void mgaSetupForScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int fg, int bg, int rop, unsigned int planemask ); + +static void mgaSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int x, int y, int w, int h, int srcx, int srcy, int skipleft ); + #if X_BYTE_ORDER == X_LITTLE_ENDIAN -static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, - int rop, unsigned int planemask, int length, - unsigned char *pattern); -static void MGANAME(SubsequentDashedTwoPointLine)(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase); -#endif -void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn); -#if PSZ == 8 -void Mga16RestoreAccelState(ScrnInfoPtr pScrn); -void Mga24RestoreAccelState(ScrnInfoPtr pScrn); -void Mga32RestoreAccelState(ScrnInfoPtr pScrn); +static void mgaSetupForDashedLine( ScrnInfoPtr pScrn, int fg, int bg, + int rop, unsigned int planemask, int length, unsigned char *pattern ); + +static void mgaSubsequentDashedTwoPointLine( ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, int flags, int phase ); #endif -#ifdef XF86DRI -void MGANAME(DRIInitBuffers)(WindowPtr pWin, - RegionPtr prgn, CARD32 index); -void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); +void mgaRestoreAccelState( ScrnInfoPtr pScrn ); +#ifdef XF86DRI +void mgaDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); +void mgaDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index); #endif extern void MGASetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, @@ -144,6 +167,40 @@ extern void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr); extern void MGAFillCacheBltRects(ScrnInfoPtr, int, unsigned int, int, BoxPtr, int, int, XAACacheInfoPtr); + +static __inline__ void +common_replicate_colors_and_mask( unsigned int fg, unsigned int bg, + unsigned int pm, + unsigned int bpp, + unsigned int * rep_fg, + unsigned int * rep_bg, + unsigned int * rep_pm ) +{ + switch( bpp ) { + case 8: + *rep_fg = REPLICATE_8( fg ); + *rep_bg = REPLICATE_8( bg ); + *rep_pm = REPLICATE_8( pm ); + break; + case 16: + *rep_fg = REPLICATE_16( fg ); + *rep_bg = REPLICATE_16( bg ); + *rep_pm = REPLICATE_16( pm ); + break; + case 24: + *rep_fg = REPLICATE_24( fg ); + *rep_bg = REPLICATE_24( bg ); + *rep_pm = REPLICATE_24( pm ); + break; + case 32: + *rep_fg = REPLICATE_32( fg ); + *rep_bg = REPLICATE_32( bg ); + *rep_pm = REPLICATE_32( pm ); + break; + } +} + + #ifdef RENDER extern Bool @@ -205,7 +262,6 @@ MGASubsequentCPUToScreenTexture ( extern CARD32 MGAAlphaTextureFormats[2]; extern CARD32 MGATextureFormats[2]; -#if PSZ == 8 #include "mipict.h" #include "dixstruct.h" @@ -285,22 +341,14 @@ GetPowerOfTwo(int w) static int tex_padw, tex_padh; -Bool -MGASetupForCPUToScreenAlphaTextureFaked ( - ScrnInfoPtr pScrn, - int op, - CARD16 red, - CARD16 green, - CARD16 blue, - CARD16 alpha, - int alphaType, - CARD8 *alphaPtr, - int alphaPitch, - int width, - int height, - int flags -){ - int log2w, log2h, i, pitch, sizeNeeded, offset; +Bool MGASetupForCPUToScreenAlphaTextureFaked( ScrnInfoPtr pScrn, int op, + CARD16 red, CARD16 green, + CARD16 blue, CARD16 alpha, + int alphaType, CARD8 *alphaPtr, + int alphaPitch, int width, + int height, int flags ) +{ + int log2w, log2h, pitch, sizeNeeded, offset; MGAPtr pMga = MGAPTR(pScrn); if(op != PictOpOver) /* only one tested */ @@ -315,9 +363,8 @@ MGASetupForCPUToScreenAlphaTextureFaked ( CHECK_DMA_QUIESCENT(pMga, pScrn); if(pMga->Overlay8Plus24) { - i = 0x00ffffff; WAITFIFO(1); - SET_PLANEMASK(i); + SET_PLANEMASK_REPLICATED( 0x00ffffff, 0xffffffff, 32 ); } pitch = (width + 15) & ~15; @@ -396,9 +443,8 @@ MGASetupForCPUToScreenAlphaTexture ( CHECK_DMA_QUIESCENT(pMga, pScrn); if(pMga->Overlay8Plus24) { - i = 0x00ffffff; WAITFIFO(1); - SET_PLANEMASK(i); + SET_PLANEMASK_REPLICATED( 0x00ffffff, 0xffffffff, 32 ); } pitch = (width + 15) & ~15; @@ -491,9 +537,8 @@ MGASetupForCPUToScreenTexture ( CHECK_DMA_QUIESCENT(pMga, pScrn); if(pMga->Overlay8Plus24) { - i = 0x00ffffff; WAITFIFO(1); - SET_PLANEMASK(i); + SET_PLANEMASK_REPLICATED( 0x00ffffff, 0xffffffff, 32 ); } pitch = (width + 15) & ~15; @@ -567,11 +612,9 @@ MGASubsequentCPUToScreenTexture ( } -#endif -#endif +#endif /* defined(RENDER) */ -Bool -MGANAME(AccelInit)(ScreenPtr pScreen) +Bool mgaAccelInit( ScreenPtr pScreen ) { XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -580,7 +623,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) Bool doRender = FALSE; BoxRec AvailFBArea; - pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * PSZ) + 127) >> 3); + pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel) + 127) >> 3); if(!pMga->ScratchBuffer) return FALSE; pMga->AccelInfoRec = infoPtr = XAACreateInfoRec(); @@ -633,9 +676,9 @@ MGANAME(AccelInit)(ScreenPtr pScreen) /* all should be able to use this now with the bug fixes */ pMga->AccelFlags |= USE_LINEAR_EXPANSION; -#if PSZ == 24 - pMga->AccelFlags |= MGA_NO_PLANEMASK; -#endif + if ( pMga->CurrentLayout.bitsPerPixel == 24 ) { + pMga->AccelFlags |= MGA_NO_PLANEMASK; + } if(pMga->HasSDRAM) { pMga->Atype = pMga->AtypeNoBLK = MGAAtypeNoBLK; @@ -657,25 +700,22 @@ MGANAME(AccelInit)(ScreenPtr pScreen) /* screen to screen copy */ infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; infoPtr->SetupForScreenToScreenCopy = - MGANAME(SetupForScreenToScreenCopy); - infoPtr->SubsequentScreenToScreenCopy = - MGANAME(SubsequentScreenToScreenCopy); + mgaSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = mgaSubsequentScreenToScreenCopy; if(pMga->HasFBitBlt) { infoPtr->FillCacheBltRects = MGAFillCacheBltRects; infoPtr->FillCacheBltRectsFlags = NO_TRANSPARENCY; } /* solid fills */ - infoPtr->SetupForSolidFill = MGANAME(SetupForSolidFill); - infoPtr->SubsequentSolidFillRect = MGANAME(SubsequentSolidFillRect); - infoPtr->SubsequentSolidFillTrap = MGANAME(SubsequentSolidFillTrap); + infoPtr->SetupForSolidFill = mgaSetupForSolidFill; + infoPtr->SubsequentSolidFillRect = mgaSubsequentSolidFillRect; + infoPtr->SubsequentSolidFillTrap = mgaSubsequentSolidFillTrap; /* solid lines */ infoPtr->SetupForSolidLine = infoPtr->SetupForSolidFill; - infoPtr->SubsequentSolidHorVertLine = - MGANAME(SubsequentSolidHorVertLine); - infoPtr->SubsequentSolidTwoPointLine = - MGANAME(SubsequentSolidTwoPointLine); + infoPtr->SubsequentSolidHorVertLine = mgaSubsequentSolidHorVertLine; + infoPtr->SubsequentSolidTwoPointLine = mgaSubsequentSolidTwoPointLine; /* clipping */ infoPtr->SetClippingRectangle = MGASetClippingRectangle; @@ -688,9 +728,8 @@ MGANAME(AccelInit)(ScreenPtr pScreen) #if X_BYTE_ORDER == X_LITTLE_ENDIAN /* dashed lines */ infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - infoPtr->SetupForDashedLine = MGANAME(SetupForDashedLine); - infoPtr->SubsequentDashedTwoPointLine = - MGANAME(SubsequentDashedTwoPointLine); + infoPtr->SetupForDashedLine = mgaSetupForDashedLine; + infoPtr->SubsequentDashedTwoPointLine = mgaSubsequentDashedTwoPointLine; infoPtr->DashPatternMaxLength = 128; #endif @@ -699,11 +738,11 @@ MGANAME(AccelInit)(ScreenPtr pScreen) HARDWARE_PATTERN_PROGRAMMED_ORIGIN | HARDWARE_PATTERN_SCREEN_ORIGIN | BIT_ORDER_IN_BYTE_MSBFIRST; - infoPtr->SetupForMono8x8PatternFill = MGANAME(SetupForMono8x8PatternFill); + infoPtr->SetupForMono8x8PatternFill = mgaSetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = - MGANAME(SubsequentMono8x8PatternFillRect); + mgaSubsequentMono8x8PatternFillRect; infoPtr->SubsequentMono8x8PatternFillTrap = - MGANAME(SubsequentMono8x8PatternFillTrap); + mgaSubsequentMono8x8PatternFillTrap; /* cpu to screen color expansion */ infoPtr->ScanlineCPUToScreenColorExpandFillFlags = @@ -723,11 +762,10 @@ MGANAME(AccelInit)(ScreenPtr pScreen) pMga->ColorExpandBase = pMga->IOBase; } infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - MGANAME(SetupForScanlineCPUToScreenColorExpandFill); + mgaSetupForScanlineCPUToScreenColorExpandFill; infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - MGANAME(SubsequentScanlineCPUToScreenColorExpandFill); - infoPtr->SubsequentColorExpandScanline = - MGANAME(SubsequentColorExpandScanline); + mgaSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = mgaSubsequentColorExpandScanline; infoPtr->NumScanlineColorExpandBuffers = 1; infoPtr->ScanlineColorExpandBuffers = &(pMga->ColorExpandBase); @@ -736,22 +774,23 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_LSBFIRST; infoPtr->SetupForScreenToScreenColorExpandFill = - MGANAME(SetupForScreenToScreenColorExpandFill); + mgaSetupForScreenToScreenColorExpandFill; infoPtr->SubsequentScreenToScreenColorExpandFill = - MGANAME(SubsequentScreenToScreenColorExpandFill); - } else { -#if PSZ != 24 - /* Alternate (but slower) planar expansions */ + mgaSubsequentScreenToScreenColorExpandFill; + } + else if ( pMga->CurrentLayout.bitsPerPixel != 24 ) { + /* Alternate (but slower) planar expansions */ infoPtr->SetupForScreenToScreenColorExpandFill = - MGANAME(SetupForPlanarScreenToScreenColorExpandFill); + mgaSetupForPlanarScreenToScreenColorExpandFill; infoPtr->SubsequentScreenToScreenColorExpandFill = - MGANAME(SubsequentPlanarScreenToScreenColorExpandFill); - infoPtr->CacheColorExpandDensity = PSZ; + mgaSubsequentPlanarScreenToScreenColorExpandFill; + infoPtr->CacheColorExpandDensity = pMga->CurrentLayout.bitsPerPixel; infoPtr->CacheMonoStipple = XAAGetCachePlanarMonoStipple(); - /* It's faster to blit the stipples if you have fastbilt */ + + /* It's faster to blit the stipples if you have fastbilt + */ if(pMga->HasFBitBlt) infoPtr->ScreenToScreenColorExpandFillFlags = TRANSPARENCY_ONLY; -#endif } /* image writes */ @@ -762,12 +801,10 @@ MGANAME(AccelInit)(ScreenPtr pScreen) NO_TRANSPARENCY | NO_GXCOPY; - infoPtr->SetupForScanlineImageWrite = - MGANAME(SetupForScanlineImageWrite); + infoPtr->SetupForScanlineImageWrite = mgaSetupForScanlineImageWrite; infoPtr->SubsequentScanlineImageWriteRect = - MGANAME(SubsequentScanlineImageWriteRect); - infoPtr->SubsequentImageWriteScanline = - MGANAME(SubsequentImageWriteScanline); + mgaSubsequentScanlineImageWriteRect; + infoPtr->SubsequentImageWriteScanline = mgaSubsequentImageWriteScanline; infoPtr->NumScanlineImageWriteBuffers = 1; infoPtr->ScanlineImageWriteBuffers = &(pMga->ScratchBuffer); @@ -813,11 +850,11 @@ MGANAME(AccelInit)(ScreenPtr pScreen) maxFastBlitMem = (pMga->Interleave ? 4096 : 2048) * 1024; if(pMga->FbMapSize > maxFastBlitMem) { - pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * PSZ / 8); + pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8); } maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) / - (pScrn->displayWidth * PSZ / 8); + (pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel / 8); #ifdef XF86DRI if ( pMga->directRenderingEnabled ) { @@ -921,7 +958,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) pMGADRIServer->textureOffset ); } else -#endif +#endif /* defined(XF86DRI) */ { AvailFBArea.x1 = 0; AvailFBArea.x2 = pScrn->displayWidth; @@ -951,7 +988,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) shared_accel = TRUE; } if(shared_accel == TRUE) - infoPtr->RestoreAccelState = MGANAME(RestoreAccelState); + infoPtr->RestoreAccelState = mgaRestoreAccelState; } #ifdef RENDER @@ -976,25 +1013,20 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE; infoPtr->CPUToScreenTextureFormats = MGATextureFormats; } -#endif +#endif /* defined(RENDER) */ return(XAAInit(pScreen, infoPtr)); } -void -MGANAME(InitSolidFillRectFuncs)(MGAPtr pMga) -{ - pMga->SetupForSolidFill = MGANAME(SetupForSolidFill); - pMga->SubsequentSolidFillRect = MGANAME(SubsequentSolidFillRect); -} /* Support for multiscreen */ -void -MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn) +void mgaRestoreAccelState(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); MGAFBLayout *pLayout = &pMga->CurrentLayout; - CARD32 tmp; + unsigned int replicate_fg = 0; + unsigned int replicate_bg = 0; + unsigned int replicate_pm = 0; MGAStormSync(pScrn); WAITFIFO(12); @@ -1002,15 +1034,21 @@ MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn) OUTREG(MGAREG_MACCESS, pMga->MAccess); OUTREG(MGAREG_PITCH, pLayout->displayWidth); OUTREG(MGAREG_YDSTORG, pMga->YDstOrg); - tmp = pMga->PlaneMask; - pMga->PlaneMask = ~tmp; - SET_PLANEMASK(tmp); - tmp = pMga->BgColor; - pMga->BgColor = ~tmp; - SET_BACKGROUND(tmp); - tmp = pMga->FgColor; - pMga->FgColor = ~tmp; - SET_FOREGROUND(tmp); + + + common_replicate_colors_and_mask( pMga->FgColor, pMga->BgColor, + pMga->PlaneMask, pLayout->bitsPerPixel, + & replicate_fg, & replicate_bg, + & replicate_pm ); + + if( (pLayout->bitsPerPixel != 24) + && ((pMga->AccelFlags & MGA_NO_PLANEMASK) == 0) ) { + OUTREG( MGAREG_PLNWT, replicate_pm ); + } + + OUTREG( MGAREG_BCOL, replicate_bg ); + OUTREG( MGAREG_FCOL, replicate_fg ); + OUTREG(MGAREG_SRCORG, pMga->realSrcOrg); OUTREG(MGAREG_DSTORG, pMga->DstOrg); #if X_BYTE_ORDER == X_LITTLE_ENDIAN @@ -1024,7 +1062,6 @@ MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn) pMga->AccelFlags &= ~CLIPPER_ON; } -#if PSZ == 8 CARD32 MGAAtype[16] = { MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, @@ -1053,20 +1090,7 @@ CARD32 MGAAtypeNoBLK[16] = { Bool MGAStormAccelInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - switch( pScrn->bitsPerPixel ) - { - case 8: - return Mga8AccelInit(pScreen); - case 16: - return Mga16AccelInit(pScreen); - case 24: - return Mga24AccelInit(pScreen); - case 32: - return Mga32AccelInit(pScreen); - } - return FALSE; + return mgaAccelInit( pScreen ); } @@ -1089,13 +1113,21 @@ MGAStormSync(ScrnInfoPtr pScrn) } } -void -MGAStormEngineInit(ScrnInfoPtr pScrn) + +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 */ + 0, 0, 1, 3, 2 + }; + static const unsigned int opmode_table[5] = { + /* bpp: 8 16 24 32 */ + 0x00000, 0x00000, 0x10000, 0x20000, 0x20000 + }; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -1105,36 +1137,21 @@ MGAStormEngineInit(ScrnInfoPtr pScrn) opmode = INREG(MGAREG_OPMODE); - switch( pLayout->bitsPerPixel ) - { - case 8: - pMga->RestoreAccelState = Mga8RestoreAccelState; - break; - case 16: - maccess |= 1; - if(pLayout->depth == 15) - maccess |= (1 << 31); - Mga16InitSolidFillRectFuncs(pMga); - pMga->RestoreAccelState = Mga16RestoreAccelState; - opmode |= 0x10000; - break; - case 24: - maccess |= 3; - Mga24InitSolidFillRectFuncs(pMga); - pMga->RestoreAccelState = Mga24RestoreAccelState; - opmode |= 0x20000; - break; - case 32: - maccess |= 2; - Mga32InitSolidFillRectFuncs(pMga); - pMga->RestoreAccelState = Mga32RestoreAccelState; - opmode |= 0x20000; - break; + maccess |= maccess_table[ pLayout->bitsPerPixel / 8 ]; + if ( pLayout->depth == 15 ) { + maccess |= (1 << 31); } + + opmode |= opmode_table[ pLayout->bitsPerPixel / 8 ]; #if X_BYTE_ORDER == X_LITTLE_ENDIAN opmode &= ~0x30000; #endif + pMga->SetupForSolidFill = mgaSetupForSolidFill; + pMga->SubsequentSolidFillRect = mgaSubsequentSolidFillRect; + pMga->RestoreAccelState = mgaRestoreAccelState; + + pMga->fifoCount = 0; while(MGAISBUSY()); @@ -1180,10 +1197,11 @@ MGAStormEngineInit(ScrnInfoPtr pScrn) default: break; } - xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); + xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); } + void MGASetClippingRectangle( ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2 @@ -1212,7 +1230,70 @@ void MGADisableClipping(ScrnInfoPtr pScrn) pMga->AccelFlags &= ~CLIPPER_ON; } -#endif + +static CARD32 +common_setup_for_pattern_fill( MGAPtr pMga, int fg, int bg, int rop, + int planemask, + CARD32 * reg_data, unsigned int count, + CARD32 cmd ) +{ + 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, + & replicate_fg, & replicate_bg, + & replicate_pm ); + + + if( bg == -1 ) { + if ( (pMga->CurrentLayout.bitsPerPixel == 24) && !RGBEQUAL(fg) ) { + cmd |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop]; + } + else { + cmd |= MGADWG_TRANSC | pMga->Atype[rop]; + } + + WAITFIFO( count + 3 ); + } + else { + /* (Packed) 24-bit is a funky mode. We only use the Atype table in + * 24-bit if the components of the foreground color and the components + * of the background color are the same (e.g., fg = 0xf8f8f8 and bg = + * 0x131313). + */ + + if( ((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) != 0) + && ((pMga->CurrentLayout.bitsPerPixel != 24) + || (RGBEQUAL(fg) && RGBEQUAL(bg))) ) { + cmd |= pMga->Atype[rop]; + } + else { + cmd |= pMga->AtypeNoBLK[rop]; + } + + WAITFIFO( count + 4 ); + SET_BACKGROUND_REPLICATED( bg, replicate_bg ); + } + + SET_FOREGROUND_REPLICATED( fg, replicate_fg ); + SET_PLANEMASK_REPLICATED( planemask, replicate_pm, + pMga->CurrentLayout.bitsPerPixel ); + + /* FIXME: Is this the right order? */ + + for ( i = 0 ; i < count ; i++ ) { + OUTREG( reg_data[0], reg_data[1] ); + reg_data += 2; + } + + OUTREG(MGAREG_DWGCTL, cmd); + + return cmd; +} /*********************************************\ @@ -1222,22 +1303,22 @@ void MGADisableClipping(ScrnInfoPtr pScrn) #define BLIT_LEFT 1 #define BLIT_UP 4 -void -MGANAME(SetupForScreenToScreenCopy)( - ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int trans -){ +void mgaDoSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, int xdir, int ydir, + int rop, unsigned int planemask, + int trans, unsigned bpp ) +{ MGAPtr pMga = MGAPTR(pScrn); CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL; + unsigned int tmp; + unsigned int replicated_trans = 0; + unsigned int replicated_mask = 0; + CHECK_DMA_QUIESCENT(pMga, pScrn); pMga->AccelInfoRec->SubsequentScreenToScreenCopy = - MGANAME(SubsequentScreenToScreenCopy); + mgaSubsequentScreenToScreenCopy; pMga->BltScanDirection = 0; if(ydir == -1) pMga->BltScanDirection |= BLIT_UP; @@ -1245,35 +1326,54 @@ MGANAME(SetupForScreenToScreenCopy)( pMga->BltScanDirection |= BLIT_LEFT; else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent) pMga->AccelInfoRec->SubsequentScreenToScreenCopy = - MGANAME(SubsequentScreenToScreenCopy_FastBlit); + mgaSubsequentScreenToScreenCopy_FastBlit; + + + common_replicate_colors_and_mask( trans, 0, planemask, bpp, + & replicated_trans, & tmp, + & replicated_mask ); if(pMga->DrawTransparent) { dwgctl |= MGADWG_TRANSC; WAITFIFO(2); - SET_FOREGROUND(trans); - trans = ~0; - SET_BACKGROUND(trans); + + SET_FOREGROUND_REPLICATED( trans, replicated_trans ); + SET_BACKGROUND_REPLICATED( ~0, ~0 ); } WAITFIFO(4); OUTREG(MGAREG_DWGCTL, dwgctl); OUTREG(MGAREG_SGN, pMga->BltScanDirection); - SET_PLANEMASK(planemask); + + SET_PLANEMASK_REPLICATED( planemask, replicated_mask, bpp ); OUTREG(MGAREG_AR5, ydir * pMga->CurrentLayout.displayWidth); } -static void -MGANAME(SubsequentScreenToScreenCopy)( - ScrnInfoPtr pScrn, - int srcX, int srcY, int dstX, int dstY, int w, int h -){ +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 ); +} + + +void mgaSubsequentScreenToScreenCopy( ScrnInfoPtr pScrn, + int srcX, int srcY, int dstX, int dstY, + int w, int h ) +{ int start, end, SrcOrg = 0, DstOrg = 0; MGAPtr pMga = MGAPTR(pScrn); if (pMga->AccelFlags & LARGE_ADDRESSES) { - SrcOrg = ((srcY & ~1023) * pMga->CurrentLayout.displayWidth * PSZ) >> 9; - DstOrg = ((dstY & ~1023) * pMga->CurrentLayout.displayWidth * PSZ) >> 9; + const unsigned int display_bit_width = + (pMga->CurrentLayout.displayWidth * pMga->CurrentLayout.bitsPerPixel); + + SrcOrg = ((srcY & ~1023) * display_bit_width) >> 9; + DstOrg = ((dstY & ~1023) * display_bit_width) >> 9; dstY &= 1023; } @@ -1297,7 +1397,7 @@ MGANAME(SubsequentScreenToScreenCopy)( OUTREG(MGAREG_SRCORG, (SrcOrg << 6) + pMga->realSrcOrg); } if(SrcOrg) { - SrcOrg = (SrcOrg << 9) / PSZ; + SrcOrg = (SrcOrg << 9) / pMga->CurrentLayout.bitsPerPixel; end -= SrcOrg; start -= SrcOrg; } @@ -1317,14 +1417,16 @@ MGANAME(SubsequentScreenToScreenCopy)( } -static void -MGANAME(SubsequentScreenToScreenCopy_FastBlit)( - ScrnInfoPtr pScrn, - int srcX, int srcY, int dstX, int dstY, int w, int h -) +void mgaSubsequentScreenToScreenCopy_FastBlit( ScrnInfoPtr pScrn, + int srcX, int srcY, + int dstX, int dstY, + int w, int h ) { int start, end; MGAPtr pMga = MGAPTR(pScrn); + static const unsigned int masks[5] = { + 0, 0x07f, 0x03f, 0x7f, 0x1f + }; if(pMga->BltScanDirection & BLIT_UP) { srcY += h - 1; @@ -1337,15 +1439,7 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)( /* we assume the driver asserts screen pitches such that we can always use fastblit for scrolling */ - if( -#if PSZ == 32 - !((srcX ^ dstX) & 31) -#elif PSZ == 16 - !((srcX ^ dstX) & 63) -#else - !((srcX ^ dstX) & 127) -#endif - ) { + if(((srcX ^ dstX) & masks[ pMga->CurrentLayout.bitsPerPixel / 8 ]) == 0) { if(pMga->MaxFastBlitY) { if(pMga->BltScanDirection & BLIT_UP) { if((srcY >= pMga->MaxFastBlitY) || @@ -1360,33 +1454,38 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)( /* Millennium 1 fastblit bug fix */ if(pMga->AccelFlags & FASTBLT_BUG) { - int fxright = dstX + w; -#if PSZ == 8 - if((dstX & (1 << 6)) && (((fxright >> 6) - (dstX >> 6)) & 7) == 7) { - fxright |= 1 << 6; -#elif PSZ == 16 - if((dstX & (1 << 5)) && (((fxright >> 5) - (dstX >> 5)) & 7) == 7) { - fxright |= 1 << 5; -#elif PSZ == 24 - if(((dstX * 3) & (1 << 6)) && - ((((fxright * 3 + 2) >> 6) - ((dstX * 3) >> 6)) & 7) == 7) { - fxright = ((fxright * 3 + 2) | (1 << 6)) / 3; -#elif PSZ == 32 - if((dstX & (1 << 4)) && (((fxright >> 4) - (dstX >> 4)) & 7) == 7) { - fxright |= 1 << 4; -#endif - WAITFIFO(8); - OUTREG(MGAREG_CXRIGHT, dstX + w); - OUTREG(MGAREG_DWGCTL, 0x040A400C); - OUTREG(MGAREG_AR0, end); - OUTREG(MGAREG_AR3, start); - OUTREG(MGAREG_FXBNDRY, (fxright << 16) | (dstX & 0xffff)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); - OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | - MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL); - OUTREG(MGAREG_CXRIGHT, 0xFFFF); - return; - } /* } } } (preserve pairs for pair matching) */ + int fxright = dstX + w; + int tmp_dstX = dstX; + int tmp_fxright = fxright; + static const unsigned shift_tab[5] = { + 0, 6, 5, 6, 4 + }; + const unsigned shift = shift_tab[pMga->CurrentLayout.bitsPerPixel / 8]; + + if (pMga->CurrentLayout.bitsPerPixel == 24) { + tmp_dstX *= 3; + tmp_fxright = fxright * 3 + 2; + } + + if( (tmp_dstX & (1 << shift)) + && (((tmp_fxright >> shift) - (tmp_dstX >> shift)) & 7) == 7) { + fxright = (tmp_fxright | (1 << shift)); + if (pMga->CurrentLayout.bitsPerPixel == 24) { + fxright /= 3; + } + + WAITFIFO(8); + OUTREG(MGAREG_CXRIGHT, dstX + w); + OUTREG(MGAREG_DWGCTL, 0x040A400C); + OUTREG(MGAREG_AR0, end); + OUTREG(MGAREG_AR3, start); + OUTREG(MGAREG_FXBNDRY, (fxright << 16) | (dstX & 0xffff)); + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); + OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | + MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL); + OUTREG(MGAREG_CXRIGHT, 0xFFFF); + return; + } } WAITFIFO(6); @@ -1409,49 +1508,68 @@ FASTBLIT_BAILOUT: OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); } - /******************\ | Solid Fills | \******************/ -void -MGANAME(SetupForSolidFill)( - ScrnInfoPtr pScrn, - int color, - int rop, - unsigned int planemask ) +void mgaDoSetupForSolidFill( ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask, unsigned int bpp ) { MGAPtr pMga = MGAPTR(pScrn); + unsigned int tmp; + unsigned int replicated_color = 0; + unsigned int replicated_planemask = 0; + + common_replicate_colors_and_mask( color, 0, planemask, bpp, + & replicated_color, & tmp, + & replicated_planemask ); CHECK_DMA_QUIESCENT(pMga, pScrn); -#if PSZ == 24 - if(!RGBEQUAL(color)) - pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_SHIFTZERO | - MGADWG_BMONOLEF | pMga->AtypeNoBLK[rop]; - else -#endif - pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_SHIFTZERO | - MGADWG_BMONOLEF | pMga->Atype[rop]; + if ( (bpp == 24) && !RGBEQUAL(color) ) { + pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_SHIFTZERO | + MGADWG_BMONOLEF | pMga->AtypeNoBLK[rop]; + } + else { + pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_SHIFTZERO | + MGADWG_BMONOLEF | pMga->Atype[rop]; + } - pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL | - pMga->AtypeNoBLK[rop]; + pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL | + pMga->AtypeNoBLK[rop]; if(pMga->AccelFlags & TRANSC_SOLID_FILL) pMga->FilledRectCMD |= MGADWG_TRANSC; WAITFIFO(3); - SET_FOREGROUND(color); - SET_PLANEMASK(planemask); + if ( color != pMga->FgColor ) { + pMga->FgColor = color; + OUTREG( MGAREG_FCOL, replicated_color ); + } + + if ( (bpp != 24) + && !(pMga->AccelFlags & MGA_NO_PLANEMASK) + && (planemask != pMga->PlaneMask) ) { + pMga->PlaneMask = planemask; + OUTREG( MGAREG_PLNWT, replicated_planemask ); + } + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); } -static void -MGANAME(SubsequentSolidFillRect)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h ) +void mgaSetupForSolidFill( ScrnInfoPtr pScrn, int color, int rop, + unsigned int planemask ) +{ + MGAPtr pMga = MGAPTR(pScrn); + + mgaDoSetupForSolidFill( pScrn, color, rop, planemask, + pMga->CurrentLayout.bitsPerPixel ); +} + +void mgaSubsequentSolidFillRect( ScrnInfoPtr pScrn, + int x, int y, int w, int h ) { MGAPtr pMga = MGAPTR(pScrn); @@ -1460,10 +1578,9 @@ MGANAME(SubsequentSolidFillRect)( OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); } -static void -MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR ) +void mgaSubsequentSolidFillTrap( ScrnInfoPtr pScrn, int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ) { MGAPtr pMga = MGAPTR(pScrn); int sdxl = (dxL < 0); @@ -1485,18 +1602,15 @@ MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); } + /***************\ | Solid Lines | \***************/ - -static void -MGANAME(SubsequentSolidHorVertLine) ( - ScrnInfoPtr pScrn, - int x, int y, - int len, int dir -){ +void mgaSubsequentSolidHorVertLine( ScrnInfoPtr pScrn, int x, int y, + int len, int dir ) +{ MGAPtr pMga = MGAPTR(pScrn); if(dir == DEGREES_0) { @@ -1517,11 +1631,9 @@ MGANAME(SubsequentSolidHorVertLine) ( } -static void -MGANAME(SubsequentSolidTwoPointLine)( - ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags -){ +void mgaSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, int x1, int y1, + int x2, int y2, int flags ) +{ MGAPtr pMga = MGAPTR(pScrn); WAITFIFO(4); @@ -1533,68 +1645,42 @@ MGANAME(SubsequentSolidTwoPointLine)( } - /***************************\ | 8x8 Mono Pattern Fills | \***************************/ -static void -MGANAME(SetupForMono8x8PatternFill)( - ScrnInfoPtr pScrn, - int patx, int paty, - int fg, int bg, - int rop, - unsigned int planemask ) +void mgaSetupForMono8x8PatternFill( ScrnInfoPtr pScrn, + int patx, int paty, int fg, int bg, + int rop, unsigned int planemask ) { MGAPtr pMga = MGAPTR(pScrn); XAAInfoRecPtr infoRec = pMga->AccelInfoRec; + CARD32 regs[4]; CHECK_DMA_QUIESCENT(pMga, pScrn); - pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | - MGADWG_BMONOLEF; - infoRec->SubsequentMono8x8PatternFillRect = - MGANAME(SubsequentMono8x8PatternFillRect); - - if(bg == -1) { -#if PSZ == 24 - if(!RGBEQUAL(fg)) - pMga->PatternRectCMD |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop]; - else -#endif - pMga->PatternRectCMD |= MGADWG_TRANSC | pMga->Atype[rop]; - - WAITFIFO(5); - } else { -#if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg)) -#else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) -#endif - pMga->PatternRectCMD |= pMga->Atype[rop]; - else - pMga->PatternRectCMD |= pMga->AtypeNoBLK[rop]; - WAITFIFO(6); - SET_BACKGROUND(bg); - } - - SET_FOREGROUND(fg); - SET_PLANEMASK(planemask); - OUTREG(MGAREG_DWGCTL, pMga->PatternRectCMD); - OUTREG(MGAREG_PAT0, patx); - OUTREG(MGAREG_PAT1, paty); + mgaSubsequentMono8x8PatternFillRect; + + regs[0] = MGAREG_PAT0; + regs[1] = patx; + regs[2] = MGAREG_PAT1; + regs[3] = paty; + + pMga->PatternRectCMD = common_setup_for_pattern_fill( pMga, fg, bg, rop, + planemask, regs, 2, + (MGADWG_TRAP + | MGADWG_ARZERO + | MGADWG_SGNZERO + | MGADWG_BMONOLEF) ); } - -static void -MGANAME(SubsequentMono8x8PatternFillRect)( - ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h ) -{ +void mgaSubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn, + int patx, int paty, + int x, int y, int w, int h ) +{ MGAPtr pMga = MGAPTR(pScrn); WAITFIFO(3); @@ -1602,14 +1688,13 @@ MGANAME(SubsequentMono8x8PatternFillRect)( OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect = - MGANAME(SubsequentMono8x8PatternFillRect_Additional); + mgaSubsequentMono8x8PatternFillRect_Additional; } -static void -MGANAME(SubsequentMono8x8PatternFillRect_Additional)( - ScrnInfoPtr pScrn, - int patx, int paty, - int x, int y, int w, int h ) +static void mgaSubsequentMono8x8PatternFillRect_Additional( ScrnInfoPtr pScrn, + int patx, int paty, + int x, int y, + int w, int h ) { MGAPtr pMga = MGAPTR(pScrn); @@ -1619,14 +1704,12 @@ MGANAME(SubsequentMono8x8PatternFillRect_Additional)( } -static void -MGANAME(SubsequentMono8x8PatternFillTrap)( - ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, int eL, - int right, int dxR, int dyR, int eR -){ +void mgaSubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, + int right, int dxR, int dyR, int eR ) +{ MGAPtr pMga = MGAPTR(pScrn); int sdxl = (dxL < 0) ? (1<<1) : 0; @@ -1655,53 +1738,28 @@ MGANAME(SubsequentMono8x8PatternFillTrap)( \***********************/ -static void -MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask ) +void mgaSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask ) { MGAPtr pMga = MGAPTR(pScrn); - CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO | - MGADWG_SHIFTZERO | MGADWG_BMONOLEF; - CHECK_DMA_QUIESCENT(pMga, pScrn); - if(bg == -1) { -#if PSZ == 24 - if(!RGBEQUAL(fg)) - mgaCMD |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop]; - else -#endif - mgaCMD |= MGADWG_TRANSC | pMga->Atype[rop]; - - WAITFIFO(3); - } else { -#if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) -#else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) -#endif - mgaCMD |= pMga->Atype[rop]; - else - mgaCMD |= pMga->AtypeNoBLK[rop]; - WAITFIFO(4); - SET_BACKGROUND(bg); - } + CHECK_DMA_QUIESCENT(pMga, pScrn); - SET_FOREGROUND(fg); - SET_PLANEMASK(planemask); - OUTREG(MGAREG_DWGCTL, mgaCMD); + (void) common_setup_for_pattern_fill( pMga, fg, bg, rop, + planemask, NULL, 0, + MGADWG_ILOAD | MGADWG_LINEAR + | MGADWG_SGNZERO | MGADWG_SHIFTZERO + | MGADWG_BMONOLEF ); } -static void -MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( - ScrnInfoPtr pScrn, + +void mgaSubsequentScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int x, int y, int w, int h, - int skipleft -){ + int skipleft ) +{ MGAPtr pMga = MGAPTR(pScrn); pMga->AccelFlags |= CLIPPER_ON; @@ -1733,23 +1791,22 @@ MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( #endif { pMga->AccelInfoRec->SubsequentColorExpandScanline = - MGANAME(SubsequentColorExpandScanlineIndirect); + mgaSubsequentColorExpandScanlineIndirect; pMga->AccelInfoRec->ScanlineColorExpandBuffers = (unsigned char**)(&pMga->ScratchBuffer); } else { pMga->AccelInfoRec->SubsequentColorExpandScanline = - MGANAME(SubsequentColorExpandScanline); + mgaSubsequentColorExpandScanline; pMga->AccelInfoRec->ScanlineColorExpandBuffers = (unsigned char**)(&pMga->ColorExpandBase); WAITFIFO(pMga->expandDWORDs); } } -static void -MGANAME(SubsequentColorExpandScanlineIndirect)( - ScrnInfoPtr pScrn, - int bufno -){ + +void mgaSubsequentColorExpandScanlineIndirect( ScrnInfoPtr pScrn, + int bufno ) +{ MGAPtr pMga = MGAPTR(pScrn); int dwords = pMga->expandDWORDs; CARD32 *src = (CARD32*)(pMga->ScratchBuffer); @@ -1780,11 +1837,10 @@ MGANAME(SubsequentColorExpandScanlineIndirect)( } } -static void -MGANAME(SubsequentColorExpandScanline)( - ScrnInfoPtr pScrn, - int bufno -){ + +void mgaSubsequentColorExpandScanline( ScrnInfoPtr pScrn, + int bufno ) +{ MGAPtr pMga = MGAPTR(pScrn); if(--pMga->expandRows) { @@ -1810,35 +1866,49 @@ MGANAME(SubsequentColorExpandScanline)( \*******************/ -static void MGANAME(SetupForScanlineImageWrite)( - ScrnInfoPtr pScrn, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth -){ +void mgaSetupForScanlineImageWrite( ScrnInfoPtr pScrn, int rop, + unsigned int planemask, + int transparency_color, + int bpp, int depth ) +{ MGAPtr pMga = MGAPTR(pScrn); + unsigned int replicate_pm = 0; + + switch( pMga->CurrentLayout.bitsPerPixel ) { + case 8: + replicate_pm = REPLICATE_8( planemask ); + break; + case 16: + replicate_pm = REPLICATE_16( planemask ); + break; + case 24: + replicate_pm = REPLICATE_24( planemask ); + break; + case 32: + replicate_pm = REPLICATE_32( planemask ); + break; + } CHECK_DMA_QUIESCENT(pMga, pScrn); WAITFIFO(3); OUTREG(MGAREG_AR5, 0); - SET_PLANEMASK(planemask); + SET_PLANEMASK_REPLICATED( planemask, replicate_pm, + pMga->CurrentLayout.bitsPerPixel ); OUTREG(MGAREG_DWGCTL, MGADWG_ILOAD | MGADWG_BFCOL | MGADWG_SHIFTZERO | MGADWG_SGNZERO | pMga->AtypeNoBLK[rop]); } -static void MGANAME(SubsequentScanlineImageWriteRect)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ +void mgaSubsequentScanlineImageWriteRect( ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft ) +{ MGAPtr pMga = MGAPTR(pScrn); pMga->AccelFlags |= CLIPPER_ON; pMga->expandRows = h; - pMga->expandDWORDs = ((w * PSZ) + 31) >> 5; + pMga->expandDWORDs = ((w * pMga->CurrentLayout.bitsPerPixel) + 31) >> 5; WAITFIFO(5); OUTREG(MGAREG_CXBNDRY, 0xFFFF0000 | ((x + skipleft) & 0xFFFF)); @@ -1848,10 +1918,9 @@ static void MGANAME(SubsequentScanlineImageWriteRect)( OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); } -static void MGANAME(SubsequentImageWriteScanline)( - ScrnInfoPtr pScrn, - int bufno -){ + +void mgaSubsequentImageWriteScanline( ScrnInfoPtr pScrn, int bufno ) +{ MGAPtr pMga = MGAPTR(pScrn); int dwords = pMga->expandDWORDs; CARD32 *src = (CARD32*)(pMga->ScratchBuffer); @@ -1871,25 +1940,31 @@ static void MGANAME(SubsequentImageWriteScanline)( } } + #if X_BYTE_ORDER == X_LITTLE_ENDIAN /***************************\ | Dashed Lines | \***************************/ - -void -MGANAME(SetupForDashedLine)( - ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask, - int length, - unsigned char *pattern -){ +void mgaSetupForDashedLine( ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask, int length, + unsigned char *pattern ) +{ MGAPtr pMga = MGAPTR(pScrn); CARD32 *DashPattern = (CARD32*)pattern; CARD32 NiceDashPattern = DashPattern[0]; int dwords = (length + 31) >> 5; + unsigned int replicate_fg = 0; + unsigned int replicate_bg = 0; + unsigned int replicate_pm = 0; + + + common_replicate_colors_and_mask( fg, bg, planemask, + pMga->CurrentLayout.bitsPerPixel, + & replicate_fg, & replicate_bg, + & replicate_pm ); CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -1901,60 +1976,73 @@ MGANAME(SetupForDashedLine)( WAITFIFO(dwords + 2); } else { WAITFIFO(dwords + 3); - SET_BACKGROUND(bg); + SET_BACKGROUND_REPLICATED( bg, replicate_bg ); } - SET_PLANEMASK(planemask); - SET_FOREGROUND(fg); - /* We see if we can draw horizontal lines as 8x8 pattern fills. - This is worthwhile since the pattern fills can use block mode - and the default X pattern is 8 pixels long. The forward pattern - is the top scanline, the backwards pattern is the next one. */ + SET_PLANEMASK_REPLICATED( planemask, replicate_pm, + pMga->CurrentLayout.bitsPerPixel ); + SET_FOREGROUND_REPLICATED( fg, replicate_fg ); + + + /* We see if we can draw horizontal lines as 8x8 pattern fills. This is + * worthwhile since the pattern fills can use block mode and the default X + * pattern is 8 pixels long. The forward pattern is the top scanline, the + * backwards pattern is the next one. + */ switch(length) { - case 2: NiceDashPattern |= NiceDashPattern << 2; - case 4: NiceDashPattern |= NiceDashPattern << 4; - case 8: NiceDashPattern |= byte_reversed[NiceDashPattern] << 16; - NiceDashPattern |= NiceDashPattern << 8; - pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_BMONOLEF; - pMga->AccelFlags |= NICE_DASH_PATTERN; - if(bg == -1) { -#if PSZ == 24 - if(!RGBEQUAL(fg)) - pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop]; - else -#endif - pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->Atype[rop]; - } else { -#if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) -#else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) -#endif - pMga->NiceDashCMD |= pMga->Atype[rop]; - else - pMga->NiceDashCMD |= pMga->AtypeNoBLK[rop]; - } - OUTREG(MGAREG_SRC0, NiceDashPattern); - break; - default: pMga->AccelFlags &= ~NICE_DASH_PATTERN; - switch (dwords) { - case 4: OUTREG(MGAREG_SRC3, DashPattern[3]); - case 3: OUTREG(MGAREG_SRC2, DashPattern[2]); - case 2: OUTREG(MGAREG_SRC1, DashPattern[1]); - default: OUTREG(MGAREG_SRC0, DashPattern[0]); - } + case 2: NiceDashPattern |= NiceDashPattern << 2; + case 4: NiceDashPattern |= NiceDashPattern << 4; + case 8: { + NiceDashPattern |= byte_reversed[NiceDashPattern] << 16; + NiceDashPattern |= NiceDashPattern << 8; + pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_BMONOLEF; + pMga->AccelFlags |= NICE_DASH_PATTERN; + + if( bg == -1 ) { + if ( (pMga->CurrentLayout.bitsPerPixel == 24) && !RGBEQUAL(fg) ) { + pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop]; + } + else { + pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->Atype[rop]; + } + } + else { + /* (Packed) 24-bit is a funky mode. We only use the Atype table + * in 24-bit if the components of the foreground color and the + * components of the background color are the same (e.g., fg = + * 0xf8f8f8 and bg = 0x131313). + */ + + if( ((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) != 0) + && ((pMga->CurrentLayout.bitsPerPixel != 24) + || (RGBEQUAL(fg) && RGBEQUAL(bg))) ) { + pMga->NiceDashCMD |= pMga->Atype[rop]; + } + else { + pMga->NiceDashCMD |= pMga->AtypeNoBLK[rop]; + } + } + OUTREG(MGAREG_SRC0, NiceDashPattern); + break; + } + default: { + pMga->AccelFlags &= ~NICE_DASH_PATTERN; + switch (dwords) { + case 4: OUTREG(MGAREG_SRC3, DashPattern[3]); + case 3: OUTREG(MGAREG_SRC2, DashPattern[2]); + case 2: OUTREG(MGAREG_SRC1, DashPattern[1]); + default: OUTREG(MGAREG_SRC0, DashPattern[0]); + } + } } } -void -MGANAME(SubsequentDashedTwoPointLine)( - ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, - int flags, int phase -){ +void mgaSubsequentDashedTwoPointLine( ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, + int flags, int phase ) +{ MGAPtr pMga = MGAPTR(pScrn); WAITFIFO(4); @@ -1981,49 +2069,39 @@ MGANAME(SubsequentDashedTwoPointLine)( OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF)); } } - #endif /* X_BYTE_ORDER == X_LITTLE_ENDIAN */ -#if PSZ != 24 /******************************************\ | Planar Screen to Screen Color Expansion | \******************************************/ -static void -MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ +void mgaSetupForPlanarScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask ) +{ MGAPtr pMga = MGAPTR(pScrn); CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT | MGADWG_SGNZERO | MGADWG_BPLAN; + CARD32 regs[2]; - CHECK_DMA_QUIESCENT(pMga, pScrn); - if(bg == -1) { - mgaCMD |= MGADWG_TRANSC; - WAITFIFO(4); - } else { - WAITFIFO(5); - SET_BACKGROUND(bg); - } + regs[0] = MGAREG_AR5; + regs[1] = pScrn->displayWidth; + + CHECK_DMA_QUIESCENT(pMga, pScrn); - SET_FOREGROUND(fg); - SET_PLANEMASK(planemask); - OUTREG(MGAREG_AR5, pScrn->displayWidth); - OUTREG(MGAREG_DWGCTL, mgaCMD); + (void) common_setup_for_pattern_fill( pMga, fg, bg, 0, planemask, regs, 1, + mgaCMD ); } -static void -MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, - int skipleft -){ + +void mgaSubsequentPlanarScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int srcx, int srcy, + int skipleft ) +{ MGAPtr pMga = MGAPTR(pScrn); int start, end; @@ -2038,69 +2116,45 @@ MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); } -#endif /***********************************\ | Screen to Screen Color Expansion | \***********************************/ -static void -MGANAME(SetupForScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ +void mgaSetupForScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask ) +{ MGAPtr pMga = MGAPTR(pScrn); - CARD32 mgaCMD = MGADWG_BITBLT | MGADWG_SGNZERO | MGADWG_SHIFTZERO; + CARD32 regs[2]; + + regs[0] = MGAREG_AR5; + regs[1] = pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel; CHECK_DMA_QUIESCENT(pMga, pScrn); - if(bg == -1) { -#if PSZ == 24 - if(!RGBEQUAL(fg)) - mgaCMD |= MGADWG_TRANSC | pMga->AtypeNoBLK[rop]; - else -#endif - mgaCMD |= MGADWG_TRANSC | pMga->Atype[rop]; - - WAITFIFO(4); - } else { -#if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) -#else - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION)) -#endif - mgaCMD |= pMga->Atype[rop]; - else - mgaCMD |= pMga->AtypeNoBLK[rop]; - WAITFIFO(5); - SET_BACKGROUND(bg); - } - - SET_FOREGROUND(fg); - SET_PLANEMASK(planemask); - OUTREG(MGAREG_AR5, pScrn->displayWidth * PSZ); - OUTREG(MGAREG_DWGCTL, mgaCMD); - + (void) common_setup_for_pattern_fill( pMga, fg, bg, rop, planemask, + regs, 1, + MGADWG_BITBLT | MGADWG_SGNZERO + | MGADWG_SHIFTZERO ); } -static void -MGANAME(SubsequentScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, - int skipleft -){ + +void mgaSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int srcx, int srcy, + int skipleft ) +{ MGAPtr pMga = MGAPTR(pScrn); - int pitch = pScrn->displayWidth * PSZ; + const unsigned int display_bit_width = + (pMga->CurrentLayout.displayWidth * pMga->CurrentLayout.bitsPerPixel); int start, end, next, num; Bool resetDstOrg = FALSE; if (pMga->AccelFlags & LARGE_ADDRESSES) { - int DstOrg = ((y & ~1023) * pScrn->displayWidth * PSZ) >> 9; - int SrcOrg = ((srcy & ~1023) * pScrn->displayWidth * PSZ) >> 9; + const int DstOrg = ((y & ~1023) * display_bit_width) >> 9; + const int SrcOrg = ((srcy & ~1023) * display_bit_width) >> 9; y &= 1023; srcy &= 1023; @@ -2117,8 +2171,9 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( } w--; - start = (XYADDRESS(srcx, srcy) * PSZ) + skipleft; - end = start + w + (pitch * (h - 1)); + start = (XYADDRESS(srcx, srcy) * pMga->CurrentLayout.bitsPerPixel) + + skipleft; + end = start + w + (display_bit_width * (h - 1)); /* src cannot split a 2 Meg boundary from SrcOrg */ if(!((start ^ end) & 0xff000000)) { @@ -2143,10 +2198,10 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( OUTREG(MGAREG_AR0, start + w ); OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) | ((x + num + 1) & 0xffff)); - start += pitch; + start += display_bit_width; h--; y++; } else { - num = ((next - start - w)/pitch) + 1; + num = ((next - start - w)/display_bit_width) + 1; if(num > h) num = h; WAITFIFO(4); @@ -2155,7 +2210,7 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | num); - start += num * pitch; + start += num * display_bit_width; h -= num; y += num; } } @@ -2168,9 +2223,6 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( } - -#if PSZ == 8 - void MGAFillSolidRectsDMA( ScrnInfoPtr pScrn, @@ -2528,11 +2580,10 @@ MGAFillCacheBltRects( SET_SYNC_FLAG(infoRec); } -#endif -#ifdef XF86DRI +#if defined(XF86DRI) void -MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index) +mgaDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -2542,14 +2593,14 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index) CHECK_DMA_QUIESCENT(MGAPTR(pScrn), pScrn); - MGANAME(SetupForSolidFill)(pScrn, 0, GXcopy, -1); + mgaSetupForSolidFill(pScrn, 0, GXcopy, -1); while (nbox--) { MGASelectBuffer(pScrn, MGA_BACK); - MGANAME(SubsequentSolidFillRect)(pScrn, pbox->x1, pbox->y1, - pbox->x2-pbox->x1, pbox->y2-pbox->y1); + mgaSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2-pbox->x1, pbox->y2-pbox->y1); MGASelectBuffer(pScrn, MGA_DEPTH); - MGANAME(SubsequentSolidFillRect)(pScrn, pbox->x1, pbox->y1, - pbox->x2-pbox->x1, pbox->y2-pbox->y1); + mgaSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + pbox->x2-pbox->x1, pbox->y2-pbox->y1); pbox++; } MGASelectBuffer(pScrn, MGA_FRONT); @@ -2565,8 +2616,8 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index) */ void -MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index) +mgaDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -2668,9 +2719,8 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, xdir = 1; } - MGANAME(SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, -1, -1); - for ( ; nbox-- ; pbox++) - { + mgaSetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); + for ( ; nbox-- ; pbox++) { int x1 = pbox->x1; int y1 = pbox->y1; int destx = x1 + dx; @@ -2686,12 +2736,10 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, if ( h <= 0 ) continue; MGASelectBuffer(pScrn, MGA_BACK); - MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1, - destx,desty, w, h); + mgaSubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); MGASelectBuffer(pScrn, MGA_DEPTH); - MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, - destx,desty, w, h); - } + mgaSubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); + } MGASelectBuffer(pScrn, MGA_FRONT); if (pboxNew2) { |