summaryrefslogtreecommitdiff
blob: f1e4b5384df21a7dd874969635a7ed6afc7170d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From bebf24f41c43f0b2338aefea87f39ba7423d02be Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Fri, 14 Aug 2009 11:17:45 +0100
Subject: [PATCH] Use a larger DPMS idletime timeout to mitigate an XSync bug

---
 src/gpm-idle.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gpm-idle.c b/src/gpm-idle.c
index 852f0f3..abe6075 100644
--- a/src/gpm-idle.c
+++ b/src/gpm-idle.c
@@ -51,6 +51,11 @@
 #define GPM_IDLE_TIMEOUT_IGNORE_DPMS_CHANGE	1.0f /* seconds */
 #define	GPM_IDLE_IDLETIME_ID			1
 
+/* XSync seems to be unreliable when setting small values of time.
+ * Ideally we want this to be 1ms (or smaller!) to reduce the chance of a race,
+ * but this fails to trigger on some systems. */
+#define GPM_IDLE_SMALLEST_RESET_VALUE		500 /* ms */
+
 struct GpmIdlePrivate
 {
 	EggIdletime	*idletime;
@@ -366,8 +371,8 @@ gpm_idle_idletime_reset_cb (EggIdletime *idletime, GpmIdle *idle)
 	if (idle->priv->mode == GPM_IDLE_MODE_BLANK &&
 	    elapsed < GPM_IDLE_TIMEOUT_IGNORE_DPMS_CHANGE) {
 		egg_debug ("ignoring reset, as we've just done a state change");
-		/* make sure we trigger a short 1ms timeout so we can get the expired signal */
-		egg_idletime_alarm_set (idle->priv->idletime, GPM_IDLE_IDLETIME_ID, 1);
+		/* make sure we trigger a short timeout so we can get the expired signal */
+		egg_idletime_alarm_set (idle->priv->idletime, GPM_IDLE_IDLETIME_ID, GPM_IDLE_SMALLEST_RESET_VALUE);
 		return;
 	}
 
-- 
1.6.5.1