[PATCH 09/19] xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2)

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


This migrates the ChangeGamma interface to avoid passing a index.

v2: fix xf86RandR12.c + xf86cmap.c call

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/common/xf86cmap.c   |    9 ++++-----
 hw/xfree86/common/xf86str.h    |    2 +-
 hw/xfree86/modes/xf86RandR12.c |    3 +--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 07b8af5..f140441 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -121,7 +121,7 @@ static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr, int);
 #ifdef XFreeXDGA
 static int CMapSetDGAMode(int, int, DGADevicePtr);
 #endif
-static int CMapChangeGamma(int, Gamma);
+static int CMapChangeGamma(ScrnInfoPtr, Gamma);
 
 static void ComputeGamma(CMapScreenPtr);
 static Bool CMapAllocateColormapPrivate(ColormapPtr);
@@ -907,10 +907,9 @@ ComputeGamma(CMapScreenPtr priv)
 }
 
 int
-CMapChangeGamma(int index, Gamma gamma)
+CMapChangeGamma(ScrnInfoPtr pScrn, Gamma gamma)
 {
     int ret = Success;
-    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = pScrn->pScreen;
     CMapColormapPtr pColPriv;
     CMapScreenPtr pScreenPriv;
@@ -978,7 +977,7 @@ CMapChangeGamma(int index, Gamma gamma)
 
     pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
     if (pScrn->ChangeGamma)
-        ret = pScrn->ChangeGamma(index, gamma);
+        ret = pScrn->ChangeGamma(pScrn, gamma);
     pScrn->ChangeGamma = CMapChangeGamma;
 
     return ret;
@@ -1174,7 +1173,7 @@ xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma)
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
     if (pScrn->ChangeGamma)
-        return (*pScrn->ChangeGamma) (pScreen->myNum, gamma);
+        return (*pScrn->ChangeGamma) (pScrn, gamma);
 
     return BadImplementation;
 }
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 10a7e84..c5c4c4e 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -654,7 +654,7 @@ 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 xf86ChangeGammaProc(int, Gamma);
+typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
 typedef void xf86PointerMovedProc(int, int, int);
 typedef Bool xf86PMEventProc(int, pmEvent, Bool);
 typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 10d2cbc..df4a3d6 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1688,10 +1688,9 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size)
 }
 
 static int
-xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
+xf86RandR12ChangeGamma(ScrnInfoPtr pScrn, Gamma gamma)
 {
     CARD16 *points, *red, *green, *blue;
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
     int size;
 
-- 
1.7.6



More information about the xorg-devel mailing list