diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:28:37 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:28:37 +0000 |
commit | bf37df17ecf040836ad8924a9174787d0f57ed5a (patch) | |
tree | 20ba7f7206ed6a68553ac46bbf23ba289ac9fb64 | |
parent | d3b3c858814952bc7344a4154e981851fd9bb494 (diff) |
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330
-rw-r--r-- | man/mga.man | 9 | ||||
-rw-r--r-- | src/mga.h | 5 | ||||
-rw-r--r-- | src/mga_arc.c | 4 | ||||
-rw-r--r-- | src/mga_dac3026.c | 11 | ||||
-rw-r--r-- | src/mga_dacG.c | 20 | ||||
-rw-r--r-- | src/mga_dga.c | 28 | ||||
-rw-r--r-- | src/mga_dh.c | 12 | ||||
-rw-r--r-- | src/mga_dri.c | 25 | ||||
-rw-r--r-- | src/mga_driver.c | 70 | ||||
-rw-r--r-- | src/mga_esc.c | 37 | ||||
-rw-r--r-- | src/mga_g450pll.c | 11 | ||||
-rw-r--r-- | src/mga_merge.c | 9 | ||||
-rw-r--r-- | src/mga_video.c | 167 |
13 files changed, 160 insertions, 248 deletions
diff --git a/man/mga.man b/man/mga.man index b1b3337..0a1209d 100644 --- a/man/mga.man +++ b/man/mga.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.6 2003/01/26 02:17:28 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.8 2003/04/03 07:42:13 herrb Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH MGA __drivermansuffix__ __vendorversion__ @@ -112,11 +112,12 @@ loaded when available and when using hardware that it supports. Set clocks to values used by some commercial X-Servers (G100, G200 and G400 only). Default: off. .TP -.BI "Option \*qOverlay\*q" -Enable 8+24 overlay mode. Only appropriate for depth 24. +.BI "Option \*qOverlay\*q \*q" value \*q +Enable 8+24 overlay mode. Only appropriate for depth 24. +Recognized values are: "8,24", "24,8". Default: off. .RB ( Note: the G100 is unaccelerated in the 8+24 overlay mode due to a missing -hardware feature.) Default: off. +hardware feature.) .TP .BI "Option \*qPciRetry\*q \*q" boolean \*q Enable or disable PCI retries. Default: off. @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.85 2002/12/16 16:19:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.87 2003/10/08 15:48:41 eich Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -148,7 +148,7 @@ void dbg_outreg32(ScrnInfoPtr,int,int); #define MGA_DRIVER_NAME "mga" #define MGA_MAJOR_VERSION 1 #define MGA_MINOR_VERSION 1 -#define MGA_PATCHLEVEL 0 +#define MGA_PATCHLEVEL 1 typedef struct { unsigned char ExtVga[6]; @@ -212,6 +212,7 @@ typedef struct { MessageType MemClkFrom; Bool SetMemClk; void (*LoadPalette)(ScrnInfoPtr, int, int*, LOCO*, VisualPtr); + void (*RestorePalette)(ScrnInfoPtr, unsigned char *); void (*PreInit)(ScrnInfoPtr); void (*Save)(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool); void (*Restore)(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool); diff --git a/src/mga_arc.c b/src/mga_arc.c index 1045cfa..5c9a9cb 100644 --- a/src/mga_arc.c +++ b/src/mga_arc.c @@ -23,7 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c,v 1.10 2001/12/14 19:59:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_arc.c,v 1.12 2003/07/16 03:08:37 dawes Exp $ */ #include "X.h" @@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group. #include "pixmapstr.h" #include "regionstr.h" #include "Xprotostr.h" -#include "miscstruct.h" +#include "regionstr.h" #include "mizerarc.h" #include "mi.h" #include "scrnintstr.h" diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c index 220ef1a..d97e870 100644 --- a/src/mga_dac3026.c +++ b/src/mga_dac3026.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.56 2001/04/05 21:29:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.58 2003/11/03 05:11:17 tsi Exp $ */ /* * Copyright 1994 by Robin Cutshaw <robin@XFree86.org> * @@ -277,16 +277,12 @@ MGATi3026CalcClock ( static void MGATi3026SetMCLK( ScrnInfoPtr pScrn, long f_out ) { - double f_pll; int mclk_m, mclk_n, mclk_p; int pclk_m, pclk_n, pclk_p; int mclk_ctl; MGAPtr pMga = MGAPTR(pScrn); - f_pll = MGATi3026CalcClock( - f_out, TI_MAX_MCLK_FREQ, - & mclk_m, & mclk_n, & mclk_p - ); + MGATi3026CalcClock(f_out, TI_MAX_MCLK_FREQ, &mclk_m, &mclk_n, &mclk_p); /* Save PCLK settings */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfc ); @@ -1079,7 +1075,8 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn) HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; MGAdac->LoadPalette = MGA3026LoadPalette; - + MGAdac->RestorePalette = MGA3026RestorePalette; + MGAdac->ClockFrom = X_PROBED; if ( pMga->Chipset == PCI_CHIP_MGA2064 && pMga->Bios2.PinID == 0 ) { diff --git a/src/mga_dacG.c b/src/mga_dacG.c index 34a9432..842e75e 100644 --- a/src/mga_dacG.c +++ b/src/mga_dacG.c @@ -2,7 +2,7 @@ * MGA-1064, MGA-G100, MGA-G200, MGA-G400, MGA-G550 RAMDAC driver */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.51 2002/09/16 18:05:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.54 2003/11/03 05:11:17 tsi Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -208,16 +208,13 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out ) /* Pixel clock values */ int m, n, p, s; - /* The actual frequency output by the clock */ - double f_pll; - if(MGAISGx50(pMga)) { pReg->Clock = f_out; return; } /* Do the calculations for m, n, p and s */ - f_pll = MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s ); + (void) MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s ); /* Values for the pixel clock PLL registers */ pReg->DacRegs[ MGA1064_PIX_PLLC_M ] = m & 0x1F; @@ -247,7 +244,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* 0x48: */ 0, 0, 0, 0, 0, 0, 0, 0 }; - int i, weight555 = FALSE; + int i; int hd, hs, he, ht, vd, vs, ve, vt, wd; int BppShift; MGAPtr pMga; @@ -411,7 +408,6 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->DacRegs[ MGA1064_MUL_CTL ] = MGA1064_MUL_CTL_16bits; if ( (pLayout->weight.red == 5) && (pLayout->weight.green == 5) && (pLayout->weight.blue == 5) ) { - weight555 = TRUE; pReg->DacRegs[ MGA1064_MUL_CTL ] = MGA1064_MUL_CTL_15bits; } break; @@ -479,7 +475,8 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->ExtVga[2] = ((vt & 0xc00) >> 10) | ((vd & 0x400) >> 8) | ((vd & 0xc00) >> 7) | - ((vs & 0xc00) >> 5); + ((vs & 0xc00) >> 5) | + ((vd & 0x400) >> 3); /* linecomp */ if (pLayout->bitsPerPixel == 24) pReg->ExtVga[3] = (((1 << BppShift) * 3) - 1) | 0x80; else @@ -498,17 +495,19 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) ((vd & 0x100) >> 7 ) | ((vs & 0x100) >> 6 ) | ((vd & 0x100) >> 5 ) | - 0x10 | + ((vd & 0x100) >> 4 ) | /* linecomp */ ((vt & 0x200) >> 4 ) | ((vd & 0x200) >> 3 ) | ((vs & 0x200) >> 2 ); - pVga->CRTC[9] = ((vd & 0x200) >> 4) | 0x40; + pVga->CRTC[9] = ((vd & 0x200) >> 4) | + ((vd & 0x200) >> 3); /* linecomp */ pVga->CRTC[16] = vs & 0xFF; pVga->CRTC[17] = (ve & 0x0F) | 0x20; pVga->CRTC[18] = vd & 0xFF; pVga->CRTC[19] = wd & 0xFF; pVga->CRTC[21] = vd & 0xFF; pVga->CRTC[22] = (vt + 1) & 0xFF; + pVga->CRTC[24] = vd & 0xFF; /* linecomp */ MGA_NOT_HAL(pReg->DacRegs[MGA1064_CURSOR_BASE_ADR_LOW] = pMga->FbCursorOffset >> 10); MGA_NOT_HAL(pReg->DacRegs[MGA1064_CURSOR_BASE_ADR_HI] = pMga->FbCursorOffset >> 18); @@ -1128,6 +1127,7 @@ MGAGRamdacInit(ScrnInfoPtr pScrn) HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; MGAdac->LoadPalette = MGAGLoadPalette; + MGAdac->RestorePalette = MGAGRestorePalette; if ( pMga->Bios2.PinID && pMga->Bios2.PclkMax != 0xFF ) { diff --git a/src/mga_dga.c b/src/mga_dga.c index d6735b1..3148fec 100644 --- a/src/mga_dga.c +++ b/src/mga_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.16 2002/09/16 18:05:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.17 2003/10/08 15:48:41 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -264,6 +264,30 @@ BitsSet(unsigned long data) return set; } +/* + * This is not strictly required - but it will load a 'sane' + * palette when starting DGA. + */ +static void +mgaDGASetPalette(ScrnInfoPtr pScrn) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGARamdacPtr MGAdac = &pMga->Dac; + unsigned char DAC[256*3]; + int i; + + if (!MGAdac->RestorePalette) + return; + + for (i = 0; i < 256; i++) { + DAC[i*3] = i; + DAC[i*3 + 1] = i; + DAC[i*3 + 2] = i; + } + MGAdac->RestorePalette(pScrn, DAC); +} + + static Bool MGA_SetMode( ScrnInfoPtr pScrn, @@ -299,6 +323,8 @@ MGA_SetMode( /* MGAModeInit() will set the mode field */ pScrn->SwitchMode(index, pMode->mode, 0); + /* not strictly required but nice */ + mgaDGASetPalette(pScrn); } return TRUE; diff --git a/src/mga_dh.c b/src/mga_dh.c index 79c8510..e283795 100644 --- a/src/mga_dh.c +++ b/src/mga_dh.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.4 2002/01/11 15:42:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.5 2003/11/03 05:11:17 tsi Exp $ */ /********************************************************************* * G450: This is for Dual Head. * Matrox Graphics @@ -151,13 +151,11 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) CARD32 ulHTotal; CARD32 ulHDispEnd; CARD32 ulHBlkStr; - CARD32 ulHBlkEnd; CARD32 ulHSyncStr; CARD32 ulHSyncEnd; CARD32 ulVTotal; CARD32 ulVDispEnd; CARD32 ulVBlkStr; - CARD32 ulVBlkEnd; CARD32 ulVSyncStr; CARD32 ulVSyncEnd; CARD32 ulOffset; @@ -181,7 +179,6 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) ulHDispEnd = tmpModeInfo.ulDispWidth; ulHBlkStr = ulHDispEnd; - ulHBlkEnd = ulHBlkStr + tmpModeInfo.ulHBPorch + tmpModeInfo.ulHFPorch + tmpModeInfo.ulHSync; ulHSyncStr = ulHBlkStr + tmpModeInfo.ulHFPorch; ulHSyncEnd = ulHSyncStr + tmpModeInfo.ulHSync; @@ -193,7 +190,6 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) ulVDispEnd = ulDispHeight; ulVBlkStr = ulVDispEnd; - ulVBlkEnd = ulVBlkStr + tmpModeInfo.ulVBPorch + tmpModeInfo.ulVFPorch + tmpModeInfo.ulVSync; ulVSyncStr = ulVBlkStr + tmpModeInfo.ulVFPorch; ulVSyncEnd = ulVSyncStr + tmpModeInfo.ulVSync; @@ -285,7 +281,7 @@ void MGACRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { CARD8 ucByte, ucXDispCtrl; - CARD32 ulC2CTL, ulStatusReg; + CARD32 ulC2CTL; MGAPtr pMga = MGAPTR(pScrn); MGARegPtr pReg; pReg = &pMga->ModeReg; @@ -300,8 +296,8 @@ void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) /*--- Disable Pixel clock oscillations On Crtc1 */ OUTREG( MGAREG_C2CTL, ulC2CTL | C2CTL_PIXCLKDIS_MASK); /*--- Have to wait minimum time (2 acces will be ok) */ - ulStatusReg = INREG( MGAREG_Status); - ulStatusReg = INREG( MGAREG_Status); + (void) INREG( MGAREG_Status); + (void) INREG( MGAREG_Status); ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK); diff --git a/src/mga_dri.c b/src/mga_dri.c index 37d3a9a..e08a2a4 100644 --- a/src/mga_dri.c +++ b/src/mga_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.28 2003/02/08 21:26:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.32 2003/11/06 18:38:04 tsi Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -192,11 +192,11 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen ) pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; if ( accum || stencil ) { - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + pConfigs[i].visualRating = GLX_SLOW_CONFIG; } else { - pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].visualRating = GLX_NONE; } - pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentPixel = GLX_NONE; pConfigs[i].transparentRed = 0; pConfigs[i].transparentGreen = 0; pConfigs[i].transparentBlue = 0; @@ -285,11 +285,11 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen ) pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; if ( accum ) { - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + pConfigs[i].visualRating = GLX_SLOW_CONFIG; } else { - pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].visualRating = GLX_NONE; } - pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentPixel = GLX_NONE; pConfigs[i].transparentRed = 0; pConfigs[i].transparentGreen = 0; pConfigs[i].transparentBlue = 0; @@ -672,7 +672,7 @@ static Bool MGADRIAgpInit(ScreenPtr pScreen) return FALSE; } xf86DrvMsg( pScreen->myNum, X_INFO, - "[agp] %d kB allocated with handle 0x%08x\n", + "[agp] %d kB allocated with handle 0x%08lx\n", pMGADRIServer->agp.size/1024, pMGADRIServer->agp.handle ); if ( drmAgpBind( pMga->drmFD, pMGADRIServer->agp.handle, 0 ) < 0 ) { @@ -1078,8 +1078,8 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[drm] Sarea %d+%d: %d\n", - sizeof(XF86DRISAREARec), sizeof(MGASAREAPrivRec), - sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) ); + (int)sizeof(XF86DRISAREARec), (int)sizeof(MGASAREAPrivRec), + (int)sizeof(XF86DRISAREARec) + (int)sizeof(MGASAREAPrivRec) ); pDRIInfo->SAREASize = SAREA_MAX; @@ -1359,6 +1359,7 @@ void MGADRICloseScreen( ScreenPtr pScreen ) if (pMga->irq) { drmCtlUninstHandler(pMga->drmFD); pMga->irq = 0; + pMga->reg_ien = 0; } /* Cleanup DMA */ @@ -1388,10 +1389,10 @@ void MGADRICloseScreen( ScreenPtr pScreen ) pMGADRIServer->agpTextures.map = NULL; } - if ( pMGADRIServer->agp.handle ) { + if ( pMGADRIServer->agp.handle != DRM_AGP_NO_HANDLE ) { drmAgpUnbind( pMga->drmFD, pMGADRIServer->agp.handle ); drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle ); - pMGADRIServer->agp.handle = 0; + pMGADRIServer->agp.handle = DRM_AGP_NO_HANDLE; drmAgpRelease( pMga->drmFD ); } diff --git a/src/mga_driver.c b/src/mga_driver.c index c2696d1..c5871f6 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -45,7 +45,7 @@ * Added digital screen option for first head */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.231 2003/01/29 19:29:49 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.244 2003/11/03 05:11:17 tsi Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -124,8 +124,8 @@ static void VgaIORestore(int i, void *arg); /* Optional functions */ static void MGAFreeScreen(int scrnIndex, int flags); -static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, - int flags); +static ModeStatus MGAValidMode(int scrnIndex, DisplayModePtr mode, + Bool verbose, int flags); /* Internally used functions */ static Bool MGAMapMem(ScrnInfoPtr pScrn); @@ -272,10 +272,8 @@ static const char *xaaSymbols[] = { "XAACreateInfoRec", "XAADestroyInfoRec", "XAAFallbackOps", - "XAAFillSolidRects", "XAAInit", "XAAMoveDWORDS", - "XAAScreenIndex", "XAA_888_plus_PICT_a8_to_8888", NULL }; @@ -287,7 +285,6 @@ static const char *ramdacSymbols[] = { NULL }; -#ifdef XFree86LOADER #ifdef XF86DRI static const char *drmSymbols[] = { "drmAddBufs", @@ -304,7 +301,10 @@ static const char *drmSymbols[] = { "drmAgpVendorId", "drmCommandNone", "drmCommandWrite", + "drmCtlInstHandler", + "drmCtlUninstHandler", "drmFreeVersion", + "drmGetInterruptFromBusID", "drmGetLibVersion", "drmGetVersion", "drmMap", @@ -328,7 +328,6 @@ static const char *driSymbols[] = { NULL }; #endif -#endif #define MGAuseI2C 1 @@ -980,12 +979,10 @@ MGAdoDDC(ScrnInfoPtr pScrn) { vgaHWPtr hwp; MGAPtr pMga; - MGARamdacPtr MGAdac; xf86MonPtr MonInfo = NULL; hwp = VGAHWPTR(pScrn); pMga = MGAPTR(pScrn); - MGAdac = &pMga->Dac; /* Load DDC if we have the code to use it */ /* This gives us DDC1 */ @@ -1052,7 +1049,8 @@ MGAdoDDC(ScrnInfoPtr pScrn) /* Read and output monitor info using DDC2 over I2C bus */ if (pMga->I2C) { MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex,pMga->I2C); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", + (void *)MonInfo); xf86PrintEDID(MonInfo); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n"); } @@ -1063,7 +1061,8 @@ MGAdoDDC(ScrnInfoPtr pScrn) MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, pMga->DDC1SetSpeed, pMga->ddc1Read ) ; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", + (void *)MonInfo); xf86PrintEDID( MonInfo ); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n"); } @@ -1075,7 +1074,8 @@ MGAdoDDC(ScrnInfoPtr pScrn) vbeFree(pVbe); if (MonInfo){ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBE DDC Monitor info: %p\n", MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBE DDC Monitor info: %p\n", + (void *)MonInfo); xf86PrintEDID( MonInfo ); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of VBE DDC Monitor info\n\n"); } @@ -1438,7 +1438,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (pMga->SecondCrtc) flags24 = Support32bppFb; - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) { + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) { return FALSE; } else { /* Check that the returned depth is one we support */ @@ -2403,6 +2403,14 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(shadowSymbols, NULL); } +#ifdef XF86DRI + /* Load the dri module if requested. */ + if (xf86ReturnOptValBool(pMga->Options, OPTION_DRI, FALSE)) { + if (xf86LoadSubModule(pScrn, "dri")) { + xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL); + } + } +#endif pMga->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel; pMga->CurrentLayout.depth = pScrn->depth; pMga->CurrentLayout.displayWidth = pScrn->displayWidth; @@ -3489,19 +3497,28 @@ MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) char sCmdIn[256]; char sCmdOut[256]; FILE* fdIn; +# ifdef MATROX_WRITEBACK FILE* fdOut; +# endif #endif - MGAPtr pMga; - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - pMga = MGAPTR(pScrn); if (mode->Flags & 0x80000000) { #ifdef USEMGAHAL - MGA_HAL( + +# ifdef MATROX_WRITEBACK +# define MWB(x) { x; } +# define MWB_COND(x) x +# else +# define MWB(x) +# define MWB_COND(x) 1 +# endif + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + + MGA_HAL( fdIn = fopen("/tmp/mgaDriverIn", "rt"); - fdOut = fopen("/tmp/mgaDriverOut", "wt"); - - if(fdIn && fdOut) + MWB(fdOut = fopen("/tmp/mgaDriverOut", "wt")) + + if(fdIn && MWB_COND(fdOut)) { fgets(sCmdIn, 255, fdIn); @@ -3514,11 +3531,12 @@ MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) /* Remove file and close file descriptor */ remove("/tmp/mgaDriverIn"); fclose(fdIn); - - /* Write output data to output file for calling application */ - fputs(sCmdOut, fdOut); - fclose(fdOut); - + MWB( + /* Write output data to output file for + calling application */ + fputs(sCmdOut, fdOut); + fclose(fdOut); + ) mode->Flags &= 0x7FFFFFFF; return TRUE; } @@ -3900,7 +3918,7 @@ MGAFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -static int +static ModeStatus MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { int lace; diff --git a/src/mga_esc.c b/src/mga_esc.c index dc0b7b3..c813f8c 100644 --- a/src/mga_esc.c +++ b/src/mga_esc.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_esc.c,v 1.3 2003/10/31 15:06:25 tsi Exp $ */ /**************************************************************************** * mga_esc.c * @@ -216,23 +217,23 @@ static void EscRead(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, Dis break; case 1: ucIndex = INREG8(0x3c00); - OUTREG(0x3c00, (UCHAR)ulAddr); + OUTREG8(0x3c00, (UCHAR)ulAddr); ulData = (ULONG)INREG8(0x3c0a); - OUTREG(0x3c00, ucIndex); + OUTREG8(0x3c00, ucIndex); sprintf(sResult, "DAC[%02X] = 0x%02X", ulAddr, ulData); break; case 2: ucIndex = INREG8(0x1fd4); - OUTREG(0x1fd4, (UCHAR)ulAddr); + OUTREG8(0x1fd4, (UCHAR)ulAddr); ulData = (ULONG)INREG8(0x1fd5); - OUTREG(0x1fd4, ucIndex); + OUTREG8(0x1fd4, ucIndex); sprintf(sResult, "CRTC[%02X] = 0x%02X", ulAddr, ulData); break; case 3: ucIndex = INREG8(0x1fde); - OUTREG(0x1fde, (UCHAR)ulAddr); + OUTREG8(0x1fde, (UCHAR)ulAddr); ulData = (ULONG)INREG8(0x1fdf); - OUTREG(0x1fde, ucIndex); + OUTREG8(0x1fde, ucIndex); sprintf(sResult, "CRTCEXT[%02X] = 0x%02X", ulAddr, ulData); break; default: @@ -266,23 +267,23 @@ static void EscWrite(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, Di break; case 1: ucIndex = INREG8(0x3c00); - OUTREG(0x3c00, (UCHAR)ulAddr); - OUTREG(0x3c0a, (UCHAR)ulData); - OUTREG(0x3c00, ucIndex); + OUTREG8(0x3c00, (UCHAR)ulAddr); + OUTREG8(0x3c0a, (UCHAR)ulData); + OUTREG8(0x3c00, ucIndex); strcpy(sResult, "OK"); break; case 2: ucIndex = INREG8(0x1fd4); - OUTREG(0x1fd4, (UCHAR)ulAddr); - OUTREG(0x1fd5, (UCHAR)ulData); - OUTREG(0x1fd4, ucIndex); + OUTREG8(0x1fd4, (UCHAR)ulAddr); + OUTREG8(0x1fd5, (UCHAR)ulData); + OUTREG8(0x1fd4, ucIndex); strcpy(sResult, "OK"); break; case 3: ucIndex = INREG8(0x1fde); - OUTREG(0x1fde, (UCHAR)ulAddr); - OUTREG(0x1fdf, (UCHAR)ulData); - OUTREG(0x1fde, ucIndex); + OUTREG8(0x1fde, (UCHAR)ulAddr); + OUTREG8(0x1fdf, (UCHAR)ulData); + OUTREG8(0x1fde, ucIndex); strcpy(sResult, "OK"); break; default: @@ -752,13 +753,13 @@ void MGAExecuteEscCmd(ScrnInfoPtr pScrn, char *cmdline , char *sResult, DisplayM if (pMga->SecondCrtc) { - ulScreen = 1; + ulScreen = 1; } else { ulScreen = 0; } - + if (FunctionTable[0].function && GetEscCommand(cmdline, &EscCmd) ) { @@ -773,7 +774,7 @@ void MGAExecuteEscCmd(ScrnInfoPtr pScrn, char *cmdline , char *sResult, DisplayM { EscCmd.parameters[0] &= 0xffff; EscCmd.parameters[0] |= ulScreen << 16; - + FunctionTable[i].funcptr(pScrn, EscCmd.parameters, sResult, pMode); } else diff --git a/src/mga_g450pll.c b/src/mga_g450pll.c index 6176549..7abba9f 100644 --- a/src/mga_g450pll.c +++ b/src/mga_g450pll.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.8 2002/09/16 18:05:56 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.9 2003/11/03 05:11:18 tsi Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -43,11 +43,10 @@ static CARD32 G450RemovePFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn) static CARD32 G450CalculVCO(ScrnInfoPtr pScrn, CARD32 ulMNP, CARD32 *pulF) { - CARD8 ucM, ucN, ucP; + CARD8 ucM, ucN; ucM = (CARD8)((ulMNP >> 16) & 0xff); ucN = (CARD8)((ulMNP >> 8) & 0xff); - ucP = (CARD8)(ulMNP & 0x03); *pulF = (27000 * (2 * (ucN + 2)) + ((ucM + 1) >> 1)) / (ucM + 1); @@ -193,9 +192,6 @@ static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP) { MGAPtr pMga = MGAPTR(pScrn); - MGARegPtr pReg; - - pReg = &pMga->ModeReg; if (!pMga->SecondCrtc) { outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16)); @@ -212,11 +208,8 @@ static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP) static CARD32 G450ReadMNP(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); - MGARegPtr pReg; CARD32 ret = 0; - pReg = &pMga->ModeReg; - if (!pMga->SecondCrtc) { ret = (CARD8)inMGAdac(MGA1064_PIX_PLLC_M) << 16; ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_N) << 8; diff --git a/src/mga_merge.c b/src/mga_merge.c index e70382f..ab3d20e 100644 --- a/src/mga_merge.c +++ b/src/mga_merge.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c,v 1.2 2002/09/18 21:25:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c,v 1.5 2003/11/02 04:24:36 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -204,7 +204,7 @@ GenerateModeList(ScrnInfoPtr pScrn, char* str, xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Mode: \"%s\" is not a supported mode for monitor 2\n",mode1->name); xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Skipping clone mode \"%s\".\n"); + "Skipping clone mode \"%s\".\n", mode1->name); mode1 = NULL; } else { result = CopyModeNLink(pScrn,result,mode1,mode2,sr); @@ -293,7 +293,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) pScrn->AdjustFrame = MGAAdjustMergeFrames; pScrn1->AdjustFrame = MGAAdjustMergeFrames; -/* if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) FIXME:have to copy result form scrn1 +/* if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) FIXME:have to copy result form scrn1 if (!xf86SetWeight(pScrn, zeros, zeros)) { */ @@ -428,7 +428,8 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) pMga->MinClock / 1000); /* Override on 2nd crtc */ - if (pMga->ChipRev >= 0x80) { /* G450 */ + if (pMga->ChipRev >= 0x80 || (pMga->Chipset == PCI_CHIP_MGAG550)) { + /* G450, G550 */ pMga->MaxClock = 234000; } else { pMga->MaxClock = 135000; diff --git a/src/mga_video.c b/src/mga_video.c index d2e98a3..62bb2ad 100644 --- a/src/mga_video.c +++ b/src/mga_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.29 2001/12/26 14:54:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.33 2003/11/10 18:22:23 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -32,10 +32,6 @@ #define MGA_MAX_PORTS 32 -#ifndef XvExtension -void MGAInitVideo(ScreenPtr pScreen) {} -#else - static void MGAInitOffscreenImages(ScreenPtr); static XF86VideoAdaptorPtr MGASetupImageVideoOverlay(ScreenPtr); @@ -272,7 +268,7 @@ MGASetupImageVideoOverlay(ScreenPtr pScreen) adapt->QueryImageAttributes = MGAQueryImageAttributes; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &(pMga->portPrivate->clip), NullBox, 0); + REGION_NULL(pScreen, &(pMga->portPrivate->clip)); MGAResetVideoOverlay(pScrn); @@ -320,127 +316,6 @@ MGASetupImageVideoTexture(ScreenPtr pScreen) } - -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - - -/* MGAClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -#define DummyScreen screenInfo.screens[0] - -static Bool -MGAClipVideo( - BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - RegionPtr reg, - INT32 width, - INT32 height -){ - INT32 vscale, hscale, delta; - BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*x1 >= *x2) return FALSE; - - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } - if(*y1 >= *y2) return FALSE; - - if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || - (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) - { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); - } - return TRUE; -} - static void MGAStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { @@ -693,6 +568,7 @@ MGADisplayVideoOverlay( ){ MGAPtr pMga = MGAPTR(pScrn); int tmp, hzoom, intrep; + int maxOverlayClock; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -706,7 +582,15 @@ MGADisplayVideoOverlay( tmp = pScrn->currentMode->VDisplay +1; /* enable accelerated 2x horizontal zoom when pixelclock >135MHz */ - hzoom = (pScrn->currentMode->Clock > 135000) ? 1 : 0; + + if ((pMga->ChipRev >= 0x80) || (pMga->Chipset == PCI_CHIP_MGAG550)) { + /* G450, G550 */ + maxOverlayClock = 234000; + } else { + maxOverlayClock = 135000; + } + + hzoom = (pScrn->currentMode->Clock > maxOverlayClock) ? 1 : 0; switch(id) { case FOURCC_UYVY: @@ -854,7 +738,7 @@ MGAPutImage( MGAPortPrivPtr pPriv = pMga->portPrivate; INT32 x1, x2, y1, y2; unsigned char *dst_start; - int pitch, new_size, offset, offset2 = 0, offset3 = 0; + int new_size, offset, offset2 = 0, offset3 = 0; int srcPitch, srcPitch2 = 0, dstPitch; int top, left, npixels, nlines, bpp; BoxRec dstBox; @@ -871,7 +755,8 @@ MGAPutImage( dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!MGAClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, + clipBoxes, width, height)) return Success; if(!pMga->TexturedVideo) { @@ -882,7 +767,6 @@ MGAPutImage( } bpp = pScrn->bitsPerPixel >> 3; - pitch = bpp * pScrn->displayWidth; dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; @@ -962,12 +846,10 @@ MGAPutImage( pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; } else { /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } offset += top * dstPitch; @@ -1074,7 +956,7 @@ MGAAllocateSurface( XF86SurfacePtr surface ){ FBLinearPtr linear; - int pitch, fbpitch, size, bpp; + int pitch, size, bpp; OffscreenPrivPtr pPriv; if((w > 1024) || (h > 1024)) @@ -1083,7 +965,6 @@ MGAAllocateSurface( w = (w + 1) & ~1; pitch = ((w << 1) + 15) & ~15; bpp = pScrn->bitsPerPixel >> 3; - fbpitch = bpp * pScrn->displayWidth; size = ((pitch * h) + bpp - 1) / bpp; if(!(linear = MGAAllocateMemory(pScrn, NULL, size))) @@ -1197,8 +1078,8 @@ MGADisplaySurface( dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!MGAClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, - surface->width, surface->height)) + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) { return Success; } @@ -1214,9 +1095,7 @@ MGADisplaySurface( surface->width, surface->height, surface->pitches[0], x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); pPriv->isOn = TRUE; /* we've prempted the XvImage stream so set its free timer */ @@ -1276,5 +1155,3 @@ MGAInitOffscreenImages(ScreenPtr pScreen) xf86XVRegisterOffscreenImages(pScreen, offscreenImages, num); } - -#endif /* !XvExtension */ |