[PATCH 03/19] xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break)

Dave Airlie airlied at gmail.com
Mon May 14 09:40:56 PDT 2012


This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr
instead of an index into xf86Screens. This allows dropping more
public dereferences of the xf86Screens and screenInfo.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 glx/glxdri.c                           |   14 ++++++--------
 glx/glxdri2.c                          |   14 ++++++--------
 hw/xfree86/common/xf86Events.c         |    6 +++---
 hw/xfree86/common/xf86Init.c           |    2 +-
 hw/xfree86/common/xf86PM.c             |    4 ++--
 hw/xfree86/common/xf86VGAarbiter.c     |   14 ++++++--------
 hw/xfree86/common/xf86VGAarbiterPriv.h |    8 ++++----
 hw/xfree86/common/xf86cmap.c           |   11 +++++------
 hw/xfree86/common/xf86str.h            |    4 ++--
 hw/xfree86/common/xf86xv.c             |   18 ++++++++----------
 hw/xfree86/common/xf86xvpriv.h         |    4 ++--
 hw/xfree86/doc/ddxDesign.xml           |   10 ++++------
 hw/xfree86/fbdevhw/fbdevhw.c           |   10 +++-------
 hw/xfree86/fbdevhw/fbdevhw.h           |    4 ++--
 hw/xfree86/fbdevhw/fbdevhwstub.c       |    4 ++--
 hw/xfree86/modes/xf86RandR12.c         |    7 +++----
 hw/xfree86/shadowfb/shadow.c           |   20 +++++++++-----------
 hw/xfree86/xaa/xaaInit.c               |   18 ++++++++----------
 hw/xfree86/xaa/xaalocal.h              |    4 ++--
 19 files changed, 78 insertions(+), 98 deletions(-)

diff --git a/glx/glxdri.c b/glx/glxdri.c
index b2209c5..01c7167 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -846,18 +846,17 @@ static const __DRIextension *loader_extensions[] = {
 };
 
 static Bool
-glxDRIEnterVT(int index, int flags)
+glxDRIEnterVT(ScrnInfoPtr scrn, int flags)
 {
-    ScrnInfoPtr scrn = xf86Screens[index];
     Bool ret;
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(screenInfo.screens[index]);
+        glxGetScreen(xf86ScrnToScreen(scrn));
 
     LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
 
     scrn->EnterVT = screen->enterVT;
 
-    ret = scrn->EnterVT(index, flags);
+    ret = scrn->EnterVT(scrn, flags);
 
     screen->enterVT = scrn->EnterVT;
     scrn->EnterVT = glxDRIEnterVT;
@@ -871,18 +870,17 @@ glxDRIEnterVT(int index, int flags)
 }
 
 static void
-glxDRILeaveVT(int index, int flags)
+glxDRILeaveVT(ScrnInfoPtr scrn, int flags)
 {
-    ScrnInfoPtr scrn = xf86Screens[index];
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(screenInfo.screens[index]);
+        glxGetScreen(xf86ScrnToScreen(scrn));
 
     LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
 
     glxSuspendClients();
 
     scrn->LeaveVT = screen->leaveVT;
-    (*screen->leaveVT) (index, flags);
+    (*screen->leaveVT) (scrn, flags);
     screen->leaveVT = scrn->LeaveVT;
     scrn->LeaveVT = glxDRILeaveVT;
 }
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index cceb126..07fff30 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -587,18 +587,17 @@ static const __DRIextension *loader_extensions[] = {
 };
 
 static Bool
-glxDRIEnterVT(int index, int flags)
+glxDRIEnterVT(ScrnInfoPtr scrn, int flags)
 {
-    ScrnInfoPtr scrn = xf86Screens[index];
     Bool ret;
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(screenInfo.screens[index]);
+        glxGetScreen(xf86ScrnToScreen(scrn));
 
     LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
 
     scrn->EnterVT = screen->enterVT;
 
-    ret = scrn->EnterVT(index, flags);
+    ret = scrn->EnterVT(scrn, flags);
 
     screen->enterVT = scrn->EnterVT;
     scrn->EnterVT = glxDRIEnterVT;
@@ -612,18 +611,17 @@ glxDRIEnterVT(int index, int flags)
 }
 
 static void
