From 7cbb9f870b020742a254f1e9aadd0209b1f0a876 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 16 Jun 2004 09:23:24 +0000 Subject: DRI XFree86-4_3_99_12-merge import --- man/mga.man | 8 ++-- src/binding.h | 2 +- src/mga.h | 32 +++++-------- src/mga_arc.c | 5 +- src/mga_common.h | 2 +- src/mga_dac3026.c | 17 +++---- src/mga_dacG.c | 38 +++++---------- src/mga_dga.c | 28 +---------- src/mga_dh.c | 12 +++-- src/mga_dri.c | 12 ++--- src/mga_dri.h | 2 +- src/mga_dripriv.h | 2 +- src/mga_driver.c | 138 ++++++++++++++++++++++++++++------------------------- src/mga_esc.c | 37 +++++++------- src/mga_g450pll.c | 11 ++++- src/mga_halmod.c | 4 +- src/mga_hwcurs.c | 2 +- src/mga_macros.h | 2 +- src/mga_map.h | 2 +- src/mga_merge.c | 7 ++- src/mga_reg.h | 2 +- src/mga_sarea.h | 2 +- src/mga_shadow.c | 2 +- src/mga_storm.c | 10 ++-- src/mga_video.c | 36 ++++---------- src/mgareg_flags.h | 2 +- util/README | 2 +- util/stormdwg.c | 2 +- 28 files changed, 185 insertions(+), 236 deletions(-) diff --git a/man/mga.man b/man/mga.man index be09143..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.7 2003/04/03 07:11:03 herrb 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__ @@ -14,7 +14,7 @@ mga \- Matrox video driver .fi .SH DESCRIPTION .B mga -is an __xservername__ driver for Matrox video cards. The driver is fully +is an XFree86 driver for Matrox video cards. The driver is fully accelerated, and provides support for the following framebuffer depths: 8, 15, 16, 24, and an 8+24 overlay mode. All visual types are supported for depth 8, and both TrueColor and DirectColor @@ -55,7 +55,7 @@ Millennium G200 and Mystique G200 .TP 12 .B G550 .SH CONFIGURATION DETAILS -Please refer to __xconfigfile__(__filemansuffix__) for general configuration +Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. .PP @@ -150,7 +150,7 @@ This option is only supported by the G200 and G400, and only in 16 and 32 bits per pixel. Default: off. .SH "SEE ALSO" -__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Authors include: Radoslaw Kapitan, Mark Vojkovich, and also David Dawes, Guy Desbief, Dirk Hohndel, Doug Merritt, Andrew E. Mileski, Andrew van der Stock, diff --git a/src/binding.h b/src/binding.h index 7fe7f68..f44de3e 100644 --- a/src/binding.h +++ b/src/binding.h @@ -13,7 +13,7 @@ @end ***************************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib/binding.h,v 1.3 2000/10/24 22:45:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib/binding.h,v 1.5 2000/12/06 20:39:52 dawes Exp $ */ #ifndef _BINDING #define _BINDING diff --git a/src/mga.h b/src/mga.h index 38bea3d..b61c501 100644 --- a/src/mga.h +++ b/src/mga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.87tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.86 2003/04/24 20:05:34 eich Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -99,23 +99,18 @@ typedef enum { #define OUTREG16(addr, val) MMIO_OUT16(pMga->IOBase, addr, val) #define OUTREG(addr, val) MMIO_OUT32(pMga->IOBase, addr, val) #else /* !EXTRADEBUG */ -CARD8 MGAdbg_inreg8(ScrnInfoPtr, int, int, char*); -CARD16 MGAdbg_inreg16(ScrnInfoPtr, int, int, char*); -CARD32 MGAdbg_inreg32(ScrnInfoPtr, int, int, char*); -void MGAdbg_outreg8(ScrnInfoPtr, int, int, char*); -void MGAdbg_outreg16(ScrnInfoPtr, int,int, char*); -void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*); -#ifndef __GNUC__ -# define MGA_STRINGIZE(x) #x -# define MGA_STRINGIFY(x) MGA_STRINGIZE(x) -# define __FUNCTION__ MGA_STRINGIFY(__FILE__) ", line " MGA_STRINGIFY(__LINE__) -#endif -#define INREG8(addr) MGAdbg_inreg8(pScrn, addr, 1, __FUNCTION__) -#define INREG16(addr) MGAdbg_inreg16(pScrn, addr, 1, __FUNCTION__) -#define INREG(addr) MGAdbg_inreg32(pScrn, addr, 1, __FUNCTION__) -#define OUTREG8(addr,val) MGAdbg_outreg8(pScrn, addr, val, __FUNCTION__) -#define OUTREG16(addr,val) MGAdbg_outreg16(pScrn, addr, val, __FUNCTION__) -#define OUTREG(addr,val) MGAdbg_outreg32(pScrn, addr, val, __FUNCTION__) +CARD8 dbg_inreg8(ScrnInfoPtr,int,int); +CARD16 dbg_inreg16(ScrnInfoPtr,int,int); +CARD32 dbg_inreg32(ScrnInfoPtr,int,int); +void dbg_outreg8(ScrnInfoPtr,int,int); +void dbg_outreg16(ScrnInfoPtr,int,int); +void dbg_outreg32(ScrnInfoPtr,int,int); +#define INREG8(addr) dbg_inreg8(pScrn,addr,1) +#define INREG16(addr) dbg_inreg16(pScrn,addr,1) +#define INREG(addr) dbg_inreg32(pScrn,addr,1) +#define OUTREG8(addr,val) dbg_outreg8(pScrn,addr,val) +#define OUTREG16(addr,val) dbg_outreg16(pScrn,addr,val) +#define OUTREG(addr,val) dbg_outreg32(pScrn,addr,val) #endif /* EXTRADEBUG */ /* @@ -217,7 +212,6 @@ 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 d282967..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.12tsi 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" @@ -70,8 +70,7 @@ MGAZeroArc( ){ int yoffset, dyoffset, x, y, a, b, d, mask, k1, k3, dx, dy, tmp; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - ScrnInfoPtr pScrn = infoRec->pScrn; - MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(infoRec->pScrn); miZeroArcRec info; Bool do360; DDXPointRec org, orgo; diff --git a/src/mga_common.h b/src/mga_common.h index 6a3a83d..90f6b37 100644 --- a/src/mga_common.h +++ b/src/mga_common.h @@ -25,7 +25,7 @@ * Converted to common header format: * Jens Owen * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h,v 1.1 2002/10/30 12:52:19 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_common.h,v 1.2 2002/12/16 16:19:18 dawes Exp $ * */ diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c index 7cbec19..220ef1a 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.58tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.56 2001/04/05 21:29:14 dawes Exp $ */ /* * Copyright 1994 by Robin Cutshaw * @@ -277,12 +277,16 @@ 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); - MGATi3026CalcClock(f_out, TI_MAX_MCLK_FREQ, &mclk_m, &mclk_n, &mclk_p); + f_pll = MGATi3026CalcClock( + f_out, TI_MAX_MCLK_FREQ, + & mclk_m, & mclk_n, & mclk_p + ); /* Save PCLK settings */ outTi3026( TVP3026_PLL_ADDR, 0, 0xfc ); @@ -984,8 +988,7 @@ MGA3026_ddc1Read(ScrnInfoPtr pScrn) static void MGA3026_I2CGetBits(I2CBusPtr b, int *clock, int *data) { - ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; - MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(xf86Screens[b->scrnIndex]); unsigned char val; /* Get the result. */ @@ -1006,8 +1009,7 @@ MGA3026_I2CGetBits(I2CBusPtr b, int *clock, int *data) static void MGA3026_I2CPutBits(I2CBusPtr b, int clock, int data) { - ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; - MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(xf86Screens[b->scrnIndex]); unsigned char val,drv; /* Write the values */ @@ -1077,8 +1079,7 @@ 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 0a3a7e2..00e6ce0 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.54tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.52 2003/04/24 20:05:34 eich Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -208,13 +208,16 @@ 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 */ - (void) MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s ); + f_pll = MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s ); /* Values for the pixel clock PLL registers */ pReg->DacRegs[ MGA1064_PIX_PLLC_M ] = m & 0x1F; @@ -244,7 +247,7 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* 0x48: */ 0, 0, 0, 0, 0, 0, 0, 0 }; - int i; + int i, weight555 = FALSE; int hd, hs, he, ht, vd, vs, ve, vt, wd; int BppShift; MGAPtr pMga; @@ -408,6 +411,7 @@ 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; @@ -548,14 +552,6 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) MGACRTC2GetPitch(pScrn, &ModeInfo); MGACRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0); } - -#if X_BYTE_ORDER == X_BIG_ENDIAN - /* Disable byte-swapping for big-endian architectures - the XFree - driver seems to like a little-endian framebuffer -ReneR */ - /* pReg->Option |= 0x80000000; */ - pReg->Option &= ~0x80000000; -#endif - return(TRUE); } @@ -678,14 +674,6 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, } if(!pMga->SecondCrtc) { - /* Do not set the memory config for primary cards as it - should be correct already. Only on little endian architectures - since we need to modify the byteswap bit. -ReneR */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - optionMask = OPTION1_MASK; -#else - optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; -#endif MGA_NOT_HAL( /* @@ -711,6 +699,10 @@ MGA_NOT_HAL( outMGAdac(i, mgaReg->DacRegs[i]); } + /* Do not set the memory config for primary cards as it + should be correct already */ + optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; + if (!MGAISGx50(pMga)) { /* restore pci_option register */ pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, @@ -951,7 +943,6 @@ MGAGSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) MGAPtr pMga = MGAPTR(pScrn); x += 64; y += 64; - #ifdef USEMGAHAL MGA_HAL( x += pMga->HALGranularityOffX; @@ -1046,8 +1037,7 @@ MGAG_ddc1Read(ScrnInfoPtr pScrn) static void MGAG_I2CGetBits(I2CBusPtr b, int *clock, int *data) { - ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; - MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(xf86Screens[b->scrnIndex]); unsigned char val; /* Get the result. */ @@ -1068,8 +1058,7 @@ MGAG_I2CGetBits(I2CBusPtr b, int *clock, int *data) static void MGAG_I2CPutBits(I2CBusPtr b, int clock, int data) { - ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; - MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(xf86Screens[b->scrnIndex]); unsigned char drv, val; val = (clock ? DDC_SCL_MASK : 0) | (data ? DDC_SDA_MASK : 0); @@ -1142,7 +1131,6 @@ 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 774aafd..d6735b1 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.14 1999/11/02 23:12:00 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dga.c,v 1.16 2002/09/16 18:05:55 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -264,30 +264,6 @@ 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, @@ -323,8 +299,6 @@ 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 db4f4f2..79c8510 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.4tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.4 2002/01/11 15:42:57 dawes Exp $ */ /********************************************************************* * G450: This is for Dual Head. * Matrox Graphics @@ -151,11 +151,13 @@ 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; @@ -179,6 +181,7 @@ 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; @@ -190,6 +193,7 @@ 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; @@ -281,7 +285,7 @@ void MGACRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { CARD8 ucByte, ucXDispCtrl; - CARD32 ulC2CTL; + CARD32 ulC2CTL, ulStatusReg; MGAPtr pMga = MGAPTR(pScrn); MGARegPtr pReg; pReg = &pMga->ModeReg; @@ -296,8 +300,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) */ - (void) INREG( MGAREG_Status); - (void) INREG( MGAREG_Status); + ulStatusReg = INREG( MGAREG_Status); + ulStatusReg = INREG( MGAREG_Status); ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK); diff --git a/src/mga_dri.c b/src/mga_dri.c index 755c0db..6f1fa75 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.31tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.29 2003/07/09 01:45:23 dawes Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -672,7 +672,7 @@ static Bool MGADRIAgpInit(ScreenPtr pScreen) return FALSE; } xf86DrvMsg( pScreen->myNum, X_INFO, - "[agp] %d kB allocated with handle 0x%08lx\n", + "[agp] %d kB allocated with handle 0x%08x\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", - (int)sizeof(XF86DRISAREARec), (int)sizeof(MGASAREAPrivRec), - (int)sizeof(XF86DRISAREARec) + (int)sizeof(MGASAREAPrivRec) ); + sizeof(XF86DRISAREARec), sizeof(MGASAREAPrivRec), + sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) ); pDRIInfo->SAREASize = SAREA_MAX; @@ -1389,10 +1389,10 @@ void MGADRICloseScreen( ScreenPtr pScreen ) pMGADRIServer->agpTextures.map = NULL; } - if ( pMGADRIServer->agp.handle != DRM_AGP_NO_HANDLE ) { + if ( pMGADRIServer->agp.handle ) { drmAgpUnbind( pMga->drmFD, pMGADRIServer->agp.handle ); drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle ); - pMGADRIServer->agp.handle = DRM_AGP_NO_HANDLE; + pMGADRIServer->agp.handle = 0; drmAgpRelease( pMga->drmFD ); } diff --git a/src/mga_dri.h b/src/mga_dri.h index fdd1272..b9ed1c2 100644 --- a/src/mga_dri.h +++ b/src/mga_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.6 2001/04/10 16:08:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.8 2002/11/29 11:06:42 eich Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. diff --git a/src/mga_dripriv.h b/src/mga_dripriv.h index ddd3aa7..3ddd133 100644 --- a/src/mga_dripriv.h +++ b/src/mga_dripriv.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.4 2001/04/10 16:08:01 dawes Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. diff --git a/src/mga_driver.c b/src/mga_driver.c index 3bc5ff4..36d4d22 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.244tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.236 2003/08/23 15:03:02 dawes 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 ModeStatus MGAValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); +static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, + int flags); /* Internally used functions */ static Bool MGAMapMem(ScrnInfoPtr pScrn); @@ -134,7 +134,7 @@ static void MGASave(ScrnInfoPtr pScrn); static void MGARestore(ScrnInfoPtr pScrn); static Bool MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void MGABlockHandler(int, pointer, pointer, pointer); -static void MGAG100BlackMagic(ScrnInfoPtr pScrn); +static void MGAG100BlackMagic(MGAPtr pMga); static int MGAEntityIndex = -1; @@ -272,8 +272,10 @@ static const char *xaaSymbols[] = { "XAACreateInfoRec", "XAADestroyInfoRec", "XAAFallbackOps", + "XAAFillSolidRects", "XAAInit", "XAAMoveDWORDS", + "XAAScreenIndex", "XAA_888_plus_PICT_a8_to_8888", NULL }; @@ -285,6 +287,7 @@ static const char *ramdacSymbols[] = { NULL }; +#ifdef XFree86LOADER #ifdef XF86DRI static const char *drmSymbols[] = { "drmAddBufs", @@ -300,7 +303,9 @@ static const char *drmSymbols[] = { "drmAgpUnbind", "drmAgpVendorId", "drmCommandNone", + "drmCommandRead", "drmCommandWrite", + "drmCommandWriteRead", "drmCtlInstHandler", "drmCtlUninstHandler", "drmFreeVersion", @@ -328,6 +333,7 @@ static const char *driSymbols[] = { NULL }; #endif +#endif #define MGAuseI2C 1 @@ -413,7 +419,7 @@ static XF86ModuleVersionInfo mgaVersRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XORG_VERSION_CURRENT, + XF86_VERSION_CURRENT, MGA_MAJOR_VERSION, MGA_MINOR_VERSION, MGA_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, @@ -926,7 +932,7 @@ MGACountRam(ScrnInfoPtr pScrn) return 16384; } } - ProbeSize = 8192; + ProbeSize = 16384; break; case PCI_CHIP_MGAG100: case PCI_CHIP_MGAG100_PCI: @@ -954,14 +960,11 @@ MGACountRam(ScrnInfoPtr pScrn) tmp = INREG8(MGAREG_CRTCEXT_DATA); OUTREG8(MGAREG_CRTCEXT_DATA, tmp | 0x80); - /* write, read and compare method - split into two loops to make it more reliable on RS/6k -ReneR */ + /* write, read and compare method */ for(i = ProbeSize; i > 2048; i -= 2048) { base[(i * 1024) - 1] = 0xAA; - } - OUTREG8(MGAREG_CRTC_INDEX, 0); /* flush the cache */ - usleep(4); /* twart write combination */ - for(i = ProbeSize; i > 2048; i -= 2048) { + OUTREG8(MGAREG_CRTC_INDEX, 0); /* flush the cache */ + usleep(1); /* twart write combination */ if(base[(i * 1024) - 1] == 0xAA) { SizeFound = i; break; @@ -982,10 +985,12 @@ 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,8 +1057,7 @@ 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", - (void *)MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", MonInfo); xf86PrintEDID(MonInfo); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n"); } @@ -1064,8 +1068,7 @@ MGAdoDDC(ScrnInfoPtr pScrn) MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, pMga->DDC1SetSpeed, pMga->ddc1Read ) ; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", - (void *)MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", MonInfo); xf86PrintEDID( MonInfo ); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n"); } @@ -1077,8 +1080,7 @@ MGAdoDDC(ScrnInfoPtr pScrn) vbeFree(pVbe); if (MonInfo){ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBE DDC Monitor info: %p\n", - (void *)MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBE DDC Monitor info: %p\n", MonInfo); xf86PrintEDID( MonInfo ); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of VBE DDC Monitor info\n\n"); } @@ -1265,7 +1267,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->Access.AccessDisable = VgaIODisable; pMga->Access.AccessEnable = VgaIOEnable; pMga->Access.arg = pMga; - xf86SetAccessFuncs(pMga->pEnt, &pMga->Access, &pMga->Access); + /* please check if this is correct. I've impiled that the VGA fb + is handled locally and not visible outside. If the VGA fb is + handeled by the same function the third argument has to be set, + too.*/ + xf86SetAccessFuncs(pMga->pEnt, &pMga->Access, &pMga->Access, + &pMga->Access, NULL); #endif /* Set pScrn->monitor */ @@ -1762,9 +1769,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } pMga->IOAddress = pMga->device->IOBase; from = X_CONFIG; - } else -#endif - { + } else { /* details: mgabase1 sdk pp 4-11 */ int i = ((pMga->Chipset == PCI_CHIP_MGA1064 && pMga->ChipRev < 3) || pMga->Chipset == PCI_CHIP_MGA2064) ? 0 : 1; @@ -1778,6 +1783,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } } +#else + pMga->IOAddress = pMga->PciInfo->memBase[0]; +#endif xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pMga->IOAddress); @@ -2400,14 +2408,6 @@ 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; @@ -2503,6 +2503,7 @@ MGAMapMem(ScrnInfoPtr pScrn) pMga->FbStart = pMga->FbBase + pMga->YDstOrg * (pScrn->bitsPerPixel / 8); + /* Map the ILOAD transfer window if there is one. We only make DWORD access on DWORD boundaries to this window */ if (pMga->ILOADAddress) { @@ -3070,7 +3071,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if ((pMga->Chipset == PCI_CHIP_MGAG100) || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) - MGAG100BlackMagic(pScrn); + MGAG100BlackMagic(pMga); if (pMga->DualHeadEnabled) { DevUnion *pPriv; @@ -3497,6 +3498,9 @@ MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) FILE* fdOut; # endif #endif + MGAPtr pMga; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + pMga = MGAPTR(pScrn); if (mode->Flags & 0x80000000) { #ifdef USEMGAHAL @@ -3508,7 +3512,6 @@ MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) # define MWB(x) # define MWB_COND(x) 1 # endif - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; MGA_HAL( fdIn = fopen("/tmp/mgaDriverIn", "rt"); @@ -3914,7 +3917,7 @@ MGAFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -static ModeStatus +static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { int lace; @@ -4055,88 +4058,96 @@ MGABlockHandler ( (*pMga->RenderCallback)(pScrn); } -#if defined (EXTRADEBUG) +#if defined (DEBUG) /* * some functions to track input/output in the server */ CARD8 -MGAdbg_inreg8(ScrnInfoPtr pScrn,int addr,int verbose, char* func) +dbg_inreg8(ScrnInfoPtr pScrn,int addr,int verbose) { + MGAPtr pMga; CARD8 ret; - ret = MMIO_IN8(MGAPTR(pScrn)->IOBase,addr); + pMga = MGAPTR(pScrn); + ret = *(volatile CARD8 *)(pMga->IOBase + (addr)); if(verbose) xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "inreg8 : %s: 0x%8x = 0x%x\n",func, addr,ret); + "inreg8 : 0x%8x = 0x%x\n",addr,ret); return ret; } CARD16 -MGAdbg_inreg16(ScrnInfoPtr pScrn,int addr,int verbose, char* func) +dbg_inreg16(ScrnInfoPtr pScrn,int addr,int verbose) { + MGAPtr pMga; CARD16 ret; - ret = MMIO_IN16(MGAPTR(pScrn)->IOBase,addr); + pMga = MGAPTR(pScrn); + ret = *(volatile CARD16 *)(pMga->IOBase + (addr)); if(verbose) xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "inreg16: %s: 0x%8x = 0x%x\n",func, addr,ret); + "inreg16: 0x%8x = 0x%x\n",addr,ret); return ret; } CARD32 -MGAdbg_inreg32(ScrnInfoPtr pScrn,int addr,int verbose, char* func) +dbg_inreg32(ScrnInfoPtr pScrn,int addr,int verbose) { + MGAPtr pMga; CARD32 ret; - ret = MMIO_IN32(MGAPTR(pScrn)->IOBase,addr); + pMga = MGAPTR(pScrn); + ret = *(volatile CARD32 *)(pMga->IOBase + (addr)); if(verbose) xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "inreg32: %s: 0x%8x = 0x%x\n",func, addr,ret); + "inreg32: 0x%8x = 0x%x\n",addr,ret); return ret; } void -MGAdbg_outreg8(ScrnInfoPtr pScrn,int addr,int val, char* func) +dbg_outreg8(ScrnInfoPtr pScrn,int addr,int val) { + MGAPtr pMga; CARD8 ret; + pMga = MGAPTR(pScrn); #if 0 if( addr = MGAREG_CRTCEXT_DATA ) return; #endif if( addr != 0x3c00 ) { - ret = MGAdbg_inreg8(pScrn,addr,0,func); + ret = dbg_inreg8(pScrn,addr,0); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "outreg8 : %s: 0x%8x = 0x%x was 0x%x\n", - func,addr,val,ret); + "outreg8 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg8 : %s: index 0x%x\n", - func,val); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg8 : index 0x%x\n",val); } - MMIO_OUT8(MGAPTR(pScrn)->IOBase,addr,val); + *(volatile CARD8 *)(pMga->IOBase + (addr)) = (val); } void -MGAdbg_outreg16(ScrnInfoPtr pScrn,int addr,int val, char* func) +dbg_outreg16(ScrnInfoPtr pScrn,int addr,int val) { + MGAPtr pMga; CARD16 ret; #if 0 if (addr == MGAREG_CRTCEXT_INDEX) return; #endif - ret = MGAdbg_inreg16(pScrn,addr,0, func); + pMga = MGAPTR(pScrn); + ret = dbg_inreg16(pScrn,addr,0); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "outreg16: %s: 0x%8x = 0x%x was 0x%x\n", - func,addr,val,ret); - MMIO_OUT16(MGAPTR(pScrn)->IOBase,addr,val); + "outreg16 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); + *(volatile CARD16 *)(pMga->IOBase + (addr)) = (val); } void -MGAdbg_outreg32(ScrnInfoPtr pScrn,int addr,int val, char* func) +dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val) { + MGAPtr pMga; CARD32 ret; if (((addr & 0xff00) == 0x1c00) @@ -4150,23 +4161,20 @@ MGAdbg_outreg32(ScrnInfoPtr pScrn,int addr,int val, char* func) && (addr != 0x1c98) && (addr != 0x1c9c) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: refused address 0x%x\n", - func,addr); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "refused address 0x%x\n",addr); return; } - ret = MGAdbg_inreg32(pScrn,addr,0, func); + pMga = MGAPTR(pScrn); + ret = dbg_inreg32(pScrn,addr,0); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "outreg32: %s: 0x%8x = 0x%x was 0x%x\n", - func,addr,val,ret); - MMIO_OUT32(MGAPTR(pScrn)->IOBase,addr,val); + "outreg32 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); + *(volatile CARD32 *)(pMga->IOBase + (addr)) = (val); } #endif /* DEBUG */ static void -MGAG100BlackMagic(ScrnInfoPtr pScrn) +MGAG100BlackMagic(MGAPtr pMga) { - MGAPtr pMga = MGAPTR(pScrn); - OUTREG(MGAREG_PLNWT, ~(CARD32)0x0); /* reset memory */ OUTREG(MGAREG_MACCESS, 1<<15); diff --git a/src/mga_esc.c b/src/mga_esc.c index 2478184..dc0b7b3 100644 --- a/src/mga_esc.c +++ b/src/mga_esc.c @@ -1,4 +1,3 @@ -/* $XFree86$ */ /**************************************************************************** * mga_esc.c * @@ -217,23 +216,23 @@ static void EscRead(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, Dis break; case 1: ucIndex = INREG8(0x3c00); - OUTREG8(0x3c00, (UCHAR)ulAddr); + OUTREG(0x3c00, (UCHAR)ulAddr); ulData = (ULONG)INREG8(0x3c0a); - OUTREG8(0x3c00, ucIndex); + OUTREG(0x3c00, ucIndex); sprintf(sResult, "DAC[%02X] = 0x%02X", ulAddr, ulData); break; case 2: ucIndex = INREG8(0x1fd4); - OUTREG8(0x1fd4, (UCHAR)ulAddr); + OUTREG(0x1fd4, (UCHAR)ulAddr); ulData = (ULONG)INREG8(0x1fd5); - OUTREG8(0x1fd4, ucIndex); + OUTREG(0x1fd4, ucIndex); sprintf(sResult, "CRTC[%02X] = 0x%02X", ulAddr, ulData); break; case 3: ucIndex = INREG8(0x1fde); - OUTREG8(0x1fde, (UCHAR)ulAddr); + OUTREG(0x1fde, (UCHAR)ulAddr); ulData = (ULONG)INREG8(0x1fdf); - OUTREG8(0x1fde, ucIndex); + OUTREG(0x1fde, ucIndex); sprintf(sResult, "CRTCEXT[%02X] = 0x%02X", ulAddr, ulData); break; default: @@ -267,23 +266,23 @@ static void EscWrite(ScrnInfoPtr pScrn, unsigned long *param, char *sResult, Di break; case 1: ucIndex = INREG8(0x3c00); - OUTREG8(0x3c00, (UCHAR)ulAddr); - OUTREG8(0x3c0a, (UCHAR)ulData); - OUTREG8(0x3c00, ucIndex); + OUTREG(0x3c00, (UCHAR)ulAddr); + OUTREG(0x3c0a, (UCHAR)ulData); + OUTREG(0x3c00, ucIndex); strcpy(sResult, "OK"); break; case 2: ucIndex = INREG8(0x1fd4); - OUTREG8(0x1fd4, (UCHAR)ulAddr); - OUTREG8(0x1fd5, (UCHAR)ulData); - OUTREG8(0x1fd4, ucIndex); + OUTREG(0x1fd4, (UCHAR)ulAddr); + OUTREG(0x1fd5, (UCHAR)ulData); + OUTREG(0x1fd4, ucIndex); strcpy(sResult, "OK"); break; case 3: ucIndex = INREG8(0x1fde); - OUTREG8(0x1fde, (UCHAR)ulAddr); - OUTREG8(0x1fdf, (UCHAR)ulData); - OUTREG8(0x1fde, ucIndex); + OUTREG(0x1fde, (UCHAR)ulAddr); + OUTREG(0x1fdf, (UCHAR)ulData); + OUTREG(0x1fde, ucIndex); strcpy(sResult, "OK"); break; default: @@ -753,13 +752,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) ) { @@ -774,7 +773,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 526d859..6176549 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.8tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.8 2002/09/16 18:05:56 eich Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -43,10 +43,11 @@ static CARD32 G450RemovePFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn) static CARD32 G450CalculVCO(ScrnInfoPtr pScrn, CARD32 ulMNP, CARD32 *pulF) { - CARD8 ucM, ucN; + CARD8 ucM, ucN, ucP; ucM = (CARD8)((ulMNP >> 16) & 0xff); ucN = (CARD8)((ulMNP >> 8) & 0xff); + ucP = (CARD8)(ulMNP & 0x03); *pulF = (27000 * (2 * (ucN + 2)) + ((ucM + 1) >> 1)) / (ucM + 1); @@ -192,6 +193,9 @@ 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)); @@ -208,8 +212,11 @@ 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_halmod.c b/src/mga_halmod.c index 61ef298..4308f85 100644 --- a/src/mga_halmod.c +++ b/src/mga_halmod.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_halmod.c,v 1.1 2000/12/06 15:35:21 eich Exp $ */ #include "xf86Module.h" #ifdef XFree86LOADER @@ -15,7 +15,7 @@ static XF86ModuleVersionInfo halVersRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XORG_VERSION_CURRENT, + XF86_VERSION_CURRENT, HAL_MAJOR_VERSION, HAL_MINOR_VERSION, HAL_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, diff --git a/src/mga_hwcurs.c b/src/mga_hwcurs.c index 50da1c5..8b4e66b 100644 --- a/src/mga_hwcurs.c +++ b/src/mga_hwcurs.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_hwcurs.c,v 1.8tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_hwcurs.c,v 1.9 1999/03/14 03:22:00 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/mga_macros.h b/src/mga_macros.h index 9515879..d985081 100644 --- a/src/mga_macros.h +++ b/src/mga_macros.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.21 2001/09/26 12:59:17 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.22 2002/02/20 17:17:50 dawes Exp $ */ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ diff --git a/src/mga_map.h b/src/mga_map.h index 323e2a9..b41ca69 100644 --- a/src/mga_map.h +++ b/src/mga_map.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h,v 1.1 1997/03/06 23:16:01 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_map.h,v 1.2 2001/07/25 15:05:06 dawes Exp $ */ #if !defined(UNIXCPP) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname diff --git a/src/mga_merge.c b/src/mga_merge.c index b06466c..986b0cb 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.4 2003/09/24 02:43:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_merge.c,v 1.3 2003/08/23 15:03:03 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", mode1->name); + "Skipping clone mode \"%s\".\n"); mode1 = NULL; } else { result = CopyModeNLink(pScrn,result,mode1,mode2,sr); @@ -428,8 +428,7 @@ MGAPreInitMergedFB(ScrnInfoPtr pScrn1, int flags) pMga->MinClock / 1000); /* Override on 2nd crtc */ - if (pMga->ChipRev >= 0x80 || (pMga->Chipset == PCI_CHIP_MGAG550)) { - /* G450, G550 */ + if (pMga->ChipRev >= 0x80) { /* G450 */ pMga->MaxClock = 234000; } else { pMga->MaxClock = 135000; diff --git a/src/mga_reg.h b/src/mga_reg.h index c5fe9c3..0d6a20b 100644 --- a/src/mga_reg.h +++ b/src/mga_reg.h @@ -2,7 +2,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.17 2001/04/25 14:23:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.18 2001/09/26 12:59:18 alanh Exp $ */ diff --git a/src/mga_sarea.h b/src/mga_sarea.h index cb1c3e9..616dee5 100644 --- a/src/mga_sarea.h +++ b/src/mga_sarea.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h,v 1.1 2001/03/21 17:11:47 dawes Exp $ */ /* * Copyright 2000 Gareth Hughes diff --git a/src/mga_shadow.c b/src/mga_shadow.c index c3d8eea..b1c228b 100644 --- a/src/mga_shadow.c +++ b/src/mga_shadow.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_shadow.c,v 1.1 1999/08/14 10:49:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_shadow.c,v 1.3 2000/02/08 13:13:18 eich Exp $ */ /* Copyright (c) 1999, The XFree86 Project Inc. diff --git a/src/mga_storm.c b/src/mga_storm.c index aa14f6f..ff083ac 100644 --- a/src/mga_storm.c +++ b/src/mga_storm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.99tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.98 2003/01/16 16:09:10 eich Exp $ */ /* All drivers should typically include these */ @@ -1076,9 +1076,7 @@ MGAStormSync(ScrnInfoPtr pScrn) CHECK_DMA_QUIESCENT(pMga, pScrn); - /* This reportedly causes a freeze for the Mystique. */ - if (pMga->Chipset != PCI_CHIP_MGA1064) - while(MGAISBUSY()); + while(MGAISBUSY()); /* flush cache before a read (mga-1064g 5.1.6) */ OUTREG8(MGAREG_CRTC_INDEX, 0); if(pMga->AccelFlags & CLIPPER_ON) { @@ -2361,7 +2359,6 @@ MGAPolyPoint ( BoxPtr pbox; MGAPtr pMga; int xorg, yorg; - ScrnInfoPtr pScrn; if(!numRects) return; @@ -2371,8 +2368,7 @@ MGAPolyPoint ( } infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - pScrn = infoRec->pScrn; - pMga = MGAPTR(pScrn); + pMga = MGAPTR(infoRec->pScrn); xorg = pDraw->x; yorg = pDraw->y; diff --git a/src/mga_video.c b/src/mga_video.c index 4b4afba..d96d53d 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.33tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.30 2003/04/23 21:51:39 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -268,7 +268,7 @@ MGASetupImageVideoOverlay(ScreenPtr pScreen) adapt->QueryImageAttributes = MGAQueryImageAttributes; /* gotta uninit this someplace */ - REGION_NULL(pScreen, &(pMga->portPrivate->clip)); + REGION_INIT(pScreen, &(pMga->portPrivate->clip), NullBox, 0); MGAResetVideoOverlay(pScrn); @@ -460,7 +460,6 @@ MGACopyData( ){ w <<= 1; while(h--) { - /* XXX Maybe this one needs big-endian fixes, too? -ReneR */ memcpy(dst, src, w); src += srcPitch; dst += dstPitch; @@ -490,27 +489,16 @@ MGACopyMungedData( s1 = src1; s2 = src2; s3 = src3; i = w; while(i > 4) { -#if X_BYTE_ORDER == X_LITTLE_ENDIAN dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); -#else - dst[0] = (s1[0] << 16) | s1[1] | (s3[0] << 24) | (s2[0] << 8); - dst[1] = (s1[2] << 16) | s1[3] | (s3[1] << 24) | (s2[1] << 8); - dst[2] = (s1[4] << 16) | s1[5] | (s3[2] << 24) | (s2[2] << 8); - dst[3] = (s1[6] << 16) | s1[7] | (s3[3] << 24) | (s2[3] << 8); -#endif dst += 4; s2 += 4; s3 += 4; s1 += 8; i -= 4; } while(i--) { -#if X_BYTE_ORDER == X_LITTLE_ENDIAN dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); -#else - dst[0] = (s1[0] << 16) | s1[1] | (s3[0] << 24) | (s2[0] << 8); -#endif dst++; s2++; s3++; s1 += 2; } @@ -580,7 +568,6 @@ MGADisplayVideoOverlay( ){ MGAPtr pMga = MGAPTR(pScrn); int tmp, hzoom, intrep; - int maxOverlayClock; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -594,15 +581,7 @@ MGADisplayVideoOverlay( tmp = pScrn->currentMode->VDisplay +1; /* enable accelerated 2x horizontal zoom when pixelclock >135MHz */ - - if ((pMga->ChipRev >= 0x80) || (pMga->Chipset == PCI_CHIP_MGAG550)) { - /* G450, G550 */ - maxOverlayClock = 234000; - } else { - maxOverlayClock = 135000; - } - - hzoom = (pScrn->currentMode->Clock > maxOverlayClock) ? 1 : 0; + hzoom = (pScrn->currentMode->Clock > 135000) ? 1 : 0; switch(id) { case FOURCC_UYVY: @@ -750,7 +729,7 @@ MGAPutImage( MGAPortPrivPtr pPriv = pMga->portPrivate; INT32 x1, x2, y1, y2; unsigned char *dst_start; - int new_size, offset, offset2 = 0, offset3 = 0; + int pitch, new_size, offset, offset2 = 0, offset3 = 0; int srcPitch, srcPitch2 = 0, dstPitch; int top, left, npixels, nlines, bpp; BoxRec dstBox; @@ -779,6 +758,7 @@ MGAPutImage( } bpp = pScrn->bitsPerPixel >> 3; + pitch = bpp * pScrn->displayWidth; dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; @@ -968,7 +948,7 @@ MGAAllocateSurface( XF86SurfacePtr surface ){ FBLinearPtr linear; - int pitch, size, bpp; + int pitch, fbpitch, size, bpp; OffscreenPrivPtr pPriv; if((w > 1024) || (h > 1024)) @@ -977,6 +957,7 @@ 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))) @@ -1020,8 +1001,7 @@ MGAStopSurface( OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; if(pPriv->isOn) { - ScrnInfoPtr pScrn = surface->pScrn; - MGAPtr pMga = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(surface->pScrn); OUTREG(MGAREG_BESCTL, 0); pPriv->isOn = FALSE; } diff --git a/src/mgareg_flags.h b/src/mgareg_flags.h index f45afbf..69050fc 100644 --- a/src/mgareg_flags.h +++ b/src/mgareg_flags.h @@ -19,7 +19,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mgareg_flags.h,v 1.2 2003/01/12 03:55:47 tsi Exp $ */ #ifndef _MGAREGS_H_ #define _MGAREGS_H_ diff --git a/util/README b/util/README index e4863ff..9a87e53 100644 --- a/util/README +++ b/util/README @@ -22,4 +22,4 @@ ajv@greebo.net -$XFree86: $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/util/README,v 1.2 1999/11/19 13:54:41 hohndel Exp $ diff --git a/util/stormdwg.c b/util/stormdwg.c index d3707bc..e13916c 100644 --- a/util/stormdwg.c +++ b/util/stormdwg.c @@ -2,7 +2,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/dwg.c,v 1.1 1997/03/06 23:15:58 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/util/stormdwg.c,v 1.1 1997/04/12 14:11:29 hohndel Exp $ */ #include /* #include */ -- cgit v1.2.3