Commit 41151f88 authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

xf86: migrate to using xf86ScreenToScrn wrapper (v2)

migrate to new helper API.

This just wraps all the obvious uses of xf86Screens[pScreen->myNum],
and should be fairly simple to review.

v2: remove commented out lines.
Reviewed-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 53932b38
......@@ -961,7 +961,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__GLXDRIscreen *screen;
Bool isCapable;
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
!DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
......
......@@ -686,7 +686,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
const char *driverName, *deviceName;
__GLXDRIscreen *screen;
size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
screen = calloc(1, sizeof *screen);
if (screen == NULL)
......
......@@ -100,7 +100,7 @@ typedef struct {
Bool
DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DGAScreenPtr pScreenPriv;
int i;
......
......@@ -57,7 +57,7 @@ Bool
xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
{
#ifdef DPMSExtension
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DPMSPtr pDPMS;
pointer DPMSOpt;
MessageType enabled_from;
......
......@@ -1577,7 +1577,7 @@ xf86SetBackingStore(ScreenPtr pScreen)
{
Bool useBS = FALSE;
MessageType from = X_DEFAULT;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
OptionInfoPtr options;
options = xnfalloc(sizeof(BSOptions));
......@@ -1618,7 +1618,7 @@ xf86SetSilkenMouse(ScreenPtr pScreen)
{
Bool useSM = TRUE;
MessageType from = X_DEFAULT;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
OptionInfoPtr options;
options = xnfalloc(sizeof(SMOptions));
......
......@@ -106,7 +106,7 @@ xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
{
int vga_count;
int rsrc_decodes;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (vga_no_arb)
return TRUE;
......@@ -173,7 +173,7 @@ xf86VGAarbiterWrapFunctions(void)
for (i = 0; i < xf86NumScreens; i++) {
pScreen = xf86Screens[i]->pScreen;
ps = GetPictureScreenIfSet(pScreen);
pScrn = xf86Screens[pScreen->myNum];
pScrn = xf86ScreenToScrn(pScreen);
PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
if (!dixRegisterPrivateKey
......@@ -224,7 +224,7 @@ static Bool
VGAarbiterCloseScreen(int i, ScreenPtr pScreen)
{
Bool val;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
VGAarbiterScreenPtr pScreenPriv =
(VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
VGAarbiterScreenKey);
......@@ -298,9 +298,7 @@ VGAarbiterGetImage(DrawablePtr pDrawable,
ScreenPtr pScreen = pDrawable->pScreen;
SCREEN_PROLOG(GetImage);
// if (xf86Screens[pScreen->myNum]->vtSema) {
VGAGet(pScreen);
// }
(*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
VGAPut();
SCREEN_EPILOG(GetImage, VGAarbiterGetImage);
......
......@@ -95,7 +95,7 @@
static inline void
VGAGet(ScreenPtr pScreen)
{
pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev);
pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev);
pci_device_vgaarb_lock();
}
......
......@@ -66,7 +66,7 @@
#define LOAD_PALETTE(pmap) \
((pmap == GetInstalledmiColormap(pmap->pScreen)) && \
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode))
xf86ScreenToScrn(pmap->pScreen)->vtSema || pScreenPriv->isDGAmode))
typedef struct _CMapLink {
ColormapPtr cmap;
......@@ -151,7 +151,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
xf86LoadPaletteProc * loadPalette,
xf86SetOverscanProc * setOverscan, unsigned int flags)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ColormapPtr pDefMap = NULL;
CMapScreenPtr pScreenPriv;
LOCO *gamma;
......@@ -511,7 +511,7 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev)
pScreenPriv->isDGAmode = DGAActive(index);
if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
&& xf86Screens[pScreen->myNum]->vtSema)
&& xf86ScreenToScrn(pScreen)->vtSema)
CMapReinstallMap(GetInstalledmiColormap(pScreen));
return ret;
......@@ -528,7 +528,7 @@ CMapReinstallMap(ColormapPtr pmap)
CMapScreenKey);
CMapColormapPtr cmapPriv =
(CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen);
int i = cmapPriv->numColors;
int *indices = pScreenPriv->PreAllocIndices;
......@@ -560,7 +560,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices)
CMapColormapPtr pColPriv =
(CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
VisualPtr pVisual = pmap->pVisual;
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen);
int numColors, i;
LOCO *gamma, *colors;
EntryPtr entry;
......@@ -692,7 +692,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
CMapScreenKey);
CMapColormapPtr pColPriv =
(CMapColormapPtr) dixLookupPrivate(&pmap->devPrivates, CMapColormapKey);
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pmap->pScreen);
VisualPtr pVisual = pmap->pVisual;
int i;
LOCO *colors;
......@@ -833,7 +833,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
{
CMapScreenPtr pScreenPriv =
(CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateColormap = pScreenPriv->CreateColormap;
......@@ -1008,7 +1008,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen,
unsigned short *red,
unsigned short *green, unsigned short *blue)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CMapColormapPtr pColPriv;
CMapScreenPtr pScreenPriv;
CMapLinkPtr pLink;
......@@ -1085,7 +1085,7 @@ xf86ChangeGammaRamp(ScreenPtr pScreen,
int
xf86GetGammaRampSize(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CMapScreenPtr pScreenPriv;
if (xf86_crtc_supports_gamma(pScrn)) {
......@@ -1112,7 +1112,7 @@ xf86GetGammaRamp(ScreenPtr pScreen,
unsigned short *red,
unsigned short *green, unsigned short *blue)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CMapScreenPtr pScreenPriv;
LOCO *entry;
int shift, sigbits;
......@@ -1172,7 +1172,7 @@ xf86GetGammaRamp(ScreenPtr pScreen,
int
xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->ChangeGamma)
return (*pScrn->ChangeGamma) (pScreen->myNum, gamma);
......
......@@ -1186,7 +1186,7 @@ xf86FBCloseScreen(int i, ScreenPtr pScreen)
Bool
xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
RegionRec ScreenRegion;
RegionRec FullRegion;
BoxRec ScreenBox;
......@@ -1223,7 +1223,7 @@ xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)
Bool
xf86InitFBManagerArea(ScreenPtr pScreen, int PixelArea, int Verbosity)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xRectangle Rect[3];
RegionPtr pRegion, pScreenRegion;
int nRect;
......
......@@ -271,7 +271,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
if (!ScreenPriv)
return FALSE;
pScrn = xf86Screens[pScreen->myNum];
pScrn = xf86ScreenToScrn(pScreen);
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures;
......@@ -356,7 +356,7 @@ static Bool
xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
{
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XF86VideoAdaptorPtr adaptorPtr;
XvAdaptorPtr pAdaptor, pa;
XvAdaptorRecPrivatePtr adaptorPriv;
......@@ -1150,7 +1150,7 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
pScreen = pLayerWin->drawable.pScreen;
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
pScrn = xf86Screens[pScreen->myNum];
pScrn = xf86ScreenToScrn(pScreen);
xf86XVReputOrStopAllPorts(pScrn, TRUE);
......@@ -1257,7 +1257,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
static Bool
xf86XVCloseScreen(int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
XvAdaptorPtr pa;
......@@ -1899,7 +1899,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
xRectangle *rects;
GCPtr gc;
if (!xf86Screens[pScreen->myNum]->vtSema)
if (!xf86ScreenToScrn(pScreen)->vtSema)
return;
gc = GetScratchGC(pDraw->depth, pScreen);
......
......@@ -64,7 +64,7 @@ xf86XvMCCreateContext(XvPortPtr pPort,
XvMCContextPtr pContext, int *num_priv, CARD32 **priv)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
......@@ -78,7 +78,7 @@ static void
xf86XvMCDestroyContext(XvMCContextPtr pContext)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn,
pContext);
......@@ -89,7 +89,7 @@ xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv)
{
XvMCContextPtr pContext = pSurface->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn,
pSurface,
......@@ -102,7 +102,7 @@ xf86XvMCDestroySurface(XvMCSurfacePtr pSurface)
{
XvMCContextPtr pContext = pSurface->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn,
pSurface);
......@@ -114,7 +114,7 @@ xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture,
{
XvMCContextPtr pContext = pSubpicture->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
return (*pScreenPriv->adaptors[pContext->adapt_num]->
CreateSubpicture) (pScrn, pSubpicture, num_priv, priv);
......@@ -125,7 +125,7 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture)
{
XvMCContextPtr pContext = pSubpicture->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn,
pSubpicture);
......
......@@ -9061,7 +9061,7 @@ static Bool
ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
/* Get the ScrnInfoRec */
pScrn = xf86Screens[pScreen-&gt;myNum];
pScrn = xf86ScreenToScrn(pScreen);
/*
* If using the vgahw module, its data structures and related
......
......@@ -315,7 +315,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
int reserved_count;
int i;
DRIEntPrivPtr pDRIEntPriv;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DRIContextFlags flags = 0;
DRIContextPrivPtr pDRIContextPriv;
......@@ -615,7 +615,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify;
}
if (pDRIInfo->wrap.AdjustFrame) {
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame;
......@@ -634,7 +634,7 @@ DRICloseScreen(ScreenPtr pScreen)
DRIInfoPtr pDRIInfo;
drm_context_t *reserved;
int reserved_count;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
Bool closeMaster;
......@@ -672,7 +672,7 @@ DRICloseScreen(ScreenPtr pScreen)
pDRIPriv->wrap.ClipNotify = NULL;
}
if (pDRIInfo->wrap.AdjustFrame) {
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
pDRIPriv->wrap.AdjustFrame = NULL;
......@@ -2311,7 +2311,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
{
ScreenPtr pScreen = screenInfo.screens[scrnIndex];
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
int px, py;
if (!pDRIPriv || !pDRIPriv->pSAREA) {
......
......@@ -112,7 +112,7 @@ exaDDXDriverInit(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
/* Do NOT use XF86SCRNINFO macro here!! */
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ExaXorgScreenPrivPtr pScreenPriv;
if (!dixRegisterPrivateKey(&exaXorgScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
......
......@@ -866,7 +866,7 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
Bool
fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
unsigned long unblank;
......
......@@ -182,7 +182,7 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen)
{
int subpixel_order = SubPixelUnknown;
Bool has_none = FALSE;
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
int c, o;
......@@ -698,7 +698,7 @@ xf86OutputDestroy(xf86OutputPtr output)
static Bool
xf86CrtcCreateScreenResources(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
screen->CreateScreenResources = config->CreateScreenResources;
......@@ -718,7 +718,7 @@ xf86CrtcCreateScreenResources(ScreenPtr screen)
static Bool
xf86CrtcCloseScreen(int index, ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o, c;
......@@ -751,7 +751,7 @@ Bool
#endif
xf86CrtcScreenInit(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int c;
......@@ -2823,7 +2823,7 @@ xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
Bool
xf86SaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (xf86IsUnblank(mode))
xf86DPMSSet(pScrn, DPMSModeOn, 0);
......@@ -3151,7 +3151,7 @@ xf86_crtc_notify_proc_ptr
xf86_wrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
{
if (xf86CrtcConfigPrivateIndex != -1) {
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
xf86_crtc_notify_proc_ptr old;
......@@ -3166,7 +3166,7 @@ void
xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
{
if (xf86CrtcConfigPrivateIndex != -1) {
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
config->xf86_crtc_notify = old;
......@@ -3176,7 +3176,7 @@ xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
void
xf86_crtc_notify(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
if (config->xf86_crtc_notify)
......
......@@ -477,7 +477,7 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
static Bool
xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
......@@ -496,7 +496,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
static Bool
xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
......@@ -564,7 +564,7 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor)
Bool
xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info;
......@@ -631,7 +631,7 @@ xf86_reload_cursors(ScreenPtr screen)
if (!cursor_screen_priv || !cursor_screen_priv->isUp)
return;
scrn = xf86Screens[screen->myNum];
scrn = xf86ScreenToScrn(screen);
xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
/* make sure the cursor code has been initialized */
......@@ -667,7 +667,7 @@ xf86_reload_cursors(ScreenPtr screen)
void
xf86_cursors_fini(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
if (xf86_config->cursor_info) {
......
......@@ -41,7 +41,7 @@
static Bool
xf86_dga_get_modes(ScreenPtr pScreen)
{
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
DGAModePtr modes, mode;
DisplayModePtr display_mode;
......@@ -175,7 +175,7 @@ xf86DiDGAReInit(ScreenPtr pScreen)
Bool
_xf86_di_dga_reinit_internal(ScreenPtr pScreen)
{
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
if (!DGAAvailable(pScreen->myNum))
......@@ -197,7 +197,7 @@ xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address)
Bool
_xf86_di_dga_init_internal(ScreenPtr pScreen)
{
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86_config->dga_flags = 0;
......
......@@ -743,7 +743,7 @@ xf86RandR12GetRotation(ScreenPtr pScreen)
Bool
xf86RandR12CreateScreenResources(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config;
XF86RandRInfoPtr randrp;
int c;
......@@ -902,7 +902,7 @@ xf86RandR12CloseScreen(ScreenPtr pScreen)
randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT;
xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT;
#endif
free(randrp);
......@@ -914,7 +914,7 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations)
XF86RandRInfoPtr randrp;
#if RANDR_12_INTERFACE
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
int c;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
......@@ -939,7 +939,7 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
XF86RandRInfoPtr randrp;
#if RANDR_13_INTERFACE
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
int c;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
......@@ -1041,7 +1041,7 @@ static Bool
xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc)
{
ScreenPtr pScreen = randr_crtc->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
RRModePtr randr_mode = NULL;
int x;
......@@ -1136,7 +1136,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
int num_randr_outputs, RROutputPtr * randr_outputs)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcPtr crtc = randr_crtc->devPrivate;
RRTransformPtr transform;
......@@ -1349,7 +1349,7 @@ static Bool
xf86RandR12OutputValidateMode(ScreenPtr pScreen,
RROutputPtr randr_output, RRModePtr randr_mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86OutputPtr output = randr_output->devPrivate;
DisplayModeRec mode;
......@@ -1434,7 +1434,7 @@ xf86RROutputSetModes(RROutputPtr randr_output, DisplayModePtr modes)
static Bool
xf86RandR12SetInfo12(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
RROutputPtr *clones;
RRCrtcPtr *crtcs;
......@@ -1510,7 +1510,7 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
static Bool
xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (!pScrn->vtSema)
return TRUE;
......@@ -1522,7 +1522,7 @@ xf86RandR12GetInfo12(ScreenPtr pScreen, Rotation * rotations)
static Bool
xf86RandR12CreateObjects12(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
int o;
......@@ -1559,7 +1559,7 @@ static Bool
xf86RandR12CreateScreenResources12(ScreenPtr pScreen)
{
int c;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
if (xf86RandR12Key == NULL)
......@@ -1581,7 +1581,7 @@ xf86RandR12CreateScreenResources12(ScreenPtr pScreen)
void
xf86RandR12TellChanged(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
......@@ -1751,7 +1751,7 @@ xf86RandR12EnterVT(int screen_index, int flags)
static Bool