diff options
Diffstat (limited to 'driver/xf86-video-tdfx/src/tdfx_driver.c')
-rw-r--r-- | driver/xf86-video-tdfx/src/tdfx_driver.c | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/driver/xf86-video-tdfx/src/tdfx_driver.c b/driver/xf86-video-tdfx/src/tdfx_driver.c index 94cce0423..ddd54311c 100644 --- a/driver/xf86-video-tdfx/src/tdfx_driver.c +++ b/driver/xf86-video-tdfx/src/tdfx_driver.c @@ -124,28 +124,28 @@ static Bool TDFXProbe(DriverPtr drv, int flags); static Bool TDFXPreInit(ScrnInfoPtr pScrn, int flags); /* Initialize a screen */ -static Bool TDFXScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); +static Bool TDFXScreenInit(SCREEN_INIT_ARGS_DECL); /* Enter from a virtual terminal */ -static Bool TDFXEnterVT(int scrnIndex, int flags); +static Bool TDFXEnterVT(VT_FUNC_ARGS_DECL); /* Leave to a virtual terminal */ -static void TDFXLeaveVT(int scrnIndex, int flags); +static void TDFXLeaveVT(VT_FUNC_ARGS_DECL); /* Close down each screen we initialized */ -static Bool TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool TDFXCloseScreen(CLOSE_SCREEN_ARGS_DECL); /* Change screensaver state */ static Bool TDFXSaveScreen(ScreenPtr pScreen, int mode); /* Cleanup server private data */ -static void TDFXFreeScreen(int scrnIndex, int flags); +static void TDFXFreeScreen(FREE_SCREEN_ARGS_DECL); /* Check if a mode is valid on the hardware */ -static ModeStatus TDFXValidMode(int scrnIndex, DisplayModePtr mode, +static ModeStatus TDFXValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags); -static void TDFXBlockHandler(int, pointer, pointer, pointer); +static void TDFXBlockHandler(BLOCKHANDLER_ARGS_DECL); /* Switch to various Display Power Management System levels */ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, @@ -757,7 +757,7 @@ static xf86MonPtr doTDFXDDC(ScrnInfoPtr pScrn) reg = pTDFX->readLong(pTDFX, VIDSERIALPARALLELPORT); pTDFX->writeLong(pTDFX, VIDSERIALPARALLELPORT, reg | VSP_ENABLE_IIC0); - pMon = xf86DoEDID_DDC2(pScrn->scrnIndex, pTDFX->pI2CBus); + pMon = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), pTDFX->pI2CBus); if (pMon == NULL) xf86Msg(X_WARNING, "No DDC2 capable monitor found\n"); @@ -1910,14 +1910,14 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #ifdef TDFXDRI if (pTDFX->directRenderingEnabled) { - DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - TDFXSwapContextFifo(screenInfo.screens[pScrn->scrnIndex]); + DRILock(xf86ScrnToScreen(pScrn), 0); + TDFXSwapContextFifo(xf86ScrnToScreen(pScrn)); } #endif DoRestore(pScrn, &hwp->ModeReg, &pTDFX->ModeReg, FALSE); #ifdef TDFXDRI if (pTDFX->directRenderingEnabled) { - DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); + DRIUnlock(xf86ScrnToScreen(pScrn)); } #endif @@ -2195,7 +2195,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) { } static Bool -TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { +TDFXScreenInit(SCREEN_INIT_ARGS_DECL) { ScrnInfoPtr pScrn; vgaHWPtr hwp; TDFXPtr pTDFX; @@ -2207,7 +2207,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { int scanlines; TDFXTRACE("TDFXScreenInit start\n"); - pScrn = xf86Screens[pScreen->myNum]; + pScrn = xf86ScreenToScrn(pScreen); pTDFX = TDFXPTR(pScrn); hwp = VGAHWPTR(pScrn); @@ -2337,7 +2337,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { return FALSE; break; default: - xf86DrvMsg(scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in TDFXScrnInit\n", pScrn->bitsPerPixel); return FALSE; @@ -2398,7 +2398,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { return FALSE; } - TDFXAdjustFrame(scrnIndex, 0, 0, 0); + TDFXAdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0)); xf86DPMSInit(pScreen, TDFXDisplayPowerManagementSet, 0); @@ -2438,22 +2438,20 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } Bool -TDFXSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn; +TDFXSwitchMode(SWITCH_MODE_ARGS_DECL) { + SCRN_INFO_PTR(arg); TDFXTRACE("TDFXSwitchMode start\n"); - pScrn=xf86Screens[scrnIndex]; return TDFXModeInit(pScrn, mode); } void -TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { - ScrnInfoPtr pScrn; +TDFXAdjustFrame(ADJUST_FRAME_ARGS_DECL) { + SCRN_INFO_PTR(arg); TDFXPtr pTDFX; TDFXRegPtr tdfxReg; TDFXTRACE("TDFXAdjustFrame start\n"); - pScrn = xf86Screens[scrnIndex]; pTDFX = TDFXPTR(pScrn); if (pTDFX->ShowCache && y && pScrn->vtSema) @@ -2468,16 +2466,15 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { } static Bool -TDFXEnterVT(int scrnIndex, int flags) { - ScrnInfoPtr pScrn; +TDFXEnterVT(VT_FUNC_ARGS_DECL) { + SCRN_INFO_PTR(arg); ScreenPtr pScreen; #ifdef TDFXDRI TDFXPtr pTDFX; #endif TDFXTRACE("TDFXEnterVT start\n"); - pScrn = xf86Screens[scrnIndex]; - pScreen = screenInfo.screens[scrnIndex]; + pScreen = xf86ScrnToScreen(pScrn); TDFXInitFifo(pScreen); #ifdef TDFXDRI pTDFX = TDFXPTR(pScrn); @@ -2486,23 +2483,22 @@ TDFXEnterVT(int scrnIndex, int flags) { } #endif if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; - TDFXAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + TDFXAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); return TRUE; } static void -TDFXLeaveVT(int scrnIndex, int flags) { - ScrnInfoPtr pScrn; +TDFXLeaveVT(VT_FUNC_ARGS_DECL) { + SCRN_INFO_PTR(arg); vgaHWPtr hwp; ScreenPtr pScreen; TDFXPtr pTDFX; TDFXTRACE("TDFXLeaveVT start\n"); - pScrn = xf86Screens[scrnIndex]; hwp=VGAHWPTR(pScrn); TDFXRestore(pScrn); vgaHWLock(hwp); - pScreen = screenInfo.screens[scrnIndex]; + pScreen = xf86ScrnToScreen(pScrn); pTDFX = TDFXPTR(pScrn); pTDFX->sync(pScrn); TDFXShutdownFifo(pScreen); @@ -2514,14 +2510,14 @@ TDFXLeaveVT(int scrnIndex, int flags) { } static Bool -TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) +TDFXCloseScreen(CLOSE_SCREEN_ARGS_DECL) { ScrnInfoPtr pScrn; vgaHWPtr hwp; TDFXPtr pTDFX; TDFXTRACE("TDFXCloseScreen start\n"); - pScrn = xf86Screens[scrnIndex]; + pScrn = xf86ScreenToScrn(pScreen); hwp = VGAHWPTR(pScrn); pTDFX = TDFXPTR(pScrn); @@ -2541,8 +2537,10 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWUnmapMem(pScrn); } +#ifdef HAVE_XAA_H if (pTDFX->AccelInfoRec) XAADestroyInfoRec(pTDFX->AccelInfoRec); pTDFX->AccelInfoRec=0; +#endif if (pTDFX->DGAModes) free(pTDFX->DGAModes); pTDFX->DGAModes=0; if (pTDFX->scanlineColorExpandBuffers[0]) @@ -2562,27 +2560,27 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) pScreen->BlockHandler = pTDFX->BlockHandler; pScreen->CloseScreen = pTDFX->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); } static void -TDFXFreeScreen(int scrnIndex, int flags) { +TDFXFreeScreen(FREE_SCREEN_ARGS_DECL) { + SCRN_INFO_PTR(arg); TDFXTRACE("TDFXFreeScreen start\n"); - TDFXFreeRec(xf86Screens[scrnIndex]); + TDFXFreeRec(pScrn); if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) - vgaHWFreeHWRec(xf86Screens[scrnIndex]); + vgaHWFreeHWRec(pScrn); } static ModeStatus -TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { - ScrnInfoPtr pScrn; +TDFXValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) { + SCRN_INFO_PTR(arg); TDFXPtr pTDFX; TDFXTRACE("TDFXValidMode start\n"); if ((mode->HDisplay>2048) || (mode->VDisplay>1536)) return MODE_BAD; /* Banshee doesn't support interlace, but Voodoo 3 and higher do. */ - pScrn = xf86Screens[scrnIndex]; pTDFX = TDFXPTR(pScrn); if (mode->Flags&V_INTERLACE) { switch (pTDFX->ChipType) { @@ -2631,7 +2629,7 @@ TDFXBlankScreen(ScrnInfoPtr pScrn, Bool unblank) static Bool TDFXSaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); Bool unblank; TDFXTRACE("TDFXSaveScreen start\n"); @@ -2648,14 +2646,14 @@ TDFXSaveScreen(ScreenPtr pScreen, int mode) } static void -TDFXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +TDFXBlockHandler(BLOCKHANDLER_ARGS_DECL) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; + SCREEN_PTR(arg); + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); TDFXPtr pTDFX = TDFXPTR(pScrn); pScreen->BlockHandler = pTDFX->BlockHandler; - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS); pScreen->BlockHandler = TDFXBlockHandler; if(pTDFX->VideoTimerCallback) { |