1
0
xf86-video-vesa/u_DPMS-Query-DPMS-capabilites-and-query-current-state-before-changing.patch
Stefan Dirsch c64aa455e4 Accepting request 333717 from home:eeich:branches:X11:XOrg
- u_DPMS-Query-DPMS-capabilites-and-query-current-state-before-changing.patch
  If the Xserver provides the VBEDPMSGetCapabilities() and VBEDPMSGet()
  API, check DPMS capabilities if a requested DPMS mode is supported before
  changing, and only change DPMS mode when the new state is different from 
  the old (bsc#947356, boo#947493).

OBS-URL: https://build.opensuse.org/request/show/333717
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xf86-video-vesa?expand=0&rev=19
2015-09-25 12:04:20 +00:00

46 lines
1.3 KiB
Diff

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);
}