From: Egbert Eich Date: Thu Sep 24 19:42:38 2015 +0200 Subject: [PATCH]DPMS: Query DPMS capabilites and query current state before changing Patch-mainline: to be upstreamed References: bsc#947356 Signed-off-by: Egbert Eich There is a VBE call to query the DPMS capabilities and the current state. If available use these calls to make sure to set only modes which are available and not set the state that is currently active already. The latter works around a problem found on an Intel BIOS. Signed-off-by: Egbert Eich --- src/vesa.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vesa.c b/src/vesa.c index 44f93b2..983a5f5 100644 --- a/src/vesa.c +++ b/src/vesa.c @@ -1687,10 +1687,20 @@ VESADisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, int flags) { VESAPtr pVesa = VESAGetRec(pScrn); - +#ifdef VBE_HAVE_DPMS_GET_CAPABILITIES + int val; +#endif if (!pScrn->vtSema) return; +#ifdef VBE_HAVE_DPMS_GET_CAPABILITIES + if (VBEDPMSGetCapabilities(pVesa->pVbe, &val) == FALSE || + (val & (1 << mode)) == 0) + return; + + if (VBEDPMSGet(pVesa->pVbe, &val) == TRUE && val == mode) + return; +#endif VBEDPMSSet(pVesa->pVbe, mode); }