xf86-video-vesa/u_DPMS-Query-DPMS-capabilites-and-query-current-state-before-changing.patch

46 lines
1.3 KiB
Diff
Raw Permalink Normal View History

From: Egbert Eich <eich@suse.de>
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 <eich@suse.com>
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 <eich@suse.de>
---
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);
}