diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2012-06-10 13:21:33 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2012-06-10 13:21:33 +0000 |
commit | 171e929a08098b6c844887adc43879c7579dc15f (patch) | |
tree | 6b4d2e3bc20dbd4dc9a1f031416e66614c53dd21 /xserver/hw/xfree86/common/xf86DPMS.c | |
parent | 68781b09de2c95b87ea898c4ecf3018dfb4460d2 (diff) |
Update to xserver 1.12.2. tested by naddy@, krw@, mpi@.
Diffstat (limited to 'xserver/hw/xfree86/common/xf86DPMS.c')
-rw-r--r-- | xserver/hw/xfree86/common/xf86DPMS.c | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/xserver/hw/xfree86/common/xf86DPMS.c b/xserver/hw/xfree86/common/xf86DPMS.c index cd025dca4..75f034239 100644 --- a/xserver/hw/xfree86/common/xf86DPMS.c +++ b/xserver/hw/xfree86/common/xf86DPMS.c @@ -42,8 +42,9 @@ #include <X11/extensions/dpmsconst.h> #include "dpmsproc.h" #endif +#ifdef XSERVER_LIBPCIACCESS #include "xf86VGAarbiter.h" - +#endif #ifdef DPMSExtension static DevPrivateKeyRec DPMSKeyRec; @@ -52,7 +53,6 @@ static Bool DPMSClose(int i, ScreenPtr pScreen); static int DPMSCount = 0; #endif - Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) { @@ -64,28 +64,28 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) DPMSKey = &DPMSKeyRec; - if (!dixRegisterPrivateKey(&DPMSKeyRec, PRIVATE_SCREEN, sizeof (DPMSRec))) - return FALSE; + if (!dixRegisterPrivateKey(&DPMSKeyRec, PRIVATE_SCREEN, sizeof(DPMSRec))) + return FALSE; pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey); pScrn->DPMSSet = set; pDPMS->Flags = flags; DPMSOpt = xf86FindOption(pScrn->options, "dpms"); if (DPMSDisabledSwitch) { - enabled_from = X_CMDLINE; - DPMSEnabled = FALSE; + enabled_from = X_CMDLINE; + DPMSEnabled = FALSE; } else if (DPMSOpt) { - enabled_from = X_CONFIG; - DPMSEnabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE); - xf86MarkOptionUsed(DPMSOpt); + enabled_from = X_CONFIG; + DPMSEnabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE); + xf86MarkOptionUsed(DPMSOpt); } else { - enabled_from = X_DEFAULT; - DPMSEnabled = TRUE; + enabled_from = X_DEFAULT; + DPMSEnabled = TRUE; } if (DPMSEnabled) - xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n"); + xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n"); pDPMS->Enabled = DPMSEnabled; pDPMS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DPMSClose; @@ -96,7 +96,6 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) #endif } - #ifdef DPMSExtension static Bool @@ -106,13 +105,13 @@ DPMSClose(int i, ScreenPtr pScreen) /* This shouldn't happen */ if (DPMSKey == NULL) - return FALSE; + return FALSE; pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey); /* This shouldn't happen */ if (!pDPMS) - return FALSE; + return FALSE; pScreen->CloseScreen = pDPMS->CloseScreen; @@ -123,15 +122,14 @@ DPMSClose(int i, ScreenPtr pScreen) * to deal with this internally. */ if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) { - xf86Screens[i]->DPMSSet(xf86Screens[i],DPMSModeOn,0); + xf86Screens[i]->DPMSSet(xf86Screens[i], DPMSModeOn, 0); } - + if (--DPMSCount == 0) - DPMSKey = NULL; + DPMSKey = NULL; return pScreen->CloseScreen(i, pScreen); } - /* * DPMSSet -- * Device dependent DPMS mode setting hook. This is called whenever @@ -147,28 +145,27 @@ DPMSSet(ClientPtr client, int level) DPMSPowerLevel = level; if (DPMSKey == NULL) - return Success; + return Success; if (level != DPMSModeOn) { - rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive); - if (rc != Success) - return rc; + rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive); + if (rc != Success) + return rc; } /* For each screen, set the DPMS level */ for (i = 0; i < xf86NumScreens; i++) { - pScrn = xf86Screens[i]; - pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); - if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { - xf86VGAarbiterLock(pScrn); - pScrn->DPMSSet(pScrn, level, 0); - xf86VGAarbiterUnlock(pScrn); - } + pScrn = xf86Screens[i]; + pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); + if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { + xf86VGAarbiterLock(pScrn); + pScrn->DPMSSet(pScrn, level, 0); + xf86VGAarbiterUnlock(pScrn); + } } return Success; } - /* * DPMSSupported -- * Return TRUE if any screen supports DPMS. @@ -181,17 +178,17 @@ DPMSSupported(void) ScrnInfoPtr pScrn; if (DPMSKey == NULL) { - return FALSE; + return FALSE; } /* For each screen, check if DPMS is supported */ for (i = 0; i < xf86NumScreens; i++) { - pScrn = xf86Screens[i]; - pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); - if (pDPMS && pScrn->DPMSSet) - return TRUE; + pScrn = xf86Screens[i]; + pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); + if (pDPMS && pScrn->DPMSSet) + return TRUE; } return FALSE; } -#endif /* DPMSExtension */ +#endif /* DPMSExtension */ |