diff options
Diffstat (limited to 'hw/xfree86')
52 files changed, 382 insertions, 428 deletions
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 0eb000d41..129660d81 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -244,7 +244,7 @@ extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, int flags); extern _X_EXPORT void xf86DeleteDriver(int drvIndex); extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); -extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags); +extern _X_EXPORT void xf86DeleteScreen(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void); extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad); @@ -256,7 +256,7 @@ extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen); -extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); +extern _X_EXPORT void xf86EnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable); extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args) @@ -347,7 +347,7 @@ xf86SetBackingStore(ScreenPtr pScreen); extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen); extern _X_EXPORT pointer -xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name, +xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, char *port_name, char **adaptor_name, pointer *adaptor_options); extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny); @@ -357,7 +357,7 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, EntityProc enter, EntityProc leave, pointer private); extern _X_EXPORT Bool -xf86IsScreenPrimary(int scrnIndex); +xf86IsScreenPrimary(ScrnInfoPtr pScrn); extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, int format, unsigned long len, pointer value); @@ -458,4 +458,6 @@ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn); #define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */ +#define XF86_SCRN_INTERFACE 1 /* define for drivers to use in api compat */ + #endif /* _XF86_H */ diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index b8764344b..6c86f5e26 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -179,7 +179,7 @@ xf86BusConfig(void) xf86Msg(X_ERROR, "Screen %d deleted because of no matching config section.\n", i); - xf86DeleteScreen(i--, 0); + xf86DeleteScreen(xf86Screens[i--]); } } @@ -377,13 +377,12 @@ xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex) } /* - * xf86ClearEntitiesForScreen() - called when a screen is deleted + * xf86ClearEntityListForScreen() - called when a screen is deleted * to mark it's entities unused. Called by xf86DeleteScreen(). */ void -xf86ClearEntityListForScreen(int scrnIndex) +xf86ClearEntityListForScreen(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; int i, entityIndex; if (pScrn->entityList == NULL || pScrn->numEntities == 0) diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 61cae6aa7..c01cfd138 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -66,7 +66,7 @@ static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); -static void xf86PointerMoved(int scrnIndex, int x, int y); +static void xf86PointerMoved(ScrnInfoPtr pScrn, int x, int y); static miPointerScreenFuncRec xf86PointerScreenFuncs = { xf86CursorOffScreen, @@ -135,14 +135,13 @@ xf86SetViewport(ScreenPtr pScreen, int x, int y) { ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); - (*pScr->PointerMoved) (pScreen->myNum, x, y); + (*pScr->PointerMoved) (pScr, x, y); } static void -xf86PointerMoved(int scrnIndex, int x, int y) +xf86PointerMoved(ScrnInfoPtr pScr, int x, int y) { Bool frameChanged = FALSE; - ScrnInfoPtr pScr = xf86Screens[scrnIndex]; /* * check wether (x,y) belongs to the visual part of the screen @@ -173,7 +172,7 @@ xf86PointerMoved(int scrnIndex, int x, int y) } if (frameChanged && pScr->AdjustFrame != NULL) - pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + pScr->AdjustFrame(pScr, pScr->frameX0, pScr->frameY0); } /* @@ -230,7 +229,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) miPointerGetPosition(dev, &px, &py); was_blocked = xf86BlockSIGIO(); - Switched = (*pScr->SwitchMode) (pScr->scrnIndex, mode, 0); + Switched = (*pScr->SwitchMode) (pScr, mode); if (Switched) { pScr->currentMode = mode; @@ -271,7 +270,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) xf86UnblockSIGIO(was_blocked); if (pScr->AdjustFrame) - (*pScr->AdjustFrame) (pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0); /* The original code centered the frame around the cursor if possible. * Since this is hard to achieve with multiple cursors, we do the following: diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index e0314d86e..64163721f 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -56,7 +56,7 @@ static DevPrivateKeyRec DGAScreenKeyRec; #define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec) static Bool mieq_installed; -static Bool DGACloseScreen(int i, ScreenPtr pScreen); +static Bool DGACloseScreen(ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); static void DGAUninstallColormap(ColormapPtr pmap); @@ -235,7 +235,7 @@ FreeMarkedVisuals(ScreenPtr pScreen) } static Bool -DGACloseScreen(int i, ScreenPtr pScreen) +DGACloseScreen(ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); @@ -256,7 +256,7 @@ DGACloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv); - return ((*pScreen->CloseScreen) (i, pScreen)); + return ((*pScreen->CloseScreen) (pScreen)); } static void @@ -323,11 +323,10 @@ DGAUninstallColormap(ColormapPtr pmap) } int -xf86SetDGAMode(int index, int num, DGADevicePtr devRet) +xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); DGAScreenPtr pScreenPriv; - ScrnInfoPtr pScrn; DGADevicePtr device; PixmapPtr pPix = NULL; DGAModePtr pMode = NULL; @@ -338,7 +337,6 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet) pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (!pScreenPriv) return BadValue; - pScrn = pScreenPriv->pScrn; if (!num) { if (pScreenPriv->current) { @@ -359,7 +357,7 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet) pScreenPriv->savedColormap = NULL; } pScreenPriv->dgaColormap = NULL; - (*pScrn->EnableDisableFBAccess) (index, TRUE); + (*pScrn->EnableDisableFBAccess) (pScrn, TRUE); FreeMarkedVisuals(pScreen); } @@ -385,7 +383,7 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet) Bool oldVTSema = pScrn->vtSema; pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */ - (*pScrn->EnableDisableFBAccess) (index, FALSE); + (*pScrn->EnableDisableFBAccess) (pScrn, FALSE); pScrn->vtSema = oldVTSema; } @@ -564,7 +562,7 @@ DGAShutdown(void) for (i = 0; i < screenInfo.numScreens; i++) { pScrn = xf86Screens[i]; - (void) (*pScrn->SetDGAMode) (pScrn->scrnIndex, 0, NULL); + (void) (*pScrn->SetDGAMode) (pScrn, 0, NULL); } } @@ -579,7 +577,7 @@ DGASetMode(int index, int num, XDGAModePtr mode, PixmapPtr *pPix) /* We rely on the extension to check that DGA is available */ - ret = (*pScrn->SetDGAMode) (index, num, &device); + ret = (*pScrn->SetDGAMode) (pScrn, num, &device); if ((ret == Success) && num) { DGACopyModeInfo(device.mode, mode); *pPix = device.pPix; diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c index 54ad84243..ef4a2c19b 100644 --- a/hw/xfree86/common/xf86DPMS.c +++ b/hw/xfree86/common/xf86DPMS.c @@ -49,7 +49,7 @@ #ifdef DPMSExtension static DevPrivateKeyRec DPMSKeyRec; static DevPrivateKey DPMSKey; -static Bool DPMSClose(int i, ScreenPtr pScreen); +static Bool DPMSClose(ScreenPtr pScreen); static int DPMSCount = 0; #endif @@ -99,10 +99,10 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) #ifdef DPMSExtension static Bool -DPMSClose(int i, ScreenPtr pScreen) +DPMSClose(ScreenPtr pScreen) { DPMSPtr pDPMS; - + ScrnInfoPtr pScrn; /* This shouldn't happen */ if (DPMSKey == NULL) return FALSE; @@ -114,20 +114,20 @@ DPMSClose(int i, ScreenPtr pScreen) return FALSE; pScreen->CloseScreen = pDPMS->CloseScreen; - + pScrn = xf86ScreenToScrn(pScreen); /* * Turn on DPMS when shutting down. If this function can be used * depends on the order the driver wraps things. If this is called * after the driver has shut down everything the driver will have * to deal with this internally. */ - if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) { - xf86Screens[i]->DPMSSet(xf86Screens[i], DPMSModeOn, 0); + if (pScrn->vtSema && pScrn->DPMSSet) { + pScrn->DPMSSet(pScrn, DPMSModeOn, 0); } if (--DPMSCount == 0) DPMSKey = NULL; - return pScreen->CloseScreen(i, pScreen); + return pScreen->CloseScreen(pScreen); } /* diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 5896f220c..4fcad4000 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -438,7 +438,7 @@ xf86VTSwitch(void) for (i = 0; i < xf86NumScreens; i++) { if (!(dispatchException & DE_TERMINATE)) if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); } /* @@ -459,7 +459,7 @@ xf86VTSwitch(void) prevSIGIO = xf86BlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) - xf86Screens[i]->LeaveVT(i, 0); + xf86Screens[i]->LeaveVT(xf86Screens[i]); xf86AccessLeave(); /* We need this here, otherwise */ @@ -471,13 +471,13 @@ xf86VTSwitch(void) DebugF("xf86VTSwitch: Leave failed\n"); xf86AccessEnter(); for (i = 0; i < xf86NumScreens; i++) { - if (!xf86Screens[i]->EnterVT(i, 0)) + if (!xf86Screens[i]->EnterVT(xf86Screens[i])) FatalError("EnterVT failed for screen %d\n", i); } if (!(dispatchException & DE_TERMINATE)) { for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } } dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); @@ -527,12 +527,12 @@ xf86VTSwitch(void) xf86AccessEnter(); for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->vtSema = TRUE; - if (!xf86Screens[i]->EnterVT(i, 0)) + if (!xf86Screens[i]->EnterVT(xf86Screens[i])) FatalError("EnterVT failed for screen %d\n", i); } for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } /* Turn screen saver off when switching back */ diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index fb56a0b17..5ef1dabfb 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -198,24 +198,22 @@ xf86AllocateScreen(DriverPtr drv, int flags) */ void -xf86DeleteScreen(int scrnIndex, int flags) +xf86DeleteScreen(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn; int i; + int scrnIndex; /* First check if the screen is valid */ if (xf86NumScreens == 0 || xf86Screens == NULL) return; - if (scrnIndex > xf86NumScreens - 1) - return; - - if (!(pScrn = xf86Screens[scrnIndex])) + if (!pScrn) return; + scrnIndex = pScrn->scrnIndex; /* If a FreeScreen function is defined, call it here */ if (pScrn->FreeScreen != NULL) - pScrn->FreeScreen(scrnIndex, 0); + pScrn->FreeScreen(pScrn); while (pScrn->modes) xf86DeleteMode(&pScrn->modes, pScrn->modes); @@ -233,7 +231,7 @@ xf86DeleteScreen(int scrnIndex, int flags) free(pScrn->privates); - xf86ClearEntityListForScreen(scrnIndex); + xf86ClearEntityListForScreen(pScrn); free(pScrn); @@ -1027,9 +1025,8 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen) * private data, and therefore don't need to access pScrnInfo->vtSema. */ void -xf86EnableDisableFBAccess(int scrnIndex, Bool enable) +xf86EnableDisableFBAccess(ScrnInfoPtr pScrnInfo, Bool enable) { - ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex]; ScreenPtr pScreen = pScrnInfo->pScreen; PixmapPtr pspix; @@ -1651,10 +1648,9 @@ xf86SetSilkenMouse(ScreenPtr pScreen) /* Wrote this function for the PM2 Xv driver, preliminary. */ pointer -xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name, +xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name, char **adaptor_name, pointer *adaptor_options) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; confXvAdaptorPtr adaptor; int i; @@ -1726,9 +1722,8 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, } Bool -xf86IsScreenPrimary(int scrnIndex) +xf86IsScreenPrimary(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; int i; for (i = 0; i < pScrn->numEntities; i++) { diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index ead47ccba..ca6efd44e 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -591,7 +591,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) } for (i = 0; i < xf86NumScreens; i++) if (!xf86Screens[i]->configured) - xf86DeleteScreen(i--, 0); + xf86DeleteScreen(xf86Screens[i--]); /* * If no screens left, return now. @@ -1040,7 +1040,7 @@ AbortDDX(enum ExitCode error) * screen explicitely. */ xf86VGAarbiterLock(xf86Screens[i]); - (xf86Screens[i]->LeaveVT) (i, 0); + (xf86Screens[i]->LeaveVT) (xf86Screens[i]); xf86VGAarbiterUnlock(xf86Screens[i]); } } diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index ab4d595c7..d80dec892 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -950,7 +950,7 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, mode->SynthClock /= 2; } - status = (*scrp->ValidMode) (scrp->scrnIndex, mode, FALSE, + status = (*scrp->ValidMode) (scrp, mode, FALSE, MODECHECK_INITIAL); if (status != MODE_OK) return status; @@ -1840,7 +1840,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, scrp->virtualX = newVirtX; scrp->virtualY = newVirtY; scrp->displayWidth = newLinePitch; - p->status = (scrp->ValidMode) (scrp->scrnIndex, p, FALSE, + p->status = (scrp->ValidMode) (scrp, p, FALSE, MODECHECK_FINAL); if (p->status != MODE_OK) { diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 31f5c6a86..bf56acd05 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -82,7 +82,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(12, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(13, 0) #define ABI_XINPUT_VERSION SET_ABI_VERSION(17, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(6, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c index f69fffa0e..1830640d5 100644 --- a/hw/xfree86/common/xf86PM.c +++ b/hw/xfree86/common/xf86PM.c @@ -102,7 +102,7 @@ suspend(pmEvent event, Bool undo) for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE); } pInfo = xf86InputDevs; while (pInfo) { @@ -112,9 +112,9 @@ suspend(pmEvent event, Bool undo) sigio_blocked_for_suspend = xf86BlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i, event, undo); + xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); else { - xf86Screens[i]->LeaveVT(i, 0); + xf86Screens[i]->LeaveVT(xf86Screens[i]); xf86Screens[i]->vtSema = FALSE; } } @@ -131,16 +131,16 @@ resume(pmEvent event, Bool undo) xf86AccessEnter(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i, event, undo); + xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); else { xf86Screens[i]->vtSema = TRUE; - xf86Screens[i]->EnterVT(i, 0); + xf86Screens[i]->EnterVT(xf86Screens[i]); } } xf86UnblockSIGIO(sigio_blocked_for_suspend); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); } dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; @@ -187,7 +187,7 @@ DoApmEvent(pmEvent event, Bool undo) was_blocked = xf86BlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) { - xf86Screens[i]->PMEvent(i, event, undo); + xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); } } xf86UnblockSIGIO(was_blocked); diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 6c5efeacc..42a3b30f0 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -114,7 +114,7 @@ extern _X_EXPORT void xf86BusProbe(void); extern _X_EXPORT void xf86AccessEnter(void); extern _X_EXPORT void xf86AccessLeave(void); extern _X_EXPORT void xf86PostProbe(void); -extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex); +extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn); extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev); extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev); diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index b17f601d1..5606bee4b 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -159,7 +159,7 @@ xf86RandRSetMode(ScreenPtr pScreen, Bool ret = TRUE; if (pRoot && scrp->vtSema) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); + (*scrp->EnableDisableFBAccess) (scrp, FALSE); if (useVirtual) { scrp->virtualX = randrp->virtualX; scrp->virtualY = randrp->virtualY; @@ -220,7 +220,7 @@ xf86RandRSetMode(ScreenPtr pScreen, xf86SetViewport(pScreen, pScreen->width, pScreen->height); xf86SetViewport(pScreen, 0, 0); if (pRoot && scrp->vtSema) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); + (*scrp->EnableDisableFBAccess) (scrp, TRUE); return ret; } @@ -365,7 +365,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen) * Reset size back to original */ static Bool -xf86RandRCloseScreen(int index, ScreenPtr pScreen) +xf86RandRCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); @@ -376,7 +376,7 @@ xf86RandRCloseScreen(int index, ScreenPtr pScreen) pScreen->CloseScreen = randrp->CloseScreen; free(randrp); dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL); - return (*pScreen->CloseScreen) (index, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Rotation diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c index b9b46f6cd..225fff06e 100644 --- a/hw/xfree86/common/xf86VGAarbiter.c +++ b/hw/xfree86/common/xf86VGAarbiter.c @@ -221,7 +221,7 @@ xf86VGAarbiterWrapFunctions(void) /* Screen funcs */ static Bool -VGAarbiterCloseScreen(int i, ScreenPtr pScreen) +VGAarbiterCloseScreen(ScreenPtr pScreen) { Bool val; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); @@ -258,34 +258,30 @@ VGAarbiterCloseScreen(int i, ScreenPtr pScreen) UNWRAP_SPRITE; free((pointer) pScreenPriv); - xf86VGAarbiterLock(xf86Screens[i]); - val = (*pScreen->CloseScreen) (i, pScreen); - xf86VGAarbiterUnlock(xf86Screens[i]); + xf86VGAarbiterLock(xf86ScreenToScrn(pScreen)); + val = (*pScreen->CloseScreen) (pScreen); + xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen)); return val; } static void -VGAarbiterBlockHandler(int i, - pointer blockData, pointer pTimeout, pointer pReadmask) +VGAarbiterBlockHandler(ScreenPtr pScreen, + pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - SCREEN_PROLOG(BlockHandler); VGAGet(pScreen); - pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler(pScreen, pTimeout, pReadmask); VGAPut(); SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler); } static void -VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, +VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - SCREEN_PROLOG(WakeupHandler); VGAGet(pScreen); - pScreen->WakeupHandler(i, blockData, result, pReadmask); + pScreen->WakeupHandler(pScreen, result, pReadmask); VGAPut(); SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler); } @@ -466,46 +462,45 @@ VGAarbiterSetCursorPosition(DeviceIntPtr pDev, } static void -VGAarbiterAdjustFrame(int index, int x, int y, int flags) +VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); - (*pScreenPriv->AdjustFrame) (index, x, y, flags); + (*pScreenPriv->AdjustFrame) (pScrn, x, y); VGAPut(); } static Bool -VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags) +VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool val; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); - val = (*pScreenPriv->SwitchMode) (index, mode, flags); + val = (*pScreenPriv->SwitchMode) (pScrn, mode); VGAPut(); return val; } static Bool -VGAarbiterEnterVT(int index, int flags) +VGAarbiterEnterVT(ScrnInfoPtr pScrn) { Bool val; - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); pScrn->EnterVT = pScreenPriv->EnterVT; - val = (*pScrn->EnterVT) (index, flags); + val = (*pScrn->EnterVT) (pScrn); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = VGAarbiterEnterVT; VGAPut(); @@ -513,32 +508,31 @@ VGAarbiterEnterVT(int index, int flags) } static void -VGAarbiterLeaveVT(int index, int flags) +VGAarbiterLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); pScrn->LeaveVT = pScreenPriv->LeaveVT; - (*pScreenPriv->LeaveVT) (index, flags); + (*pScreenPriv->LeaveVT) (pScrn); pScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = VGAarbiterLeaveVT; VGAPut(); } static void -VGAarbiterFreeScreen(int index, int flags) +VGAarbiterFreeScreen(ScrnInfoPtr pScrn) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates, VGAarbiterScreenKey); VGAGet(pScreen); - (*pScreenPriv->FreeScreen) (index, flags); + (*pScreenPriv->FreeScreen) (pScrn); VGAPut(); } diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h index ebc8854d3..ba6edfcc3 100644 --- a/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -125,11 +125,11 @@ typedef struct _VGAarbiterScreen { UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; - void (*AdjustFrame) (int, int, int, int); - Bool (*SwitchMode) (int, DisplayModePtr, int); - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); - void (*FreeScreen) (int, int); + void (*AdjustFrame) (ScrnInfoPtr, int, int); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); + void (*FreeScreen) (ScrnInfoPtr); miPointerSpriteFuncPtr miSprite; CompositeProcPtr Composite; GlyphsProcPtr Glyphs; @@ -142,11 +142,11 @@ typedef struct _VGAarbiterGC { } VGAarbiterGCRec, *VGAarbiterGCPtr; /* Screen funcs */ -static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, +static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask); -static void VGAarbiterWakeupHandler(int i, pointer blockData, +static void VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask); -static Bool VGAarbiterCloseScreen(int i, ScreenPtr pScreen); +static Bool VGAarbiterCloseScreen(ScreenPtr pScreen); static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); @@ -176,11 +176,11 @@ static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent); -static void VGAarbiterAdjustFrame(int index, int x, int y, int flags); -static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags); -static Bool VGAarbiterEnterVT(int index, int flags); -static void VGAarbiterLeaveVT(int index, int flags); -static void VGAarbiterFreeScreen(int index, int flags); +static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y); +static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn); +static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn); +static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn); /* GC funcs */ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes, diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c index 13ffe061c..a7d1c25bf 100644 --- a/hw/xfree86/common/xf86VidMode.c +++ b/hw/xfree86/common/xf86VidMode.c @@ -50,7 +50,7 @@ static DevPrivateKeyRec VidModeKeyRec; static DevPrivateKey VidModeKey; static int VidModeCount = 0; -static Bool VidModeClose(int i, ScreenPtr pScreen); +static Bool VidModeClose(ScreenPtr pScreen); #define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey)) @@ -93,7 +93,7 @@ VidModeExtensionInit(ScreenPtr pScreen) #ifdef XF86VIDMODE static Bool -VidModeClose(int i, ScreenPtr pScreen) +VidModeClose(ScreenPtr pScreen) { VidModePtr pVidMode = VMPTR(pScreen); @@ -108,7 +108,7 @@ VidModeClose(int i, ScreenPtr pScreen) dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL); VidModeKey = NULL; } - return pScreen->CloseScreen(i, pScreen); + return pScreen->CloseScreen(pScreen); } Bool @@ -303,7 +303,7 @@ VidModeSetViewPort(int scrnIndex, int x, int y) pScrn->virtualY - pScrn->currentMode->VDisplay); pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1; if (pScrn->AdjustFrame != NULL) - (pScrn->AdjustFrame) (scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + (pScrn->AdjustFrame) (pScrn, pScrn->frameX0, pScrn->frameY0); return TRUE; } diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index 460fafde3..25f84e579 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -80,9 +80,9 @@ typedef struct { DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; - Bool (*EnterVT) (int, int); - Bool (*SwitchMode) (int, DisplayModePtr, int); - int (*SetDGAMode) (int, int, DGADevicePtr); + Bool (*EnterVT) (ScrnInfoPtr); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); + int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr); xf86ChangeGammaProc *ChangeGamma; int maxColors; int sigRGBbits; @@ -111,17 +111,17 @@ static DevPrivateKeyRec CMapColormapKeyRec; static void CMapInstallColormap(ColormapPtr); static void CMapStoreColors(ColormapPtr, int, xColorItem *); -static Bool CMapCloseScreen(int, ScreenPtr); +static Bool CMapCloseScreen(ScreenPtr); static Bool CMapCreateColormap(ColormapPtr); static void CMapDestroyColormap(ColormapPtr); -static Bool CMapEnterVT(int, int); -static Bool CMapSwitchMode(int, DisplayModePtr, int); +static Bool CMapEnterVT(ScrnInfoPtr); +static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr); #ifdef XFreeXDGA -static int CMapSetDGAMode(int, int, DGADevicePtr); +static int CMapSetDGAMode(ScrnInfoPtr, int, DGADevicePtr); #endif -static int CMapChangeGamma(int, Gamma); +static int CMapChangeGamma(ScrnInfoPtr, Gamma); static void ComputeGamma(CMapScreenPtr); static Bool CMapAllocateColormapPrivate(ColormapPtr); @@ -241,11 +241,11 @@ xf86HandleColormaps(ScreenPtr pScreen, /**** Screen functions ****/ static Bool -CMapCloseScreen(int i, ScreenPtr pScreen) +CMapCloseScreen(ScreenPtr pScreen) { CMapUnwrapScreen(pScreen); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static Bool @@ -462,16 +462,15 @@ CMapInstallColormap(ColormapPtr pmap) /**** ScrnInfoRec functions ****/ static Bool -CMapEnterVT(int index, int flags) +CMapEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); Bool ret; CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); pScrn->EnterVT = pScreenPriv->EnterVT; - ret = (*pScreenPriv->EnterVT) (index, flags); + ret = (*pScreenPriv->EnterVT) (pScrn); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = CMapEnterVT; if (ret) { @@ -483,13 +482,13 @@ CMapEnterVT(int index, int flags) } static Bool -CMapSwitchMode(int index, DisplayModePtr mode, int flags) +CMapSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); - if ((*pScreenPriv->SwitchMode) (index, mode, flags)) { + if ((*pScreenPriv->SwitchMode) (pScrn, mode)) { if (GetInstalledmiColormap(pScreen)) CMapReinstallMap(GetInstalledmiColormap(pScreen)); return TRUE; @@ -499,16 +498,16 @@ CMapSwitchMode(int index, DisplayModePtr mode, int flags) #ifdef XFreeXDGA static int -CMapSetDGAMode(int index, int num, DGADevicePtr dev) +CMapSetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr dev) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapScreenPtr pScreenPriv = (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey); int ret; - ret = (*pScreenPriv->SetDGAMode) (index, num, dev); + ret = (*pScreenPriv->SetDGAMode) (pScrn, num, dev); - pScreenPriv->isDGAmode = DGAActive(index); + pScreenPriv->isDGAmode = DGAActive(pScrn->scrnIndex); if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen) && xf86ScreenToScrn(pScreen)->vtSema) @@ -908,11 +907,10 @@ ComputeGamma(CMapScreenPtr priv) } int -CMapChangeGamma(int index, Gamma gamma) +CMapChangeGamma(ScrnInfoPtr pScrn, Gamma gamma) { int ret = Success; - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); CMapColormapPtr pColPriv; CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; @@ -979,7 +977,7 @@ CMapChangeGamma(int index, Gamma gamma) pScrn->ChangeGamma = pScreenPriv->ChangeGamma; if (pScrn->ChangeGamma) - ret = pScrn->ChangeGamma(index, gamma); + ret = pScrn->ChangeGamma(pScrn, gamma); pScrn->ChangeGamma = CMapChangeGamma; return ret; @@ -1175,7 +1173,7 @@ xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma) ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->ChangeGamma) - return (*pScrn->ChangeGamma) (pScreen->myNum, gamma); + return (*pScrn->ChangeGamma) (pScrn, gamma); return BadImplementation; } diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c index e2db1c354..c2e7bab9f 100644 --- a/hw/xfree86/common/xf86fbman.c +++ b/hw/xfree86/common/xf86fbman.c @@ -1149,7 +1149,7 @@ static FBManagerFuncs xf86FBManFuncs = { }; static Bool -xf86FBCloseScreen(int i, ScreenPtr pScreen) +xf86FBCloseScreen(ScreenPtr pScreen) { FBLinkPtr pLink, tmp; FBLinearLinkPtr pLinearLink, tmp2; @@ -1180,7 +1180,7 @@ xf86FBCloseScreen(int i, ScreenPtr pScreen) free(offman); dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index 27d24f8e1..b6a6b94b3 100644 --- a/hw/xfree86/common/xf86sbusBus.c +++ b/hw/xfree86/common/xf86sbusBus.c @@ -667,7 +667,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, } static Bool -xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen) +xf86SbusCmapCloseScreen(ScreenPtr pScreen) { sbusCmapPtr cmap; struct fbcmap fbcmap; @@ -683,7 +683,7 @@ xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen) } pScreen->CloseScreen = cmap->CloseScreen; free(cmap); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 6294845bc..a1404c3aa 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -630,18 +630,18 @@ typedef struct { typedef Bool xf86ProbeProc(DriverPtr, int); typedef Bool xf86PreInitProc(ScrnInfoPtr, int); -typedef Bool xf86ScreenInitProc(int, ScreenPtr, int, char **); -typedef Bool xf86SwitchModeProc(int, DisplayModePtr, int); -typedef void xf86AdjustFrameProc(int, int, int, int); -typedef Bool xf86EnterVTProc(int, int); -typedef void xf86LeaveVTProc(int, int); -typedef void xf86FreeScreenProc(int, int); -typedef ModeStatus xf86ValidModeProc(int, DisplayModePtr, Bool, int); -typedef void xf86EnableDisableFBAccessProc(int, Bool); -typedef int xf86SetDGAModeProc(int, int, DGADevicePtr); -typedef int xf86ChangeGammaProc(int, Gamma); -typedef void xf86PointerMovedProc(int, int, int); -typedef Bool xf86PMEventProc(int, pmEvent, Bool); +typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **); +typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr); +typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int); +typedef Bool xf86EnterVTProc(ScrnInfoPtr); +typedef void xf86LeaveVTProc(ScrnInfoPtr); +typedef void xf86FreeScreenProc(ScrnInfoPtr); +typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int); +typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool); +typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr); +typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma); +typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int); +typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool); typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int); typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr); typedef void xf86SetOverscanProc(ScrnInfoPtr, int); diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index b10034852..1a964d270 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -56,7 +56,7 @@ /* XvScreenRec fields */ -static Bool xf86XVCloseScreen(int, ScreenPtr); +static Bool xf86XVCloseScreen(ScreenPtr); static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); /* XvAdaptorRec fields */ @@ -100,9 +100,9 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); /* ScrnInfoRec functions */ -static Bool xf86XVEnterVT(int, int); -static void xf86XVLeaveVT(int, int); -static void xf86XVAdjustFrame(int index, int x, int y, int flags); +static Bool xf86XVEnterVT(ScrnInfoPtr); +static void xf86XVLeaveVT(ScrnInfoPtr); +static void xf86XVAdjustFrame(ScrnInfoPtr, int x, int y); static void xf86XVModeSet(ScrnInfoPtr pScrn); /* misc */ @@ -1066,7 +1066,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible) static void xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged) { - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XvAdaptorPtr pa; int c, i; @@ -1255,7 +1255,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) /**** Required XvScreenRec fields ****/ static Bool -xf86XVCloseScreen(int i, ScreenPtr pScreen) +xf86XVCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); @@ -1299,15 +1299,14 @@ xf86XVQueryAdaptors(ScreenPtr pScreen, /**** ScrnInfoRec fields ****/ static Bool -xf86XVEnterVT(int index, int flags) +xf86XVEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); Bool ret; pScrn->EnterVT = ScreenPriv->EnterVT; - ret = (*ScreenPriv->EnterVT) (index, flags); + ret = (*ScreenPriv->EnterVT) (pScrn); ScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86XVEnterVT; @@ -1318,10 +1317,9 @@ xf86XVEnterVT(int index, int flags) } static void -xf86XVLeaveVT(int index, int flags) +xf86XVLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XvAdaptorPtr pAdaptor; @@ -1353,21 +1351,20 @@ xf86XVLeaveVT(int index, int flags) } pScrn->LeaveVT = ScreenPriv->LeaveVT; - (*ScreenPriv->LeaveVT) (index, flags); + (*ScreenPriv->LeaveVT) (pScrn); ScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = xf86XVLeaveVT; } static void -xf86XVAdjustFrame(int index, int x, int y, int flags) +xf86XVAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); if (ScreenPriv->AdjustFrame) { pScrn->AdjustFrame = ScreenPriv->AdjustFrame; - (*pScrn->AdjustFrame) (index, x, y, flags); + (*pScrn->AdjustFrame) (pScrn, x, y); pScrn->AdjustFrame = xf86XVAdjustFrame; } @@ -1377,7 +1374,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) static void xf86XVModeSet(ScrnInfoPtr pScrn) { - ScreenPtr pScreen = pScrn->pScreen; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86XVScreenPtr ScreenPriv; /* Can be called before pScrn->pScreen is set */ diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c index b7da7589a..2e529dd92 100644 --- a/hw/xfree86/common/xf86xvmc.c +++ b/hw/xfree86/common/xf86xvmc.c @@ -132,7 +132,7 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture) } static Bool -xf86XvMCCloseScreen(int i, ScreenPtr pScreen) +xf86XvMCCloseScreen(ScreenPtr pScreen) { xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen); @@ -141,7 +141,7 @@ xf86XvMCCloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv->dixinfo); free(pScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h index 289ca5843..9bedd9023 100644 --- a/hw/xfree86/common/xf86xvpriv.h +++ b/hw/xfree86/common/xf86xvpriv.h @@ -41,9 +41,9 @@ typedef struct { ClipNotifyProcPtr ClipNotify; WindowExposuresProcPtr WindowExposures; PostValidateTreeProcPtr PostValidateTree; - void (*AdjustFrame) (int, int, int, int); - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); + void (*AdjustFrame) (ScrnInfoPtr, int, int, int); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); xf86ModeSetProc *ModeSet; } XF86XVScreenRec, *XF86XVScreenPtr; diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c index a1281d735..28c969646 100644 --- a/hw/xfree86/ddc/ddc.c +++ b/hw/xfree86/ddc/ddc.c @@ -258,10 +258,9 @@ EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed, * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr -xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed, +xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, unsigned int (*DDC1Read) (ScrnInfoPtr)) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; @@ -285,7 +284,7 @@ xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed, OsReleaseSignals(); if (EDID_block) { - tmp = xf86InterpretEDID(scrnIndex, EDID_block); + tmp = xf86InterpretEDID(pScrn->scrnIndex, EDID_block); } #ifdef DEBUG else @@ -323,7 +322,7 @@ DDC2MakeDevice(I2CBusPtr pBus, int address, char *name) } static I2CDevPtr -DDC2Init(int scrnIndex, I2CBusPtr pBus) +DDC2Init(I2CBusPtr pBus) { I2CDevPtr dev = NULL; @@ -403,9 +402,8 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer) * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr -xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) +xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool complete) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; I2CDevPtr dev = NULL; @@ -427,7 +425,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) if (noddc || noddc2) return NULL; - if (!(dev = DDC2Init(scrnIndex, pBus))) + if (!(dev = DDC2Init(pBus))) return NULL; EDID_block = calloc(1, EDID1_LEN); @@ -444,7 +442,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) DDC2Read(dev, i + 1, EDID_block + (EDID1_LEN * (1 + i))); } - tmp = xf86InterpretEEDID(scrnIndex, EDID_block); + tmp = xf86InterpretEEDID(pScrn->scrnIndex, EDID_block); } if (tmp && complete) @@ -465,9 +463,9 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) * @return NULL if no monitor attached or failure to interpret the EDID. */ xf86MonPtr -xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus) +xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus) { - return xf86DoEEDID(scrnIndex, pBus, FALSE); + return xf86DoEEDID(pScrn, pBus, FALSE); } /* XXX write me */ @@ -489,9 +487,8 @@ DDC2ReadDisplayID(void) * @return NULL if no monitor attached or failure to interpret the DisplayID. */ xf86MonPtr -xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) +xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *did = NULL; xf86MonPtr tmp = NULL; I2CDevPtr dev = NULL; @@ -513,7 +510,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) if (noddc || noddc2) return NULL; - if (!(dev = DDC2Init(scrnIndex, pBus))) + if (!(dev = DDC2Init(pBus))) return NULL; if ((did = DDC2ReadDisplayID())) { @@ -521,7 +518,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) if (!tmp) return NULL; - tmp->scrnIndex = scrnIndex; + tmp->scrnIndex = pScrn->scrnIndex; tmp->flags |= MONITOR_DISPLAYID; tmp->rawData = did; } diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h index 2071d530d..c63da8bff 100644 --- a/hw/xfree86/ddc/xf86DDC.h +++ b/hw/xfree86/ddc/xf86DDC.h @@ -24,15 +24,15 @@ typedef enum { typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed); -extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(int scrnIndex, +extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed, unsigned int (*DDC1Read) (ScrnInfoPtr) ); -extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus); +extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus); -extern _X_EXPORT xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool); +extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool); extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr); @@ -50,7 +50,7 @@ extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); extern _X_EXPORT Bool xf86MonitorIsHDMI(xf86MonPtr mon); -extern _X_EXPORT xf86MonPtr xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus); +extern _X_EXPORT xf86MonPtr xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus); extern _X_EXPORT void xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC); diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml index a6b9da2d5..24b0c0324 100644 --- a/hw/xfree86/doc/ddxDesign.xml +++ b/hw/xfree86/doc/ddxDesign.xml @@ -1306,7 +1306,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - Bool ChipScreenInit(int index, ScreenPtr pScreen, + Bool ChipScreenInit(ScreenPtr pScreen, int argc, char **argv); </programlisting> <blockquote><para> @@ -1442,7 +1442,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - Bool ChipSwitchMode(int index, DisplayModePtr mode, int flags); + Bool ChipSwitchMode(int index, DisplayModePtr mode); </programlisting> <blockquote><para> Initialises the new mode for the screen identified by @@ -1464,7 +1464,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - void ChipAdjustFrame(int index, int x, int y, int flags); + void ChipAdjustFrame(int index, int x, int y); </programlisting> <blockquote><para> Changes the viewport for the screen identified by @@ -1572,7 +1572,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - Bool ChipEnterVT(int index, int flags); + Bool ChipEnterVT(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> This function should initialise the current video mode and @@ -1589,7 +1589,7 @@ Here is what <function>InitOutput()</function> does: <blockquote><para> <programlisting> - void ChipLeaveVT(int index, int flags); + void ChipLeaveVT(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> This function should restore the saved video state. If @@ -1691,7 +1691,7 @@ but their presence is optional. <blockquote><para> <programlisting> - ModeStatus ChipValidMode(int index, DisplayModePtr mode, + ModeStatus ChipValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags); </programlisting> <blockquote><para> @@ -1739,7 +1739,7 @@ MODECHECK_FINAL are intended for checks that may involve more than one mode. <blockquote><para> <programlisting> - void ChipFreeScreen(int scrnindex, int flags); + void ChipFreeScreen(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> Free any driver-allocated data that may have been allocated up to @@ -2824,12 +2824,12 @@ Several functions are provided to simplify resource registration: <blockquote><para> <programlisting> - Bool xf86IsScreenPrimary(int scrnIndex); + Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn); </programlisting> <blockquote><para> This function returns <constant>TRUE</constant> if the primary entity is registered with the screen referenced by - <parameter>scrnIndex</parameter>. + <parameter>pScrn</parameter>. </para> </blockquote></para></blockquote> @@ -9033,7 +9033,7 @@ ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) <programlisting> static Bool -ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv) { /* Get the ScrnInfoRec */ pScrn = xf86ScreenToScrn(pScreen); @@ -9051,7 +9051,7 @@ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Set the viewport if supported */ - ZZZAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + ZZZAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0); /* * Setup the screen's visuals, and initialise the framebuffer @@ -9220,9 +9220,9 @@ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) <programlisting> static Bool -ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +ZZZSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - return ZZZModeInit(xf86Screens[scrnIndex], mode); + return ZZZModeInit(pScrn, mode); } </programlisting> </sect3> @@ -9237,7 +9237,7 @@ ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) <programlisting> static void -ZZZAdjustFrame(int scrnIndex, int x, int y, int flags) +ZZZAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { /* Adjust the viewport */ } @@ -9258,16 +9258,14 @@ ZZZAdjustFrame(int scrnIndex, int x, int y, int flags) <programlisting> static Bool -ZZZEnterVT(int scrnIndex, int flags) +ZZZEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; return ZZZModeInit(pScrn, pScrn->currentMode); } static void -ZZZLeaveVT(int scrnIndex, int flags) +ZZZLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; ZZZRestore(pScrn); } </programlisting> @@ -9288,16 +9286,16 @@ ZZZLeaveVT(int scrnIndex, int flags) <programlisting> static Bool -ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen) +ZZZCloseScreen(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (pScrn->vtSema) { ZZZRestore(pScrn); ZZZUnmapMem(pScrn); } pScrn->vtSema = FALSE; pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen; - return (*pScreen->CloseScreen)(scrnIndex, pScreen); + return (*pScreen->CloseScreen)(pScreen); } </programlisting> </sect3> @@ -9342,13 +9340,13 @@ ZZZSaveScreen(ScreenPtr pScreen, int mode) <programlisting> static void -ZZZFreeScreen(int scrnIndex, int flags) +ZZZFreeScreen(ScrnInfoPtr pScrn) { /* * If the vgahw module is used vgaHWFreeHWRec() would be called * here. */ - ZZZFreeRec(xf86Screens[scrnIndex]); + ZZZFreeRec(pScrn); } </programlisting> diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 20eb683ad..46a9ae457 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -1618,7 +1618,7 @@ DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.WakeupHandler) - (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (i, wakeupData, + (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (pScreen, result, pReadmask); } } @@ -1633,16 +1633,15 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.BlockHandler) - (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (i, blockData, + (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (pScreen, pTimeout, pReadmask); } } void -DRIDoWakeupHandler(int screenNum, pointer wakeupData, +DRIDoWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRILock(pScreen, 0); @@ -1658,10 +1657,9 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData, } void -DRIDoBlockHandler(int screenNum, pointer blockData, +DRIDoBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) { @@ -2307,15 +2305,14 @@ _DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y) } void -DRIAdjustFrame(int scrnIndex, int x, int y, int flags) +DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScreenPtr pScreen = screenInfo.screens[scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); int px, py; if (!pDRIPriv || !pDRIPriv->pSAREA) { - DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", + DRIDrvMsg(pScrn->scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL); return; } @@ -2347,7 +2344,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags) /* unwrap */ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; /* call lower layers */ - (*pScrn->AdjustFrame) (scrnIndex, x, y, flags); + (*pScrn->AdjustFrame) (pScrn, x, y); /* rewrap */ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = DRIAdjustFrame; diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h index 53458bb4a..0a4036c35 100644 --- a/hw/xfree86/dri/dri.h +++ b/hw/xfree86/dri/dri.h @@ -73,7 +73,7 @@ typedef int DRIWindowRequests; #define DRI_ALL_WINDOWS 2 typedef void (*ClipNotifyPtr) (WindowPtr, int, int); -typedef void (*AdjustFramePtr) (int scrnIndex, int x, int y, int flags); +typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y); /* * These functions can be wrapped by the DRI. Each of these have @@ -271,13 +271,11 @@ extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData, extern _X_EXPORT void DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask); -extern _X_EXPORT void DRIDoWakeupHandler(int screenNum, - pointer wakeupData, +extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer pReadmask); -extern _X_EXPORT void DRIDoBlockHandler(int screenNum, - pointer blockData, +extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask); extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx); @@ -334,7 +332,7 @@ extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen); extern _X_EXPORT void DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion); -extern _X_EXPORT void DRIAdjustFrame(int scrnIndex, int x, int y, int flags); +extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y); extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen, int dx, diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c index 50924587d..4e809ea37 100644 --- a/hw/xfree86/exa/examodule.c +++ b/hw/xfree86/exa/examodule.c @@ -38,7 +38,7 @@ typedef struct _ExaXorgScreenPrivRec { CloseScreenProcPtr SavedCloseScreen; - EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess; + xf86EnableDisableFBAccessProc *SavedEnableDisableFBAccess; OptionInfoPtr options; } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr; @@ -70,7 +70,7 @@ static const OptionInfoRec EXAOptions[] = { }; static Bool -exaXorgCloseScreen(int i, ScreenPtr pScreen) +exaXorgCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) @@ -83,24 +83,24 @@ exaXorgCloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv->options); free(pScreenPriv); - return pScreen->CloseScreen(i, pScreen); + return pScreen->CloseScreen(pScreen); } static void -exaXorgEnableDisableFBAccess(int index, Bool enable) +exaXorgEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); if (!enable) - exaEnableDisableFBAccess(index, enable); + exaEnableDisableFBAccess(pScreen, enable); if (pScreenPriv->SavedEnableDisableFBAccess) - pScreenPriv->SavedEnableDisableFBAccess(index, enable); + pScreenPriv->SavedEnableDisableFBAccess(pScrn, enable); if (enable) - exaEnableDisableFBAccess(index, enable); + exaEnableDisableFBAccess(pScreen, enable); } /** diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 0444d481c..d4b5558a7 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -775,10 +775,8 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, /* these can be hooked directly into ScrnInfoRec */ ModeStatus -fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (!fbdevHWSetMode(pScrn, mode, TRUE)) return MODE_BAD; @@ -786,10 +784,8 @@ fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) } Bool -fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; @@ -797,9 +793,8 @@ fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) } void -fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) +fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual || @@ -809,26 +804,22 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) fPtr->var.xoffset = x; fPtr->var.yoffset = y; if (-1 == ioctl(fPtr->fd, FBIOPAN_DISPLAY, (void *) &fPtr->var)) - xf86DrvMsgVerb(scrnIndex, X_WARNING, 5, + xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 5, "FBIOPAN_DISPLAY: %s\n", strerror(errno)); } Bool -fbdevHWEnterVT(int scrnIndex, int flags) +fbdevHWEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; - fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + fbdevHWAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0); return TRUE; } void -fbdevHWLeaveVT(int scrnIndex, int flags) +fbdevHWLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - fbdevHWRestore(pScrn); } diff --git a/hw/xfree86/fbdevhw/fbdevhw.h b/hw/xfree86/fbdevhw/fbdevhw.h index 536987101..4984ccf89 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.h +++ b/hw/xfree86/fbdevhw/fbdevhw.h @@ -44,14 +44,12 @@ extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO * colors, VisualPtr pVisual); -extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, +extern _X_EXPORT ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags); -extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, - int flags); -extern _X_EXPORT void fbdevHWAdjustFrame(int scrnIndex, int x, int y, - int flags); -extern _X_EXPORT Bool fbdevHWEnterVT(int scrnIndex, int flags); -extern _X_EXPORT void fbdevHWLeaveVT(int scrnIndex, int flags); +extern _X_EXPORT Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y); +extern _X_EXPORT Bool fbdevHWEnterVT(ScrnInfoPtr pScrn); +extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn); extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode); diff --git a/hw/xfree86/fbdevhw/fbdevhwstub.c b/hw/xfree86/fbdevhw/fbdevhwstub.c index 6e0a470b8..b7b4d2e7d 100644 --- a/hw/xfree86/fbdevhw/fbdevhwstub.c +++ b/hw/xfree86/fbdevhw/fbdevhwstub.c @@ -131,30 +131,30 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, } ModeStatus -fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags) { return MODE_ERROR; } Bool -fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { return FALSE; } void -fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags) +fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags) { } Bool -fbdevHWEnterVT(int scrnIndex, int flags) +fbdevHWEnterVT(ScrnInfoPtr pScrn) { return FALSE; } void -fbdevHWLeaveVT(int scrnIndex, int flags) +fbdevHWLeaveVT(ScrnInfoPtr pScrn) { } diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c index 1273f4bab..2d261d4ce 100644 --- a/hw/xfree86/i2c/xf86i2c.c +++ b/hw/xfree86/i2c/xf86i2c.c @@ -709,6 +709,7 @@ xf86CreateI2CBusRec(void) if (b != NULL) { b->scrnIndex = -1; + b->pScrn = NULL; b->HoldTime = 5; /* 100 kHz bus */ b->BitTimeout = 5; b->ByteTimeout = 5; diff --git a/hw/xfree86/i2c/xf86i2c.h b/hw/xfree86/i2c/xf86i2c.h index 9a8fb21a3..e296d7d81 100644 --- a/hw/xfree86/i2c/xf86i2c.h +++ b/hw/xfree86/i2c/xf86i2c.h @@ -6,6 +6,7 @@ #define _XF86I2C_H #include "regionstr.h" +#include "xf86.h" typedef unsigned char I2CByte; typedef unsigned short I2CSlaveAddr; @@ -18,6 +19,7 @@ typedef struct _I2CDevRec *I2CDevPtr; typedef struct _I2CBusRec { char *BusName; int scrnIndex; + ScrnInfoPtr pScrn; void (*I2CUDelay) (I2CBusPtr b, int usec); diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index 8614e0b9b..5343e47e3 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -70,12 +70,12 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) void *base = 0; void *vbiosMem = 0; void *options = NULL; - int screen; legacyVGARec vga; + ScrnInfoPtr pScrn; - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; + pScrn = xf86FindScreenForEntity(entityIndex); - options = xf86HandleInt10Options(xf86Screens[screen], entityIndex); + options = xf86HandleInt10Options(pScrn, entityIndex); if (int10skip(options)) { free(options); @@ -89,7 +89,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->mem = &genericMem; pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv)); INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); - pInt->scrnIndex = screen; + pInt->pScrn = pScrn; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); /* FIXME: Shouldn't this be a failure case? Leaving dev as NULL seems like @@ -109,7 +109,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) INTPriv(pInt)->sysMem = sysMem; if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n"); goto error1; } @@ -148,7 +148,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) vbiosMem = (unsigned char *) base + bios_location; err = pci_device_read_rom(rom_device, vbiosMem); if (err) { - xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3) %s\n", + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (3) %s\n", strerror(err)); goto error1; } @@ -249,7 +249,6 @@ MapVRam(xf86Int10InfoPtr pInt) static void UnmapVRam(xf86Int10InfoPtr pInt) { - int screen = pInt->scrnIndex; int pagesize = getpagesize(); int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize; diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index 1e908778f..1c58cf7ae 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -125,7 +125,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt) if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ? */ if (num == 21 && X86_AH == 0x4e) { - xf86DrvMsg(pInt->scrnIndex, X_NOTICE, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_NOTICE, "Failing Find-Matching-File on non-PC" " (int 21, func 4e)\n"); X86_AX = 2; @@ -133,7 +133,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt) return 1; } else { - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "Ignoring int 0x%02x call\n", num); if (xf86GetVerbosity() > 3) { dump_registers(pInt); @@ -169,7 +169,7 @@ dump_code(xf86Int10InfoPtr pInt) int i; CARD32 lina = SEG_ADR((CARD32), X86_CS, IP); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", lina); for (i = 0; i < 0x10; i++) xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); @@ -182,19 +182,19 @@ dump_code(xf86Int10InfoPtr pInt) void dump_registers(xf86Int10InfoPtr pInt) { - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n", (unsigned long) X86_EAX, (unsigned long) X86_EBX, (unsigned long) X86_ECX, (unsigned long) X86_EDX); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n", (unsigned long) X86_ESP, (unsigned long) X86_EBP, (unsigned long) X86_ESI, (unsigned long) X86_EDI); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "CS=0x%4.4x, SS=0x%4.4x," " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n", X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS); - xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n", (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS); } @@ -337,7 +337,7 @@ x_inb(CARD16 port) } else if (port < 0x0100) { /* Don't interfere with mainboard */ val = 0; - xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "inb 0x%4.4x\n", port); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); @@ -395,7 +395,7 @@ x_outb(CARD16 port, CARD8 val) #ifdef __NOT_YET__ } else if (port < 0x0100) { /* Don't interfere with mainboard */ - xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "outb 0x%4.4x,0x%2.2x\n", port, val); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c index 96c598a53..160c5aedf 100644 --- a/hw/xfree86/int10/helper_mem.c +++ b/hw/xfree86/int10/helper_mem.c @@ -281,7 +281,7 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt) #define CHECK_V_SEGMENT_RANGE(x) \ if (((x) << 4) < V_BIOS) { \ - xf86DrvMsg(pInt->scrnIndex, X_ERROR, \ + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, \ "V_BIOS address 0x%lx out of range\n", \ (unsigned long)(x) << 4); \ return FALSE; \ @@ -306,17 +306,17 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base) CHECK_V_SEGMENT_RANGE(cs); vbiosMem = (unsigned char *) base + (cs << 4); - if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) { + if (int10_check_bios(pInt->pScrn->scrnIndex, cs, vbiosMem)) { break; } } if (segments[i] == ~0) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "No V_BIOS found\n"); return FALSE; } - xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", + xf86DrvMsg(pInt->pScrn->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", (unsigned long) cs); pInt->BIOSseg = cs; diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c index df347d4dd..5ead44f23 100644 --- a/hw/xfree86/int10/xf86int10.c +++ b/hw/xfree86/int10/xf86int10.c @@ -57,7 +57,7 @@ int_handler(xf86Int10InfoPtr pInt) ret = run_bios_int(num, pInt); if (!ret) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num); dump_registers(pInt); stack_trace(pInt); } @@ -257,7 +257,7 @@ int42_handler(xf86Int10InfoPtr pInt) /* DL = character column */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num); if (xf86GetVerbosity() > 3) { @@ -314,10 +314,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, " AL=0x%2.2x, BH=0x%2.2x," " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); @@ -339,10 +339,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, " AL=0x%2.2x, BH=0x%2.2x," " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); @@ -360,10 +360,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* AL = character */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at" " Cursor\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "BH=0x%2.2x\n", X86_BH); if (xf86GetVerbosity() > 3) { dump_registers(pInt); @@ -382,10 +382,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at" " Cursor\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", X86_AL, X86_BH, X86_BL, X86_CX); if (xf86GetVerbosity() > 3) { @@ -404,10 +404,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", X86_AL, X86_BH, X86_BL, X86_CX); if (xf86GetVerbosity() > 3) { @@ -450,10 +450,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: Nothing */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_AL, X86_BH, X86_CX, X86_DX); if (xf86GetVerbosity() > 3) { @@ -471,10 +471,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* Leave: AL = pixel value */ /* Not Implemented */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX, X86_DX); if (xf86GetVerbosity() > 3) { @@ -498,10 +498,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* which might or might not have been */ /* installed yet. */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n", X86_AL, X86_BH, X86_BL); if (xf86GetVerbosity() > 3) { @@ -564,10 +564,10 @@ int42_handler(xf86Int10InfoPtr pInt) /* which might or might not have been */ /* installed yet. */ { /* Localise */ - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n", pInt->num); - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3, "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x," " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n", X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP); @@ -840,7 +840,7 @@ int1A_handler(xf86Int10InfoPtr pInt) #endif return 1; default: - xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2, "int 0x1a subfunction\n"); dump_registers(pInt); if (xf86GetVerbosity() > 3) diff --git a/hw/xfree86/int10/xf86int10.h b/hw/xfree86/int10/xf86int10.h index 36b659fd7..6d564fc1a 100644 --- a/hw/xfree86/int10/xf86int10.h +++ b/hw/xfree86/int10/xf86int10.h @@ -21,10 +21,10 @@ /* int10 info structure */ typedef struct { int entityIndex; - int scrnIndex; - pointer cpuRegs; CARD16 BIOSseg; CARD16 inb40time; + ScrnInfoPtr pScrn; + pointer cpuRegs; char *BIOSScratch; int Flags; pointer private; diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index ab6ed5e32..2c8878fa7 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -716,7 +716,7 @@ xf86CrtcCreateScreenResources(ScreenPtr screen) * Clean up config on server reset */ static Bool -xf86CrtcCloseScreen(int index, ScreenPtr screen) +xf86CrtcCloseScreen(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); @@ -738,7 +738,7 @@ xf86CrtcCloseScreen(int index, ScreenPtr screen) } xf86RandR12CloseScreen(screen); - return screen->CloseScreen(index, screen); + return screen->CloseScreen(screen); } /* @@ -3009,7 +3009,7 @@ xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus) ScrnInfoPtr scrn = output->scrn; xf86MonPtr mon; - mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE); + mon = xf86DoEEDID(scrn, pDDCBus, TRUE); if (mon) xf86DDCApplyQuirks(scrn->scrnIndex, mon); diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c index fdec6cb4b..bb954ac4b 100644 --- a/hw/xfree86/modes/xf86DiDGA.c +++ b/hw/xfree86/modes/xf86DiDGA.c @@ -137,7 +137,7 @@ xf86_dga_get_viewport(ScrnInfoPtr scrn) static void xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags) { - scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags); + scrn->AdjustFrame(scrn, x, y); } static Bool diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index e6b205223..59b6f8217 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -515,7 +515,7 @@ xf86RandR12SetMode(ScreenPtr pScreen, Bool ret = TRUE; if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); + (*scrp->EnableDisableFBAccess) (scrp, FALSE); if (useVirtual) { scrp->virtualX = randrp->virtualX; scrp->virtualY = randrp->virtualY; @@ -568,7 +568,7 @@ xf86RandR12SetMode(ScreenPtr pScreen, xf86SetViewport(pScreen, pScreen->width, pScreen->height); xf86SetViewport(pScreen, 0, 0); if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); + (*scrp->EnableDisableFBAccess) (scrp, TRUE); return ret; } @@ -685,7 +685,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, } } if (pRoot && pScrn->vtSema) - (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE); + (*pScrn->EnableDisableFBAccess) (pScrn, FALSE); /* Let the driver update virtualX and virtualY */ if (!(*config->funcs->resize) (pScrn, width, height)) @@ -724,7 +724,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen, update_desktop_dimensions(); if (pRoot && pScrn->vtSema) - (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE); + (*pScrn->EnableDisableFBAccess) (pScrn, TRUE); #if RANDR_12_INTERFACE if (xf86RandR12Key && pScreen->root && ret) RRScreenSizeNotify(pScreen); @@ -1596,10 +1596,9 @@ xf86RandR12TellChanged(ScreenPtr pScreen) } static void -xf86RandR12PointerMoved(int scrnIndex, int x, int y) +xf86RandR12PointerMoved(ScrnInfoPtr pScrn, int x, int y) { - ScreenPtr pScreen = screenInfo.screens[scrnIndex]; - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int c; @@ -1688,10 +1687,9 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size) } static int -xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) +xf86RandR12ChangeGamma(ScrnInfoPtr pScrn, Gamma gamma) { CARD16 *points, *red, *green, *blue; - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn); int size; @@ -1723,10 +1721,9 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) } static Bool -xf86RandR12EnterVT(int screen_index, int flags) +xf86RandR12EnterVT(ScrnInfoPtr pScrn) { - ScreenPtr pScreen = screenInfo.screens[screen_index]; - ScrnInfoPtr pScrn = xf86Screens[screen_index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen); Bool ret; @@ -1734,7 +1731,7 @@ xf86RandR12EnterVT(int screen_index, int flags) if (randrp->orig_EnterVT) { pScrn->EnterVT = randrp->orig_EnterVT; - ret = pScrn->EnterVT(screen_index, flags); + ret = pScrn->EnterVT(pScrn); randrp->orig_EnterVT = pScrn->EnterVT; pScrn->EnterVT = xf86RandR12EnterVT; if (!ret) diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 26eefc8c0..6a661e195 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -250,17 +250,16 @@ xf86RotateRedisplay(ScreenPtr pScreen) } static void -xf86RotateBlockHandler(int screenNum, pointer blockData, +xf86RotateBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[screenNum]; - ScrnInfoPtr pScrn = xf86Screens[screenNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); Bool rotation_active; rotation_active = xf86RotateRedisplay(pScreen); pScreen->BlockHandler = xf86_config->BlockHandler; - (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); + (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask); /* cannot avoid re-wrapping until all wrapping is audited */ xf86_config->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = xf86RotateBlockHandler; diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index fa58a72b6..8bca37524 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -52,7 +52,6 @@ typedef struct { int highMem; char *base; char *base_high; - int screen; char *alloc; } linuxInt10Priv; @@ -89,15 +88,16 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) memType cs; legacyVGARec vga; Bool videoBiosMapped = FALSE; - + ScrnInfoPtr pScrn; if (int10Generation != serverGeneration) { counter = 0; int10Generation = serverGeneration; } - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; + pScrn = xf86FindScreenForEntity(entityIndex); + screen = pScrn->scrnIndex; - options = xf86HandleInt10Options(xf86Screens[screen], entityIndex); + options = xf86HandleInt10Options(pScrn, entityIndex); if (int10skip(options)) { free(options); @@ -106,7 +106,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) #if defined DoSubModules if (loadedSubModule == INT10_NOT_LOADED) - loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]); + loadedSubModule = int10LinuxLoadSubModule(pScrn); if (loadedSubModule == INT10_LOAD_FAILED) return NULL; @@ -145,7 +145,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec)); - pInt->scrnIndex = screen; + pInt->pScrn = pScrn; pInt->entityIndex = entityIndex; pInt->dev = xf86GetPciInfoForEntity(entityIndex); @@ -154,7 +154,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) pInt->mem = &linuxMem; pagesize = getpagesize(); pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv)); - ((linuxInt10Priv *) pInt->private)->screen = screen; ((linuxInt10Priv *) pInt->private)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize)); @@ -333,28 +332,28 @@ MapCurrentInt10(xf86Int10InfoPtr pInt) addr = shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND); if (addr == SHMERRORPTR) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "shmat(low_mem) error: %s\n", strerror(errno)); return FALSE; } if (mprotect((void *) 0, V_RAM, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot set EXEC bit on low memory: %s\n", strerror(errno)); if (((linuxInt10Priv *) pInt->private)->highMem >= 0) { addr = shmat(((linuxInt10Priv *) pInt->private)->highMem, (char *) HIGH_MEM, 0); if (addr == SHMERRORPTR) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() high memory\n"); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "shmget error: %s\n", strerror(errno)); return FALSE; } if (mprotect((void *) HIGH_MEM, HIGH_MEM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot set EXEC bit on high memory: %s\n", strerror(errno)); } @@ -364,13 +363,13 @@ MapCurrentInt10(xf86Int10InfoPtr pInt) PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED | MAP_FIXED, fd, V_BIOS) == MAP_FAILED) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot map V_BIOS\n"); close(fd); return FALSE; } } else { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM); return FALSE; } close(fd); diff --git a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c index 8502b21b7..187698399 100644 --- a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c +++ b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c @@ -210,19 +210,19 @@ vm86_GP_fault(xf86Int10InfoPtr pInt) return FALSE; case 0x0f: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP); goto op0ferr; default: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown reason for exception\n"); op0ferr: dump_registers(pInt); stack_trace(pInt); dump_code(pInt); - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "cannot continue\n"); return FALSE; } /* end of switch() */ return TRUE; @@ -238,7 +238,7 @@ do_vm86(xf86Int10InfoPtr pInt) xf86InterceptSignals(NULL); if (signo >= 0) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "vm86() syscall generated signal %d.\n", signo); dump_registers(pInt); dump_code(pInt); @@ -252,7 +252,7 @@ do_vm86(xf86Int10InfoPtr pInt) return 0; break; case VM86_STI: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "vm86_sti :-((\n"); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); @@ -260,7 +260,7 @@ do_vm86(xf86Int10InfoPtr pInt) case VM86_INTx: pInt->num = VM86_ARG(retval); if (!int_handler(pInt)) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); dump_registers(pInt); dump_code(pInt); @@ -275,10 +275,10 @@ do_vm86(xf86Int10InfoPtr pInt) * we used to warn here and bail out - but now the sigio stuff * always fires signals at us. So we just ignore them for now. */ - xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n"); + xf86DrvMsg(pInt->pScrn->scrnIndex, X_WARNING, "received signal\n"); return 0; default: - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", + xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", VM86_ARG(retval), VM86_TYPE(retval)); dump_registers(pInt); dump_code(pInt); diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index 7fd70fc34..15e2ada78 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -43,14 +43,14 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { static void xf86CursorInstallColormap(ColormapPtr); static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool); -static Bool xf86CursorCloseScreen(int, ScreenPtr); +static Bool xf86CursorCloseScreen(ScreenPtr); static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *, ScreenPtr); /* ScrnInfoRec functions */ -static void xf86CursorEnableDisableFBAccess(int, Bool); -static Bool xf86CursorSwitchMode(int, DisplayModePtr, int); +static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr, Bool); +static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr); Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) @@ -118,7 +118,7 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) /***** Screen functions *****/ static Bool -xf86CursorCloseScreen(int i, ScreenPtr pScreen) +xf86CursorCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); miPointerScreenPtr PointPriv = @@ -149,7 +149,7 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen) free(ScreenPriv->transparentData); free(ScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void @@ -203,11 +203,11 @@ xf86CursorRecolorCursor(DeviceIntPtr pDev, /***** ScrnInfoRec functions *********/ static void -xf86CursorEnableDisableFBAccess(int index, Bool enable) +xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { DeviceIntPtr pDev = inputInfo.pointer; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); @@ -223,7 +223,7 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable) } if (ScreenPriv->EnableDisableFBAccess) - (*ScreenPriv->EnableDisableFBAccess) (index, enable); + (*ScreenPriv->EnableDisableFBAccess) (pScrn, enable); if (enable && ScreenPriv->SavedCursor) { /* @@ -237,10 +237,10 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable) } static Bool -xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) +xf86CursorSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool ret; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); @@ -250,7 +250,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) ScreenPriv->isUp = FALSE; } - ret = (*ScreenPriv->SwitchMode) (index, mode, flags); + ret = (*ScreenPriv->SwitchMode) (pScrn, mode); /* * Cannot restore cursor here because the new frame[XY][01] haven't been diff --git a/hw/xfree86/ramdac/xf86CursorPriv.h b/hw/xfree86/ramdac/xf86CursorPriv.h index 062b2eb7c..d04f93207 100644 --- a/hw/xfree86/ramdac/xf86CursorPriv.h +++ b/hw/xfree86/ramdac/xf86CursorPriv.h @@ -26,7 +26,7 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; Bool PalettedCursor; ColormapPtr pInstalledMap; - Bool (*SwitchMode) (int, DisplayModePtr, int); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); xf86EnableDisableFBAccessProc *EnableDisableFBAccess; CursorPtr SavedCursor; diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c index 5aeee6cbf..614501770 100644 --- a/hw/xfree86/shadowfb/shadow.c +++ b/hw/xfree86/shadowfb/shadow.c @@ -28,13 +28,13 @@ #include "picturestr.h" -static Bool ShadowCloseScreen(int i, ScreenPtr pScreen); +static Bool ShadowCloseScreen(ScreenPtr pScreen); static void ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn); static Bool ShadowCreateGC(GCPtr pGC); -static Bool ShadowEnterVT(int index, int flags); -static void ShadowLeaveVT(int index, int flags); +static Bool ShadowEnterVT(ScrnInfoPtr pScrn); +static void ShadowLeaveVT(ScrnInfoPtr pScrn); static void ShadowComposite(CARD8 op, PicturePtr pSrc, @@ -56,8 +56,8 @@ typedef struct { CreateGCProcPtr CreateGC; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; CompositeProcPtr Composite; - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); Bool vtSema; } ShadowScreenRec, *ShadowScreenPtr; @@ -192,14 +192,13 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea) /**********************************************************/ static Bool -ShadowEnterVT(int index, int flags) +ShadowEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; Bool ret; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); pScrn->EnterVT = pPriv->EnterVT; - ret = (*pPriv->EnterVT) (index, flags); + ret = (*pPriv->EnterVT) (pScrn); pPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = ShadowEnterVT; if (ret) { @@ -211,15 +210,14 @@ ShadowEnterVT(int index, int flags) } static void -ShadowLeaveVT(int index, int flags) +ShadowLeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen); + ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen); pPriv->vtSema = FALSE; pScrn->LeaveVT = pPriv->LeaveVT; - (*pPriv->LeaveVT) (index, flags); + (*pPriv->LeaveVT) (pScrn); pPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = ShadowLeaveVT; } @@ -227,7 +225,7 @@ ShadowLeaveVT(int index, int flags) /**********************************************************/ static Bool -ShadowCloseScreen(int i, ScreenPtr pScreen) +ShadowCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); @@ -247,7 +245,7 @@ ShadowCloseScreen(int i, ScreenPtr pScreen) free((pointer) pPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c index bbb60e3a1..97a9bcf60 100644 --- a/hw/xfree86/vbe/vbe.c +++ b/hw/xfree86/vbe/vbe.c @@ -179,7 +179,7 @@ static Bool vbeProbeDDC(vbeInfoPtr pVbe) { const char *ddc_level; - int screen = pVbe->pInt10->scrnIndex; + int screen = pVbe->pInt10->pScrn->scrnIndex; if (pVbe->ddc == DDC_NONE) return FALSE; @@ -262,7 +262,8 @@ vbeReadEDID(vbeInfoPtr pVbe) unsigned char *tmp = NULL; Bool novbe = FALSE; Bool noddc = FALSE; - int screen = pVbe->pInt10->scrnIndex; + ScrnInfoPtr pScrn = pVbe->pInt10->pScrn; + int screen = pScrn->scrnIndex; OptionInfoPtr options; if (!page) @@ -270,7 +271,7 @@ vbeReadEDID(vbeInfoPtr pVbe) options = xnfalloc(sizeof(VBEOptions)); (void) memcpy(options, VBEOptions, sizeof(VBEOptions)); - xf86ProcessOptions(screen, xf86Screens[screen]->options, options); + xf86ProcessOptions(screen, pScrn->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); free(options); @@ -330,7 +331,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) if (!(pModule = pDDCModule)) { pModule = - xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc"); + xf86LoadSubModule(pVbe->pInt10->pScrn, "ddc"); if (!pModule) return NULL; } @@ -340,7 +341,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) if (!DDC_data) return NULL; - pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data); + pMonitor = xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); if (!pDDCModule) xf86UnloadSubModule(pModule); @@ -598,7 +599,7 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, */ if ((pVbe->version & 0xff00) > 0x100) { - int screen = pVbe->pInt10->scrnIndex; + int screen = pVbe->pInt10->pScrn->scrnIndex; if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) { /* Query amount of memory to save state */ @@ -904,7 +905,7 @@ VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) m->n = id; m->next = ModeList; - xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3, + xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3, "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", m->n, m->width, m->height, m->bpp); @@ -1026,23 +1027,22 @@ VBEDPMSSet(vbeInfoPtr pVbe, int mode) } void -VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data) +VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; DisplayModePtr mode; const float PANEL_HZ = 60.0; if (!data) return; - xf86DrvMsg(scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", data->hsize, data->vsize); if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh) return; if (data->hsize < 320 || data->vsize < 240) { - xf86DrvMsg(scrnIndex, X_INFO, "...which I refuse to believe\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "...which I refuse to believe\n"); return; } @@ -1069,7 +1069,7 @@ VBEReadPanelID(vbeInfoPtr pVbe) int RealOff = pVbe->real_mode_base; pointer page = pVbe->memory; void *tmp = NULL; - int screen = pVbe->pInt10->scrnIndex; + int screen = pVbe->pInt10->pScrn->scrnIndex; pVbe->pInt10->ax = 0x4F11; pVbe->pInt10->bx = 0x01; diff --git a/hw/xfree86/vbe/vbe.h b/hw/xfree86/vbe/vbe.h index 81be0ff40..3907c53f3 100644 --- a/hw/xfree86/vbe/vbe.h +++ b/hw/xfree86/vbe/vbe.h @@ -350,7 +350,7 @@ struct vbePanelID { char reserved[14]; }; -extern _X_EXPORT void VBEInterpretPanelID(int scrnIndex, +extern _X_EXPORT void VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data); extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe); diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 48d0605fa..f146f3adf 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -27,7 +27,7 @@ #define MIN_OFFPIX_SIZE (320*200) -static Bool XAACloseScreen(int i, ScreenPtr pScreen); +static Bool XAACloseScreen(ScreenPtr pScreen); static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); @@ -36,10 +36,10 @@ static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint); static Bool XAADestroyPixmap(PixmapPtr pPixmap); -static Bool XAAEnterVT(int index, int flags); -static void XAALeaveVT(int index, int flags); -static int XAASetDGAMode(int index, int num, DGADevicePtr devRet); -static void XAAEnableDisableFBAccess(int index, Bool enable); +static Bool XAAEnterVT(ScrnInfoPtr pScrn); +static void XAALeaveVT(ScrnInfoPtr pScrn); +static int XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet); +static void XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable); static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask); static DevPrivateKeyRec XAAScreenKeyRec; @@ -214,7 +214,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) } static Bool -XAACloseScreen(int i, ScreenPtr pScreen) +XAACloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XAAScreenPtr pScreenPriv = @@ -238,7 +238,7 @@ XAACloseScreen(int i, ScreenPtr pScreen) free((pointer) pScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void @@ -509,26 +509,24 @@ XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask) /* These two aren't really needed for anything */ static Bool -XAAEnterVT(int index, int flags) +XAAEnterVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; Bool ret; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XAAScreenPtr pScreenPriv = (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); pScrn->EnterVT = pScreenPriv->EnterVT; - ret = ((*pScreenPriv->EnterVT) (index, flags)); + ret = ((*pScreenPriv->EnterVT) (pScrn)); pScreenPriv->EnterVT = pScrn->EnterVT; pScrn->EnterVT = XAAEnterVT; return ret; } static void -XAALeaveVT(int index, int flags) +XAALeaveVT(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XAAScreenPtr pScreenPriv = (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; @@ -539,7 +537,7 @@ XAALeaveVT(int index, int flags) } pScrn->LeaveVT = pScreenPriv->LeaveVT; - (*pScreenPriv->LeaveVT) (index, flags); + (*pScreenPriv->LeaveVT) (pScrn); pScreenPriv->LeaveVT = pScrn->LeaveVT; pScrn->LeaveVT = XAALeaveVT; } @@ -551,9 +549,9 @@ typedef struct { } SavedCacheState, *SavedCacheStatePtr; static int -XAASetDGAMode(int index, int num, DGADevicePtr devRet) +XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); @@ -569,7 +567,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet) infoRec->dgaSaves = NULL; } - ret = (*pScreenPriv->SetDGAMode) (index, num, devRet); + ret = (*pScreenPriv->SetDGAMode) (pScrn, num, devRet); if (ret != Success) return ret; @@ -612,9 +610,9 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet) } static void -XAAEnableDisableFBAccess(int index, Bool enable) +XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); @@ -627,7 +625,7 @@ XAAEnableDisableFBAccess(int index, Bool enable) SwitchedOut = TRUE; } - (*pScreenPriv->EnableDisableFBAccess) (index, enable); + (*pScreenPriv->EnableDisableFBAccess) (pScrn, enable); if (enable) { if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps)) diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h index c028ef033..61d9eebe5 100644 --- a/hw/xfree86/xaa/xaalocal.h +++ b/hw/xfree86/xaa/xaalocal.h @@ -47,10 +47,10 @@ typedef struct _XAAScreen { DestroyPixmapProcPtr DestroyPixmap; ChangeWindowAttributesProcPtr ChangeWindowAttributes; XAAInfoRecPtr AccelInfoRec; - Bool (*EnterVT) (int, int); - void (*LeaveVT) (int, int); - int (*SetDGAMode) (int, int, DGADevicePtr); - void (*EnableDisableFBAccess) (int, Bool); + Bool (*EnterVT) (ScrnInfoPtr); + void (*LeaveVT) (ScrnInfoPtr); + int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr); + void (*EnableDisableFBAccess) (ScrnInfoPtr, Bool); CompositeProcPtr Composite; GlyphsProcPtr Glyphs; } XAAScreenRec, *XAAScreenPtr; |