[PATCH 10/19] xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API)

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


This migrates the SetDGAMode callback from an index to ScrnInfoPtr.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/common/xf86DGA.c  |   10 ++++------
 hw/xfree86/common/xf86cmap.c |   12 ++++++------
 hw/xfree86/common/xf86str.h  |    2 +-
 hw/xfree86/xaa/xaaInit.c     |    8 ++++----
 hw/xfree86/xaa/xaalocal.h    |    2 +-
 5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 743be70..6416372 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -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) {
@@ -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/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index f140441..5283c5f 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -82,7 +82,7 @@ typedef struct {
     StoreColorsProcPtr StoreColors;
     Bool (*EnterVT) (ScrnInfoPtr, int);
     Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr, int);
-    int (*SetDGAMode) (int, int, DGADevicePtr);
+    int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr);
     xf86ChangeGammaProc *ChangeGamma;
     int maxColors;
     int sigRGBbits;
@@ -119,7 +119,7 @@ static Bool CMapEnterVT(ScrnInfoPtr, int);
 static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr, int);
 
 #ifdef XFreeXDGA
-static int CMapSetDGAMode(int, int, DGADevicePtr);
+static int CMapSetDGAMode(ScrnInfoPtr, int, DGADevicePtr);
 #endif
 static int CMapChangeGamma(ScrnInfoPtr, Gamma);
 
@@ -498,16 +498,16 @@ CMapSwitchMode(ScrnInfoPtr pScrn, 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)
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index c5c4c4e..f9217b6 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -653,7 +653,7 @@ typedef void xf86LeaveVTProc(ScrnInfoPtr, int);
 typedef void xf86FreeScreenProc(ScrnInfoPtr, int);
 typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
 typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
-typedef int xf86SetDGAModeProc(int, int, DGADevicePtr);
+typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr);
 typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
 typedef void xf86PointerMovedProc(int, int, int);
 typedef Bool xf86PMEventProc(int, pmEvent, Bool);
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index b72e5de..5015e32 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -38,7 +38,7 @@ static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
 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 int XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet);
 static void XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
 static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
 
@@ -549,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);
@@ -567,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;
 
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index 2ee5ec9..0d85093 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -49,7 +49,7 @@ typedef struct _XAAScreen {
     XAAInfoRecPtr AccelInfoRec;
     Bool (*EnterVT) (ScrnInfoPtr, int);
     void (*LeaveVT) (ScrnInfoPtr, int);
-    int (*SetDGAMode) (int, int, DGADevicePtr);
+    int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr);
     void (*EnableDisableFBAccess) (ScrnInfoPtr, Bool);
     CompositeProcPtr Composite;
     GlyphsProcPtr Glyphs;
-- 
1.7.6



More information about the xorg-devel mailing list