-glxDRILeaveVT(int index, int flags)
+glxDRILeaveVT(ScrnInfoPtr scrn, int flags)
 {
-    ScrnInfoPtr scrn = xf86Screens[index];
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(screenInfo.screens[index]);
+        glxGetScreen(xf86ScrnToScreen(scrn));
 
     LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
 
     glxSuspendClients();
 
     scrn->LeaveVT = screen->leaveVT;
-    (*screen->leaveVT) (index, flags);
+    (*screen->leaveVT) (scrn, flags);
     screen->leaveVT = scrn->LeaveVT;
     scrn->LeaveVT = glxDRILeaveVT;
 }
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 5896f22..e301534 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -459,7 +459,7 @@ xf86VTSwitch(void)
 
         prevSIGIO = xf86BlockSIGIO();
         for (i = 0; i < xf86NumScreens; i++)
-            xf86Screens[i]->LeaveVT(i, 0);
+            xf86Screens[i]->LeaveVT(xf86Screens[i], 0);
 
         xf86AccessLeave();      /* We need this here, otherwise */
 
@@ -471,7 +471,7 @@ 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], 0))
                     FatalError("EnterVT failed for screen %d\n", i);
             }
             if (!(dispatchException & DE_TERMINATE)) {
@@ -527,7 +527,7 @@ 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], 0))
                 FatalError("EnterVT failed for screen %d\n", i);
         }
         for (i = 0; i < xf86NumScreens; i++) {
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ead47cc..46e2245 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1040,7 +1040,7 @@ AbortDDX(enum ExitCode error)
                  * screen explicitely.
                  */
                 xf86VGAarbiterLock(xf86Screens[i]);
-                (xf86Screens[i]->LeaveVT) (i, 0);
+                (xf86Screens[i]->LeaveVT) (xf86Screens[i], 0);
                 xf86VGAarbiterUnlock(xf86Screens[i]);
             }
     }
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index f69fffa..5af241f 100644
--- a/hw/xfree86/common/xf86PM.c
+++ b/hw/xfree86/common/xf86PM.c
@@ -114,7 +114,7 @@ suspend(pmEvent event, Bool undo)
         if (xf86Screens[i]->PMEvent)
             xf86Screens[i]->PMEvent(i, event, undo);
         else {
-            xf86Screens[i]->LeaveVT(i, 0);
+            xf86Screens[i]->LeaveVT(xf86Screens[i], 0);
             xf86Screens[i]->vtSema = FALSE;
         }
     }
@@ -134,7 +134,7 @@ resume(pmEvent event, Bool undo)
             xf86Screens[i]->PMEvent(i, event, undo);
         else {
             xf86Screens[i]->vtSema = TRUE;
-            xf86Screens[i]->EnterVT(i, 0);
+            xf86Screens[i]->EnterVT(xf86Screens[i], 0);
         }
     }
     xf86UnblockSIGIO(sigio_blocked_for_suspend);
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 217016e..24ee78a 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -492,18 +492,17 @@ VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
 }
 
 static Bool
-VGAarbiterEnterVT(int index, int flags)
+VGAarbiterEnterVT(ScrnInfoPtr pScrn, int flags)
 {
     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, flags);
     pScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = VGAarbiterEnterVT;
     VGAPut();
@@ -511,17 +510,16 @@ VGAarbiterEnterVT(int index, int flags)
 }
 
 static void
-VGAarbiterLeaveVT(int index, int flags)
+VGAarbiterLeaveVT(ScrnInfoPtr pScrn, int flags)
 {
-    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, flags);
     pScreenPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = VGAarbiterLeaveVT;
     VGAPut();
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index e0f4e53..c27483e 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -127,8 +127,8 @@ typedef struct _VGAarbiterScreen {
     SetCursorPositionProcPtr SetCursorPosition;
     void (*AdjustFrame) (int, int, int, int);
     Bool (*SwitchMode) (int, DisplayModePtr, int);
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
+    Bool (*EnterVT) (ScrnInfoPtr, int);
+    void (*LeaveVT) (ScrnInfoPtr, int);
     void (*FreeScreen) (int, int);
     miPointerSpriteFuncPtr miSprite;
     CompositeProcPtr Composite;
@@ -178,8 +178,8 @@ static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
                                         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 Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn, int flags);
