Commit 6238bd68 authored by Aaron Plattner's avatar Aaron Plattner Committed by Keith Packard

DPMS: include GPU screens in DPMS code

Otherwise, displays driven by GPU screens remain on all the time.
Signed-off-by: Aaron Plattner's avatarAaron Plattner <aplattner@nvidia.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent dd4ab8b5
...@@ -130,6 +130,19 @@ DPMSClose(ScreenPtr pScreen) ...@@ -130,6 +130,19 @@ DPMSClose(ScreenPtr pScreen)
return pScreen->CloseScreen(pScreen); return pScreen->CloseScreen(pScreen);
} }
static void
DPMSSetScreen(ScrnInfoPtr pScrn, int level)
{
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
xf86VGAarbiterLock(pScrn);
pScrn->DPMSSet(pScrn, level, 0);
xf86VGAarbiterUnlock(pScrn);
}
}
/* /*
* DPMSSet -- * DPMSSet --
* Device dependent DPMS mode setting hook. This is called whenever * Device dependent DPMS mode setting hook. This is called whenever
...@@ -139,8 +152,6 @@ int ...@@ -139,8 +152,6 @@ int
DPMSSet(ClientPtr client, int level) DPMSSet(ClientPtr client, int level)
{ {
int rc, i; int rc, i;
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
DPMSPowerLevel = level; DPMSPowerLevel = level;
...@@ -155,17 +166,23 @@ DPMSSet(ClientPtr client, int level) ...@@ -155,17 +166,23 @@ DPMSSet(ClientPtr client, int level)
/* For each screen, set the DPMS level */ /* For each screen, set the DPMS level */
for (i = 0; i < xf86NumScreens; i++) { for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i]; DPMSSetScreen(xf86Screens[i], level);
pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); }
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { for (i = 0; i < xf86NumGPUScreens; i++) {
xf86VGAarbiterLock(pScrn); DPMSSetScreen(xf86GPUScreens[i], level);
pScrn->DPMSSet(pScrn, level, 0);
xf86VGAarbiterUnlock(pScrn);
}
} }
return Success; return Success;
} }
static Bool
DPMSSupportedOnScreen(ScrnInfoPtr pScrn)
{
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
return pDPMS && pScrn->DPMSSet;
}
/* /*
* DPMSSupported -- * DPMSSupported --
* Return TRUE if any screen supports DPMS. * Return TRUE if any screen supports DPMS.
...@@ -174,8 +191,6 @@ Bool ...@@ -174,8 +191,6 @@ Bool
DPMSSupported(void) DPMSSupported(void)
{ {
int i; int i;
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
if (DPMSKey == NULL) { if (DPMSKey == NULL) {
return FALSE; return FALSE;
...@@ -183,9 +198,11 @@ DPMSSupported(void) ...@@ -183,9 +198,11 @@ DPMSSupported(void)
/* For each screen, check if DPMS is supported */ /* For each screen, check if DPMS is supported */
for (i = 0; i < xf86NumScreens; i++) { for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i]; if (DPMSSupportedOnScreen(xf86Screens[i]))
pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); return TRUE;
if (pDPMS && pScrn->DPMSSet) }
for (i = 0; i < xf86NumGPUScreens; i++) {
if (DPMSSupportedOnScreen(xf86GPUScreens[i]))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment