[PATCH] DPMS: include GPU screens in DPMS code

Alex Deucher alexdeucher at gmail.com
Mon Mar 4 08:26:56 PST 2013


On Mon, Mar 4, 2013 at 11:24 AM, Aaron Plattner <aplattner at nvidia.com> wrote:
> On 02/07/2013 09:16 AM, Aaron Plattner wrote:
>>
>> Otherwise, displays driven by GPU screens remain on all the time.
>
>
> Ping?  CRTs do make good space heaters, but that probably shouldn't be a
> design goal of the X server.  :)

Looks like the right thing to do.

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

>
>> Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
>> ---
>>   hw/xfree86/common/xf86DPMS.c | 45
>> ++++++++++++++++++++++++++++++--------------
>>   1 file changed, 31 insertions(+), 14 deletions(-)
>>
>> diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
>> index ef4a2c1..3f1e142 100644
>> --- a/hw/xfree86/common/xf86DPMS.c
>> +++ b/hw/xfree86/common/xf86DPMS.c
>> @@ -130,6 +130,19 @@ DPMSClose(ScreenPtr 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 --
>>    *    Device dependent DPMS mode setting hook.  This is called whenever
>> @@ -139,8 +152,6 @@ int
>>   DPMSSet(ClientPtr client, int level)
>>   {
>>       int rc, i;
>> -    DPMSPtr pDPMS;
>> -    ScrnInfoPtr pScrn;
>>
>>       DPMSPowerLevel = level;
>>
>> @@ -155,17 +166,23 @@ DPMSSet(ClientPtr client, int level)
>>
>>       /* 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);
>> -        }
>> +        DPMSSetScreen(xf86Screens[i], level);
>> +    }
>> +    for (i = 0; i < xf86NumGPUScreens; i++) {
>> +        DPMSSetScreen(xf86GPUScreens[i], level);
>>       }
>>       return Success;
>>   }
>>
>> +static Bool
>> +DPMSSupportedOnScreen(ScrnInfoPtr pScrn)
>> +{
>> +    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
>> +    DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
>> +
>> +    return pDPMS && pScrn->DPMSSet;
>> +}
>> +
>>   /*
>>    * DPMSSupported --
>>    *    Return TRUE if any screen supports DPMS.
>> @@ -174,8 +191,6 @@ Bool
>>   DPMSSupported(void)
>>   {
>>       int i;
>> -    DPMSPtr pDPMS;
>> -    ScrnInfoPtr pScrn;
>>
>>       if (DPMSKey == NULL) {
>>           return FALSE;
>> @@ -183,9 +198,11 @@ DPMSSupported(void)
>>
>>       /* 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)
>> +        if (DPMSSupportedOnScreen(xf86Screens[i]))
>> +            return TRUE;
>> +    }
>> +    for (i = 0; i < xf86NumGPUScreens; i++) {
>> +        if (DPMSSupportedOnScreen(xf86GPUScreens[i]))
>>               return TRUE;
>>       }
>>       return FALSE;
>>
>
> --
> Aaron
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list