+static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn, int flags);
 static void VGAarbiterFreeScreen(int index, int flags);
 
 /* GC funcs */
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index eacf714..11cd3b4 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -80,7 +80,7 @@ typedef struct {
     DestroyColormapProcPtr DestroyColormap;
     InstallColormapProcPtr InstallColormap;
     StoreColorsProcPtr StoreColors;
-    Bool (*EnterVT) (int, int);
+    Bool (*EnterVT) (ScrnInfoPtr, int);
     Bool (*SwitchMode) (int, DisplayModePtr, int);
     int (*SetDGAMode) (int, int, DGADevicePtr);
     xf86ChangeGammaProc *ChangeGamma;
@@ -115,7 +115,7 @@ static Bool CMapCloseScreen(ScreenPtr);
 static Bool CMapCreateColormap(ColormapPtr);
 static void CMapDestroyColormap(ColormapPtr);
 
-static Bool CMapEnterVT(int, int);
+static Bool CMapEnterVT(ScrnInfoPtr, int);
 static Bool CMapSwitchMode(int, DisplayModePtr, int);
 
 #ifdef XFreeXDGA
@@ -462,16 +462,15 @@ CMapInstallColormap(ColormapPtr pmap)
 /**** ScrnInfoRec functions ****/
 
 static Bool
-CMapEnterVT(int index, int flags)
+CMapEnterVT(ScrnInfoPtr pScrn, int flags)
 {
-    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, flags);
     pScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = CMapEnterVT;
     if (ret) {
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index ebfd7f7..d5d824c 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -648,8 +648,8 @@ 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 Bool xf86EnterVTProc(ScrnInfoPtr, int);
+typedef void xf86LeaveVTProc(ScrnInfoPtr, int);
 typedef void xf86FreeScreenProc(int, int);
 typedef ModeStatus xf86ValidModeProc(int, DisplayModePtr, Bool, int);
 typedef void xf86EnableDisableFBAccessProc(int, Bool);
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 82ae320..617a49f 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -101,8 +101,8 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
 
 /* ScrnInfoRec functions */
 
-static Bool xf86XVEnterVT(int, int);
-static void xf86XVLeaveVT(int, int);
+static Bool xf86XVEnterVT(ScrnInfoPtr, int);
+static void xf86XVLeaveVT(ScrnInfoPtr, int);
 static void xf86XVAdjustFrame(int index, int x, int y, int flags);
 static void xf86XVModeSet(ScrnInfoPtr pScrn);
 
@@ -1300,15 +1300,14 @@ xf86XVQueryAdaptors(ScreenPtr pScreen,
 /**** ScrnInfoRec fields ****/
 
 static Bool
-xf86XVEnterVT(int index, int flags)
+xf86XVEnterVT(ScrnInfoPtr pScrn, int flags)
 {
-    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, flags);
     ScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = xf86XVEnterVT;
 
@@ -1319,10 +1318,9 @@ xf86XVEnterVT(int index, int flags)
 }
 
 static void
-xf86XVLeaveVT(int index, int flags)
+xf86XVLeaveVT(ScrnInfoPtr pScrn, int flags)
 {
-    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;
@@ -1354,7 +1352,7 @@ xf86XVLeaveVT(int index, int flags)
     }
 
     pScrn->LeaveVT = ScreenPriv->LeaveVT;
-    (*ScreenPriv->LeaveVT) (index, flags);
+    (*ScreenPriv->LeaveVT) (pScrn, flags);
     ScreenPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = xf86XVLeaveVT;
 }
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 289ca58..fef92c4 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -42,8 +42,8 @@ typedef struct {
     WindowExposuresProcPtr WindowExposures;
     PostValidateTreeProcPtr PostValidateTree;
     void (*AdjustFrame) (int, int, int, int);
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
+    Bool (*EnterVT) (ScrnInfoPtr, int);
+    void (*LeaveVT) (ScrnInfoPtr, int);
     xf86ModeSetProc *ModeSet;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 0206833..64e871e 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -1577,7 +1577,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    Bool ChipEnterVT(int index, int flags);
+    Bool ChipEnterVT(ScrnInfoPtr pScrn, int flags);
 	  </programlisting>
 	  <blockquote><para>
       This function should initialise the current video mode and
@@ -1594,7 +1594,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    void ChipLeaveVT(int index, int flags);
+    void ChipLeaveVT(ScrnInfoPtr pScrn, int flags);
 	  </programlisting>
 	  <blockquote><para>
       This function should restore the saved video state.  If
@@ -9283,16 +9283,14 @@ ZZZAdjustFrame(int scrnIndex, int x, int y, int flags)
 
 	<programlisting>
 static Bool
-ZZZEnterVT(int scrnIndex, int flags)
+ZZZEnterVT(ScrnInfoPtr pScrn, int flags)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     return ZZZModeInit(pScrn, pScrn-&gt;currentMode);
 }
 
 static void
-ZZZLeaveVT(int scrnIndex, int flags)
+ZZZLeaveVT(ScrnInfoPtr pScrn, int flags)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     ZZZRestore(pScrn);
 }
 	</programlisting>
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 0444d48..0823f40 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -814,21 +814,17 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
 }
 
 Bool
