[PATCH 05/19] xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API)
Dave Airlie
airlied at gmail.com
Mon May 14 09:40:58 PDT 2012
This converts AdjustFrame code paths to passing a ScrnInfoPtr
instead of an integer index.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
hw/xfree86/common/xf86Cursor.c | 4 ++--
hw/xfree86/common/xf86VGAarbiter.c | 6 +++---
hw/xfree86/common/xf86VGAarbiterPriv.h | 4 ++--
hw/xfree86/common/xf86VidMode.c | 2 +-
hw/xfree86/common/xf86str.h | 2 +-
hw/xfree86/common/xf86xv.c | 7 +++----
hw/xfree86/common/xf86xvpriv.h | 2 +-
hw/xfree86/dri/dri.c | 9 ++++-----
hw/xfree86/dri/dri.h | 4 ++--
hw/xfree86/fbdevhw/fbdevhw.c | 7 +++----
hw/xfree86/fbdevhw/fbdevhw.h | 2 +-
hw/xfree86/fbdevhw/fbdevhwstub.c | 2 +-
hw/xfree86/modes/xf86DiDGA.c | 2 +-
13 files changed, 25 insertions(+), 28 deletions(-)
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 61cae6a..dffdcdd 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -173,7 +173,7 @@ xf86PointerMoved(int scrnIndex, int x, int y)
}
if (frameChanged && pScr->AdjustFrame != NULL)
- pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+ pScr->AdjustFrame(pScr, pScr->frameX0, pScr->frameY0, 0);
}
/*
@@ -271,7 +271,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
xf86UnblockSIGIO(was_blocked);
if (pScr->AdjustFrame)
- (*pScr->AdjustFrame) (pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+ (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0, 0);
/* The original code centered the frame around the cursor if possible.
* Since this is hard to achieve with multiple cursors, we do the following:
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 546230b..57941aa 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -464,15 +464,15 @@ VGAarbiterSetCursorPosition(DeviceIntPtr pDev,
}
static void
-VGAarbiterAdjustFrame(int index, int x, int y, int flags)
+VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
{
- ScreenPtr pScreen = screenInfo.screens[index];
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
VGAarbiterScreenPtr pScreenPriv =
(VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
VGAarbiterScreenKey);
VGAGet(pScreen);
- (*pScreenPriv->AdjustFrame) (index, x, y, flags);
+ (*pScreenPriv->AdjustFrame) (pScrn, x, y, flags);
VGAPut();
}
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index d513156..946b45e 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -125,7 +125,7 @@ typedef struct _VGAarbiterScreen {
UnrealizeCursorProcPtr UnrealizeCursor;
RecolorCursorProcPtr RecolorCursor;
SetCursorPositionProcPtr SetCursorPosition;
- void (*AdjustFrame) (int, int, int, int);
+ void (*AdjustFrame) (ScrnInfoPtr, int, int, int);
Bool (*SwitchMode) (int, DisplayModePtr, int);
Bool (*EnterVT) (ScrnInfoPtr, int);
void (*LeaveVT) (ScrnInfoPtr, int);
@@ -176,7 +176,7 @@ static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
pScreen, int x, int y,
Bool generateEvent);
-static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
+static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags);
static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn, int flags);
static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn, int flags);
diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 0fc58e2..ed852ec 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -303,7 +303,7 @@ VidModeSetViewPort(int scrnIndex, int x, int y)
pScrn->virtualY - pScrn->currentMode->VDisplay);
pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
if (pScrn->AdjustFrame != NULL)
- (pScrn->AdjustFrame) (scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ (pScrn->AdjustFrame) (pScrn, pScrn->frameX0, pScrn->frameY0, 0);
return TRUE;
}
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 3b9ad47..cce09e7 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -647,7 +647,7 @@ typedef Bool xf86ProbeProc(DriverPtr, int);
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 void xf86AdjustFrameProc(ScrnInfoPtr, int, int, int);
typedef Bool xf86EnterVTProc(ScrnInfoPtr, int);
typedef void xf86LeaveVTProc(ScrnInfoPtr, int);
typedef void xf86FreeScreenProc(ScrnInfoPtr, int);
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 617a49f..df34944 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -103,7 +103,7 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool xf86XVEnterVT(ScrnInfoPtr, int);
static void xf86XVLeaveVT(ScrnInfoPtr, int);
-static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+static void xf86XVAdjustFrame(ScrnInfoPtr, int x, int y, int flags);
static void xf86XVModeSet(ScrnInfoPtr pScrn);
/* misc */
@@ -1358,15 +1358,14 @@ xf86XVLeaveVT(ScrnInfoPtr pScrn, int flags)
}
static void
-xf86XVAdjustFrame(int index, int x, int y, int flags)
+xf86XVAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = pScrn->pScreen;
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
if (ScreenPriv->AdjustFrame) {
pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
- (*pScrn->AdjustFrame) (index, x, y, flags);
+ (*pScrn->AdjustFrame) (pScrn, x, y, flags);
pScrn->AdjustFrame = xf86XVAdjustFrame;
}
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index fef92c4..2df1d99 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -41,7 +41,7 @@ typedef struct {
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
PostValidateTreeProcPtr PostValidateTree;
- void (*AdjustFrame) (int, int, int, int);
+ void (*AdjustFrame) (ScrnInfoPtr, int, int, int);
Bool (*EnterVT) (ScrnInfoPtr, int);
void (*LeaveVT) (ScrnInfoPtr, int);
xf86ModeSetProc *ModeSet;
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index ceb92c2..938ceee 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -2305,15 +2305,14 @@ _DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y)
}
void
-DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
+DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
{
- ScreenPtr pScreen = screenInfo.screens[scrnIndex];
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
int px, py;
if (!pDRIPriv || !pDRIPriv->pSAREA) {
- DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
+ DRIDrvMsg(pScrn->scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL);
return;
}
@@ -2345,7 +2344,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
/* unwrap */
pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
/* call lower layers */
- (*pScrn->AdjustFrame) (scrnIndex, x, y, flags);
+ (*pScrn->AdjustFrame) (pScrn, x, y, flags);
/* rewrap */
pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
pScrn->AdjustFrame = DRIAdjustFrame;
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index 664a50e..7496021 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -73,7 +73,7 @@ typedef int DRIWindowRequests;
#define DRI_ALL_WINDOWS 2
typedef void (*ClipNotifyPtr) (WindowPtr, int, int);
-typedef void (*AdjustFramePtr) (int scrnIndex, int x, int y, int flags);
+typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y, int flags);
/*
* These functions can be wrapped by the DRI. Each of these have
@@ -334,7 +334,7 @@ extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen);
extern _X_EXPORT void DRIQueryVersion(int *majorVersion,
int *minorVersion, int *patchVersion);
-extern _X_EXPORT void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
+extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags);
extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen,
int dx,
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 0823f40..3d85904 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -797,9 +797,8 @@ fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
}
void
-fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
if (x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual ||
@@ -809,7 +808,7 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
fPtr->var.xoffset = x;
fPtr->var.yoffset = y;
if (-1 == ioctl(fPtr->fd, FBIOPAN_DISPLAY, (void *) &fPtr->var))
- xf86DrvMsgVerb(scrnIndex, X_WARNING, 5,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 5,
"FBIOPAN_DISPLAY: %s\n", strerror(errno));
}
@@ -818,7 +817,7 @@ fbdevHWEnterVT(ScrnInfoPtr pScrn, int flags)
{
if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
return FALSE;
- fbdevHWAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ fbdevHWAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0, 0);
return TRUE;
}
diff --git a/hw/xfree86/fbdevhw/fbdevhw.h b/hw/xfree86/fbdevhw/fbdevhw.h
index 17cb196..bd2c533 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/hw/xfree86/fbdevhw/fbdevhw.h
@@ -48,7 +48,7 @@ extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode,
Bool verbose, int flags);
extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode,
int flags);
-extern _X_EXPORT void fbdevHWAdjustFrame(int scrnIndex, int x, int y,
+extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y,
int flags);
extern _X_EXPORT Bool fbdevHWEnterVT(ScrnInfoPtr pScrn, int flags);
extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn, int flags);
diff --git a/hw/xfree86/fbdevhw/fbdevhwstub.c b/hw/xfree86/fbdevhw/fbdevhwstub.c
index 6f0d076..3428b32 100644
--- a/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -143,7 +143,7 @@ fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
}
void
-fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
{
}
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index fdec6cb..39a644c 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -137,7 +137,7 @@ xf86_dga_get_viewport(ScrnInfoPtr scrn)
static void
xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
{
- scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
+ scrn->AdjustFrame(scrn, x, y, flags);
}
static Bool
--
1.7.6
More information about the xorg-devel
mailing list