[PATCH 1/2] xfree86: vgaarb: simplify the arguments passed to lock/unlock
Tiago Vignatti
tiago.vignatti at nokia.com
Fri May 21 08:48:14 PDT 2010
Send only screen index instead the whole rec for lock and remove the argument
of unlock.
This changes will ease the ones in the next commit.
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
hw/xfree86/common/xf86DPMS.c | 4 ++--
hw/xfree86/common/xf86Init.c | 14 +++++++-------
hw/xfree86/common/xf86VGAarbiter.c | 19 +++++++++++--------
hw/xfree86/common/xf86VGAarbiter.h | 6 +++---
4 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index cd025dc..483b13f 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -160,9 +160,9 @@ DPMSSet(ClientPtr client, int level)
pScrn = xf86Screens[i];
pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
- xf86VGAarbiterLock(pScrn);
+ xf86VGAarbiterLock(i);
pScrn->DPMSSet(pScrn, level, 0);
- xf86VGAarbiterUnlock(pScrn);
+ xf86VGAarbiterUnlock();
}
}
return Success;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 18df8c9..6355d4c 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -521,12 +521,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
*/
for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterScrnInit(xf86Screens[i]);
- xf86VGAarbiterLock(xf86Screens[i]);
+ xf86VGAarbiterScrnInit(i);
+ xf86VGAarbiterLock(i);
if (xf86Screens[i]->PreInit &&
xf86Screens[i]->PreInit(xf86Screens[i], 0))
xf86Screens[i]->configured = TRUE;
- xf86VGAarbiterUnlock(xf86Screens[i]);
+ xf86VGAarbiterUnlock();
}
for (i = 0; i < xf86NumScreens; i++)
if (!xf86Screens[i]->configured)
@@ -745,7 +745,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
FatalError("Cannot register DDX private keys");
for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterLock(xf86Screens[i]);
+ xf86VGAarbiterLock(i);
/*
* Almost everything uses these defaults, and many of those that
* don't, will wrap them.
@@ -760,7 +760,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Screens[i]->DriverFunc = NULL;
xf86Screens[i]->pScreen = NULL;
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
- xf86VGAarbiterUnlock(xf86Screens[i]);
+ xf86VGAarbiterUnlock();
if (scr_index == i) {
/*
* Hook in our ScrnInfoRec, and initialise some other pScreen
@@ -971,9 +971,9 @@ AbortDDX(void)
* we might not have been wrapped yet. Therefore enable
* screen explicitely.
*/
- xf86VGAarbiterLock(xf86Screens[i]);
+ xf86VGAarbiterLock(i);
(xf86Screens[i]->LeaveVT)(i, 0);
- xf86VGAarbiterUnlock(xf86Screens[i]);
+ xf86VGAarbiterUnlock();
}
}
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index a58d21a..185b9c2 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -86,8 +86,10 @@ xf86VGAarbiterFini(void)
}
void
-xf86VGAarbiterLock(ScrnInfoPtr pScrn)
+xf86VGAarbiterLock(int scrnIdx)
{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIdx];
+
if (vga_no_arb)
return;
pci_device_vgaarb_set_target(pScrn->vgaDev);
@@ -95,7 +97,7 @@ xf86VGAarbiterLock(ScrnInfoPtr pScrn)
}
void
-xf86VGAarbiterUnlock(ScrnInfoPtr pScrn)
+xf86VGAarbiterUnlock(void)
{
if (vga_no_arb)
return;
@@ -121,8 +123,9 @@ Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
}
void
-xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn)
+xf86VGAarbiterScrnInit(int scrnIdx)
{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIdx];
struct pci_device *dev;
EntityPtr pEnt;
@@ -254,9 +257,9 @@ VGAarbiterCloseScreen (int i, ScreenPtr pScreen)
UNWRAP_SPRITE;
free((pointer) pScreenPriv);
- xf86VGAarbiterLock(xf86Screens[i]);
+ xf86VGAarbiterLock(i);
val = (*pScreen->CloseScreen) (i, pScreen);
- xf86VGAarbiterUnlock(xf86Screens[i]);
+ xf86VGAarbiterUnlock();
return val;
}
@@ -1094,10 +1097,10 @@ VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRe
void xf86VGAarbiterInit(void) {}
void xf86VGAarbiterFini(void) {}
-void xf86VGAarbiterLock(ScrnInfoPtr pScrn) {}
-void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterLock(int scrnIdx) {}
+void xf86VGAarbiterUnlock(void) {}
Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { return TRUE; }
-void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterScrnInit(int scrnIdx) {}
void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) {}
Bool xf86VGAarbiterWrapFunctions(void) { return FALSE; }
diff --git a/hw/xfree86/common/xf86VGAarbiter.h b/hw/xfree86/common/xf86VGAarbiter.h
index 904b6b0..f883b00 100644
--- a/hw/xfree86/common/xf86VGAarbiter.h
+++ b/hw/xfree86/common/xf86VGAarbiter.h
@@ -33,10 +33,10 @@
/* Functions */
extern void xf86VGAarbiterInit(void);
extern void xf86VGAarbiterFini(void);
-void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn);
+void xf86VGAarbiterScrnInit(int scrnIdx);
extern Bool xf86VGAarbiterWrapFunctions(void);
-extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn);
-extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn);
+extern void xf86VGAarbiterLock(int scrnIdx);
+extern void xf86VGAarbiterUnlock(void);
/* allow a driver to remove itself from arbiter - really should be
* done in the kernel though */
--
1.6.0.4
More information about the xorg-devel
mailing list