[PATCH 08/19] xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API)

Dave Airlie airlied at gmail.com
Mon May 14 09:41:01 PDT 2012


The EXA interface migrates to ScreenPtr,
and the xf86 interface migrated to ScrnInfoPtr.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 exa/exa.h                      |    2 +-
 exa/exa_offscreen.c            |    4 +---
 exa/exa_priv.h                 |    2 +-
 hw/xfree86/common/xf86.h       |    2 +-
 hw/xfree86/common/xf86DGA.c    |    4 ++--
 hw/xfree86/common/xf86Events.c |    6 +++---
 hw/xfree86/common/xf86Helper.c |    3 +--
 hw/xfree86/common/xf86PM.c     |    4 ++--
 hw/xfree86/common/xf86RandR.c  |    4 ++--
 hw/xfree86/common/xf86str.h    |    2 +-
 hw/xfree86/exa/examodule.c     |   12 ++++++------
 hw/xfree86/modes/xf86RandR12.c |    8 ++++----
 hw/xfree86/ramdac/xf86Cursor.c |    8 ++++----
 hw/xfree86/xaa/xaaInit.c       |    8 ++++----
 hw/xfree86/xaa/xaalocal.h      |    2 +-
 15 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/exa/exa.h b/exa/exa.h
index 7534002..8a6539f 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -789,7 +789,7 @@ extern _X_EXPORT void
  ExaOffscreenMarkUsed(PixmapPtr pPixmap);
 
 extern _X_EXPORT void
- exaEnableDisableFBAccess(int index, Bool enable);
+ exaEnableDisableFBAccess(ScreenPtr pScreen, Bool enable);
 
 extern _X_EXPORT Bool
  exaDrawableIsOffscreen(DrawablePtr pDrawable);
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index 5e1d139..1f571cf 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -360,10 +360,8 @@ ExaOffscreenSwapIn(ScreenPtr pScreen)
  * swapped out.
  */
 void
-exaEnableDisableFBAccess(int index, Bool enable)
+exaEnableDisableFBAccess(ScreenPtr pScreen, Bool enable)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
-
     ExaScreenPriv(pScreen);
 
     if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS)
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index bde78c3..f980fea 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -147,7 +147,7 @@ typedef struct _ExaMigrationRec {
     RegionPtr pReg;
 } ExaMigrationRec, *ExaMigrationPtr;
 
-typedef void (*EnableDisableFBAccessProcPtr) (int, Bool);
+typedef void (*EnableDisableFBAccessProcPtr) (ScreenPtr, Bool);
 typedef struct {
     ExaDriverPtr info;
     ScreenBlockHandlerProcPtr SavedBlockHandler;
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 3178d99..67cb135 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -261,7 +261,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)
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 66a148c..743be70 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -359,7 +359,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 +385,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;
     }
 
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index e301534..9d391b6 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);
         }
 
         /*
@@ -477,7 +477,7 @@ xf86VTSwitch(void)
             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);
@@ -532,7 +532,7 @@ xf86VTSwitch(void)
         }
         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 4925bcb..0008d0d 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1027,9 +1027,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;
 
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index 5af241f..c8fd8c8 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) {
@@ -140,7 +140,7 @@ resume(pmEvent event, Bool undo)
     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;
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index ec76fee..5606bee 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;
 }
 
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 41b3c0c..10a7e84 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -652,7 +652,7 @@ typedef Bool xf86EnterVTProc(ScrnInfoPtr, int);
 typedef void xf86LeaveVTProc(ScrnInfoPtr, int);
 typedef void xf86FreeScreenProc(ScrnInfoPtr, int);
 typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
-typedef void xf86EnableDisableFBAccessProc(int, Bool);
+typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
 typedef int xf86SetDGAModeProc(int, int, DGADevicePtr);
 typedef int xf86ChangeGammaProc(int, Gamma);
 typedef void xf86PointerMovedProc(int, int, int);
diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index fc7bc7b..4e809ea 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;
 
@@ -87,20 +87,20 @@ exaXorgCloseScreen(ScreenPtr 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/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index ef07a9d..10d2cbc 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);
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index e3b8382..ff6a221 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -49,7 +49,7 @@ static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *,
 
 /* ScrnInfoRec functions */
 
-static void xf86CursorEnableDisableFBAccess(int, Bool);
+static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr, Bool);
 static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr, int);
 
 Bool
@@ -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) {
         /*
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 47734ce..b72e5de 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -39,7 +39,7 @@ static Bool XAADestroyPixmap(PixmapPtr pPixmap);
 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 void XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
 static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
 
 static DevPrivateKeyRec XAAScreenKeyRec;
@@ -610,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);
@@ -625,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 a7548d1..2ee5ec9 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -50,7 +50,7 @@ typedef struct _XAAScreen {
     Bool (*EnterVT) (ScrnInfoPtr, int);
     void (*LeaveVT) (ScrnInfoPtr, int);
     int (*SetDGAMode) (int, int, DGADevicePtr);
-    void (*EnableDisableFBAccess) (int, Bool);
+    void (*EnableDisableFBAccess) (ScrnInfoPtr, Bool);
     CompositeProcPtr Composite;
     GlyphsProcPtr Glyphs;
 } XAAScreenRec, *XAAScreenPtr;
-- 
1.7.6



More information about the xorg-devel mailing list