[PATCH 06/19] xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API)

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


This migrate the SwitchMode interface to take a ScrnInfoPtr
instead of an index.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/common/xf86Cursor.c         |    2 +-
 hw/xfree86/common/xf86VGAarbiter.c     |    6 +++---
 hw/xfree86/common/xf86VGAarbiterPriv.h |    4 ++--
 hw/xfree86/common/xf86cmap.c           |   10 +++++-----
 hw/xfree86/common/xf86str.h            |    2 +-
 hw/xfree86/doc/ddxDesign.xml           |    4 ++--
 hw/xfree86/fbdevhw/fbdevhw.c           |    4 +---
 hw/xfree86/fbdevhw/fbdevhw.h           |    2 +-
 hw/xfree86/fbdevhw/fbdevhwstub.c       |    2 +-
 hw/xfree86/ramdac/xf86Cursor.c         |    8 ++++----
 hw/xfree86/ramdac/xf86CursorPriv.h     |    2 +-
 11 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index dffdcdd..3461297 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -230,7 +230,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, 0);
     if (Switched) {
         pScr->currentMode = mode;
 
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 57941aa..3333608 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -477,16 +477,16 @@ VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
 }
 
 static Bool
-VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
+VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags)
 {
     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, flags);
     VGAPut();
     return val;
 }
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 946b45e..1069fd5 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -126,7 +126,7 @@ typedef struct _VGAarbiterScreen {
     RecolorCursorProcPtr RecolorCursor;
     SetCursorPositionProcPtr SetCursorPosition;
     void (*AdjustFrame) (ScrnInfoPtr, int, int, int);
-    Bool (*SwitchMode) (int, DisplayModePtr, int);
+    Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr, int);
     Bool (*EnterVT) (ScrnInfoPtr, int);
     void (*LeaveVT) (ScrnInfoPtr, int);
     void (*FreeScreen) (ScrnInfoPtr, int);
@@ -177,7 +177,7 @@ static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
                                         pScreen, int x, int y,
                                         Bool generateEvent);
 static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags);
-static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
+static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags);
 static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn, int flags);
 static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn, int flags);
 static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn, int flags);
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 11cd3b4..07b8af5 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -81,7 +81,7 @@ typedef struct {
     InstallColormapProcPtr InstallColormap;
     StoreColorsProcPtr StoreColors;
     Bool (*EnterVT) (ScrnInfoPtr, int);
-    Bool (*SwitchMode) (int, DisplayModePtr, int);
+    Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr, int);
     int (*SetDGAMode) (int, int, DGADevicePtr);
     xf86ChangeGammaProc *ChangeGamma;
     int maxColors;
@@ -116,7 +116,7 @@ static Bool CMapCreateColormap(ColormapPtr);
 static void CMapDestroyColormap(ColormapPtr);
 
 static Bool CMapEnterVT(ScrnInfoPtr, int);
-static Bool CMapSwitchMode(int, DisplayModePtr, int);
+static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr, int);
 
 #ifdef XFreeXDGA
 static int CMapSetDGAMode(int, int, DGADevicePtr);
@@ -482,13 +482,13 @@ CMapEnterVT(ScrnInfoPtr pScrn, int flags)
 }
 
 static Bool
-CMapSwitchMode(int index, DisplayModePtr mode, int flags)
+CMapSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags)
 {
-    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, flags)) {
         if (GetInstalledmiColormap(pScreen))
             CMapReinstallMap(GetInstalledmiColormap(pScreen));
         return TRUE;
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index cce09e7..2f9d1c7 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -646,7 +646,7 @@ 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 Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr, int);
 typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int, int);
 typedef Bool xf86EnterVTProc(ScrnInfoPtr, int);
 typedef void xf86LeaveVTProc(ScrnInfoPtr, int);
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 64e871e..1bafaf3 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -9245,9 +9245,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, int flags)
 {
-    return ZZZModeInit(xf86Screens[scrnIndex], mode);
+    return ZZZModeInit(pScrn, mode);
 }
 	</programlisting>
       </sect3>
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 3d85904..44ef9fe 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -786,10 +786,8 @@ fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
 }
 
 Bool
-fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     if (!fbdevHWSetMode(pScrn, mode, FALSE))
         return FALSE;
 
diff --git a/hw/xfree86/fbdevhw/fbdevhw.h b/hw/xfree86/fbdevhw/fbdevhw.h
index bd2c533..19f1b30 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/hw/xfree86/fbdevhw/fbdevhw.h
@@ -46,7 +46,7 @@ extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors,
 
 extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode,
                                              Bool verbose, int flags);
-extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode,
+extern _X_EXPORT Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
                                         int flags);
 extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y,
                                          int flags);
diff --git a/hw/xfree86/fbdevhw/fbdevhwstub.c b/hw/xfree86/fbdevhw/fbdevhwstub.c
index 3428b32..5bfb921 100644
--- a/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -137,7 +137,7 @@ fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
 }
 
 Bool
-fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags)
 {
     return FALSE;
 }
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 1b7cdca..e3b8382 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -50,7 +50,7 @@ static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *,
 /* ScrnInfoRec functions */
 
 static void xf86CursorEnableDisableFBAccess(int, Bool);
-static Bool xf86CursorSwitchMode(int, DisplayModePtr, int);
+static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr, int);
 
 Bool
 xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
@@ -237,10 +237,10 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable)
 }
 
 static Bool
-xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
+xf86CursorSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int flags)
 {
     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, flags);
 
     /*
      * 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 062b2eb..da8ac65 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, int);
     xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
     CursorPtr SavedCursor;
 
-- 
1.7.6



More information about the xorg-devel mailing list