summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mga_dri.c8
-rw-r--r--src/mga_dri.h2
-rw-r--r--src/mga_driver.c138
-rw-r--r--src/mga_sarea.h2
4 files changed, 71 insertions, 79 deletions
diff --git a/src/mga_dri.c b/src/mga_dri.c
index e429027..a943b6b 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.29 2003/07/09 01:45:23 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.31tsi Exp $ */
/*
* Copyright 2000 VA Linux Systems Inc., Fremont, California.
@@ -673,7 +673,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 ) {
@@ -1083,8 +1083,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;
diff --git a/src/mga_dri.h b/src/mga_dri.h
index 5785a34..6d2addc 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.8 2002/11/29 11:06:42 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.6 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 27bb481..829cb91 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.236 2003/08/23 15:03:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.244tsi 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);
@@ -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(MGAPtr pMga);
+static void MGAG100BlackMagic(ScrnInfoPtr pScrn);
static int MGAEntityIndex = -1;
@@ -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",
@@ -303,9 +300,7 @@ static const char *drmSymbols[] = {
"drmAgpUnbind",
"drmAgpVendorId",
"drmCommandNone",
- "drmCommandRead",
"drmCommandWrite",
- "drmCommandWriteRead",
"drmCtlInstHandler",
"drmCtlUninstHandler",
"drmFreeVersion",
@@ -334,7 +329,6 @@ static const char *driSymbols[] = {
NULL
};
#endif
-#endif
#define MGAuseI2C 1
@@ -420,7 +414,7 @@ static XF86ModuleVersionInfo mgaVersRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
- XF86_VERSION_CURRENT,
+ XORG_VERSION_CURRENT,
MGA_MAJOR_VERSION, MGA_MINOR_VERSION, MGA_PATCHLEVEL,
ABI_CLASS_VIDEODRV, /* This is a video driver */
ABI_VIDEODRV_VERSION,
@@ -933,7 +927,7 @@ MGACountRam(ScrnInfoPtr pScrn)
return 16384;
}
}
- ProbeSize = 16384;
+ ProbeSize = 8192;
break;
case PCI_CHIP_MGAG100:
case PCI_CHIP_MGAG100_PCI:
@@ -961,11 +955,14 @@ MGACountRam(ScrnInfoPtr pScrn)
tmp = INREG8(MGAREG_CRTCEXT_DATA);
OUTREG8(MGAREG_CRTCEXT_DATA, tmp | 0x80);
- /* write, read and compare method */
+ /* write, read and compare method
+ split into two loops to make it more reliable on RS/6k -ReneR */
for(i = ProbeSize; i > 2048; i -= 2048) {
base[(i * 1024) - 1] = 0xAA;
- OUTREG8(MGAREG_CRTC_INDEX, 0); /* flush the cache */
- usleep(1); /* twart write combination */
+ }
+ OUTREG8(MGAREG_CRTC_INDEX, 0); /* flush the cache */
+ usleep(4); /* twart write combination */
+ for(i = ProbeSize; i > 2048; i -= 2048) {
if(base[(i * 1024) - 1] == 0xAA) {
SizeFound = i;
break;
@@ -986,12 +983,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 */
@@ -1058,7 +1053,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");
}
@@ -1069,7 +1065,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");
}
@@ -1081,7 +1078,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");
}
@@ -1268,12 +1266,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pMga->Access.AccessDisable = VgaIODisable;
pMga->Access.AccessEnable = VgaIOEnable;
pMga->Access.arg = pMga;
- /* 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);
+ xf86SetAccessFuncs(pMga->pEnt, &pMga->Access, &pMga->Access);
#endif
/* Set pScrn->monitor */
@@ -1770,7 +1763,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
}
pMga->IOAddress = pMga->device->IOBase;
from = X_CONFIG;
- } else {
+ } else
+#endif
+ {
/* details: mgabase1 sdk pp 4-11 */
int i = ((pMga->Chipset == PCI_CHIP_MGA1064 && pMga->ChipRev < 3) ||
pMga->Chipset == PCI_CHIP_MGA2064) ? 0 : 1;
@@ -1784,9 +1779,6 @@ 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);
@@ -2409,6 +2401,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;
@@ -2504,7 +2504,6 @@ 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) {
@@ -3072,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(pMga);
+ MGAG100BlackMagic(pScrn);
if (pMga->DualHeadEnabled) {
DevUnion *pPriv;
@@ -3499,9 +3498,6 @@ 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
@@ -3513,6 +3509,7 @@ 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");
@@ -3918,7 +3915,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;
@@ -4059,96 +4056,88 @@ MGABlockHandler (
(*pMga->RenderCallback)(pScrn);
}
-#if defined (DEBUG)
+#if defined (EXTRADEBUG)
/*
* some functions to track input/output in the server
*/
CARD8
-dbg_inreg8(ScrnInfoPtr pScrn,int addr,int verbose)
+MGAdbg_inreg8(ScrnInfoPtr pScrn,int addr,int verbose, char* func)
{
- MGAPtr pMga;
CARD8 ret;
- pMga = MGAPTR(pScrn);
- ret = *(volatile CARD8 *)(pMga->IOBase + (addr));
+ ret = MMIO_IN8(MGAPTR(pScrn)->IOBase,addr);
if(verbose)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "inreg8 : 0x%8x = 0x%x\n",addr,ret);
+ "inreg8 : %s: 0x%8x = 0x%x\n",func, addr,ret);
return ret;
}
CARD16
-dbg_inreg16(ScrnInfoPtr pScrn,int addr,int verbose)
+MGAdbg_inreg16(ScrnInfoPtr pScrn,int addr,int verbose, char* func)
{
- MGAPtr pMga;
CARD16 ret;
- pMga = MGAPTR(pScrn);
- ret = *(volatile CARD16 *)(pMga->IOBase + (addr));
+ ret = MMIO_IN16(MGAPTR(pScrn)->IOBase,addr);
if(verbose)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "inreg16: 0x%8x = 0x%x\n",addr,ret);
+ "inreg16: %s: 0x%8x = 0x%x\n",func, addr,ret);
return ret;
}
CARD32
-dbg_inreg32(ScrnInfoPtr pScrn,int addr,int verbose)
+MGAdbg_inreg32(ScrnInfoPtr pScrn,int addr,int verbose, char* func)
{
- MGAPtr pMga;
CARD32 ret;
- pMga = MGAPTR(pScrn);
- ret = *(volatile CARD32 *)(pMga->IOBase + (addr));
+ ret = MMIO_IN32(MGAPTR(pScrn)->IOBase,addr);
if(verbose)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "inreg32: 0x%8x = 0x%x\n",addr,ret);
+ "inreg32: %s: 0x%8x = 0x%x\n",func, addr,ret);
return ret;
}
void
-dbg_outreg8(ScrnInfoPtr pScrn,int addr,int val)
+MGAdbg_outreg8(ScrnInfoPtr pScrn,int addr,int val, char* func)
{
- MGAPtr pMga;
CARD8 ret;
- pMga = MGAPTR(pScrn);
#if 0
if( addr = MGAREG_CRTCEXT_DATA )
return;
#endif
if( addr != 0x3c00 ) {
- ret = dbg_inreg8(pScrn,addr,0);
+ ret = MGAdbg_inreg8(pScrn,addr,0,func);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "outreg8 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret);
+ "outreg8 : %s: 0x%8x = 0x%x was 0x%x\n",
+ func,addr,val,ret);
}
else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg8 : index 0x%x\n",val);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg8 : %s: index 0x%x\n",
+ func,val);
}
- *(volatile CARD8 *)(pMga->IOBase + (addr)) = (val);
+ MMIO_OUT8(MGAPTR(pScrn)->IOBase,addr,val);
}
void
-dbg_outreg16(ScrnInfoPtr pScrn,int addr,int val)
+MGAdbg_outreg16(ScrnInfoPtr pScrn,int addr,int val, char* func)
{
- MGAPtr pMga;
CARD16 ret;
#if 0
if (addr == MGAREG_CRTCEXT_INDEX)
return;
#endif
- pMga = MGAPTR(pScrn);
- ret = dbg_inreg16(pScrn,addr,0);
+ ret = MGAdbg_inreg16(pScrn,addr,0, func);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "outreg16 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret);
- *(volatile CARD16 *)(pMga->IOBase + (addr)) = (val);
+ "outreg16: %s: 0x%8x = 0x%x was 0x%x\n",
+ func,addr,val,ret);
+ MMIO_OUT16(MGAPTR(pScrn)->IOBase,addr,val);
}
void
-dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val)
+MGAdbg_outreg32(ScrnInfoPtr pScrn,int addr,int val, char* func)
{
- MGAPtr pMga;
CARD32 ret;
if (((addr & 0xff00) == 0x1c00)
@@ -4162,20 +4151,23 @@ dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val)
&& (addr != 0x1c98)
&& (addr != 0x1c9c)
) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "refused address 0x%x\n",addr);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: refused address 0x%x\n",
+ func,addr);
return;
}
- pMga = MGAPTR(pScrn);
- ret = dbg_inreg32(pScrn,addr,0);
+ ret = MGAdbg_inreg32(pScrn,addr,0, func);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "outreg32 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret);
- *(volatile CARD32 *)(pMga->IOBase + (addr)) = (val);
+ "outreg32: %s: 0x%8x = 0x%x was 0x%x\n",
+ func,addr,val,ret);
+ MMIO_OUT32(MGAPTR(pScrn)->IOBase,addr,val);
}
#endif /* DEBUG */
static void
-MGAG100BlackMagic(MGAPtr pMga)
+MGAG100BlackMagic(ScrnInfoPtr pScrn)
{
+ MGAPtr pMga = MGAPTR(pScrn);
+
OUTREG(MGAREG_PLNWT, ~(CARD32)0x0);
/* reset memory */
OUTREG(MGAREG_MACCESS, 1<<15);
diff --git a/src/mga_sarea.h b/src/mga_sarea.h
index c124747..c5ffbbc 100644
--- a/src/mga_sarea.h
+++ b/src/mga_sarea.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h,v 1.1 2001/03/21 17:11:47 dawes Exp $ */
+/* $XFree86$ */
/*
* Copyright 2000 Gareth Hughes