-fbdevHWEnterVT(int scrnIndex, int flags)
+fbdevHWEnterVT(ScrnInfoPtr pScrn, int flags)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
         return FALSE;
-    fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+    fbdevHWAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
     return TRUE;
 }
 
 void
-fbdevHWLeaveVT(int scrnIndex, int flags)
+fbdevHWLeaveVT(ScrnInfoPtr pScrn, int flags)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     fbdevHWRestore(pScrn);
 }
 
diff --git a/hw/xfree86/fbdevhw/fbdevhw.h b/hw/xfree86/fbdevhw/fbdevhw.h
index 5369871..17cb196 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/hw/xfree86/fbdevhw/fbdevhw.h
@@ -50,8 +50,8 @@ 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 fbdevHWEnterVT(ScrnInfoPtr pScrn, int flags);
+extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn, int flags);
 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 6e0a470..6f0d076 100644
--- a/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -148,13 +148,13 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
 }
 
 Bool
-fbdevHWEnterVT(int scrnIndex, int flags)
+fbdevHWEnterVT(ScrnInfoPtr pScrn, int flags)
 {
     return FALSE;
 }
 
 void
-fbdevHWLeaveVT(int scrnIndex, int flags)
+fbdevHWLeaveVT(ScrnInfoPtr pScrn, int flags)
 {
 }
 
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index e6b2052..ef07a9d 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1723,10 +1723,9 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
 }
 
 static Bool
-xf86RandR12EnterVT(int screen_index, int flags)
+xf86RandR12EnterVT(ScrnInfoPtr pScrn, int flags)
 {
-    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 +1733,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, flags);
         randrp->orig_EnterVT = pScrn->EnterVT;
         pScrn->EnterVT = xf86RandR12EnterVT;
         if (!ret)
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index a44a1d0..feb0868 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -33,8 +33,8 @@ 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, int flags);
+static void ShadowLeaveVT(ScrnInfoPtr pScrn, int flags);
 
 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, int);
+    void (*LeaveVT) (ScrnInfoPtr, int);
     Bool vtSema;
 } ShadowScreenRec, *ShadowScreenPtr;
 
@@ -192,14 +192,13 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea)
 /**********************************************************/
 
 static Bool
-ShadowEnterVT(int index, int flags)
+ShadowEnterVT(ScrnInfoPtr pScrn, int flags)
 {
-    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, flags);
     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, int flags)
 {
-    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, flags);
     pPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = ShadowLeaveVT;
 }
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 8f59453..47734ce 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -36,8 +36,8 @@ 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 Bool XAAEnterVT(ScrnInfoPtr pScrn, int flags);
+static void XAALeaveVT(ScrnInfoPtr pScrn, int flags);
 static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
 static void XAAEnableDisableFBAccess(int index, Bool enable);
 static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
@@ -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, int flags)
 {
-    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, flags));
     pScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = XAAEnterVT;
     return ret;
 }
 
 static void
-XAALeaveVT(int index, int flags)
+XAALeaveVT(ScrnInfoPtr pScrn, int flags)
 {
-    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, flags);
     pScreenPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = XAALeaveVT;
 }
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index c028ef0..a7548d1 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -47,8 +47,8 @@ typedef struct _XAAScreen {
     DestroyPixmapProcPtr DestroyPixmap;
     ChangeWindowAttributesProcPtr ChangeWindowAttributes;
     XAAInfoRecPtr AccelInfoRec;
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
+    Bool (*EnterVT) (ScrnInfoPtr, int);
+    void (*LeaveVT) (ScrnInfoPtr, int);
     int (*SetDGAMode) (int, int, DGADevicePtr);
     void (*EnableDisableFBAccess) (int, Bool);
     CompositeProcPtr Composite;
-- 
1.7.6



More information about the xorg-devel mailing list