debian/changelog                                            |    7 
 debian/patches/46_reduce_wakeups_from_smart_scheduler.patch |  150 ++++++++++++
 debian/patches/series                                       |    1 
 3 files changed, 158 insertions(+)

New commits:
commit 0293dc0cf8c6c3ddf9e6aa954fa8bd81f92b2e98
Author: Brice Goglin <[EMAIL PROTECTED]>
Date:   Fri Feb 8 22:59:57 2008 +0100

    Add patch to reduce power consumption.

diff --git a/debian/changelog b/debian/changelog
index ad9f99a..782f2ac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xorg-server (2:1.4.1~git20080131-2) UNRELEASED; urgency=low
+
+  * Add 46_reduce_wakeups_from_smart_scheduler.patch to reduce
+    power consumption, closes: #462700.
+
+ -- Brice Goglin <[EMAIL PROTECTED]>  Fri, 08 Feb 2008 22:57:14 +0100
+
 xorg-server (2:1.4.1~git20080131-1) unstable; urgency=low
 
   [ Brice Goglin ]
diff --git a/debian/patches/46_reduce_wakeups_from_smart_scheduler.patch 
b/debian/patches/46_reduce_wakeups_from_smart_scheduler.patch
new file mode 100644
index 0000000..700ad6e
--- /dev/null
+++ b/debian/patches/46_reduce_wakeups_from_smart_scheduler.patch
@@ -0,0 +1,150 @@
+commit 2338d5c9914e2a43c3a4f7ee0f4355ad0a1ad9e7
+Author: Arjan van de Ven <[EMAIL PROTECTED]>
+Date:   Sun Oct 28 09:37:52 2007 +0100
+
+    reduce wakeups from smart scheduler
+    
+    The smart scheduler itimer currently always fires after each request
+    (which in turn causes the CPU to wake out of idle, burning precious
+    power). Rather than doing this, just stop the timer before going into
+    the select() portion of the WaitFor loop. It's a cheap system call, and
+    it will only get called if there's no more commands batched up from the
+    active fd.
+    
+    This change also allows some of the functions to be simplified;
+    setitimer() will only fail if it's passed invalid data, and we don't do
+    that... so make it void and remove all the conditional code that deals
+    with failure.
+    
+    The change also allows us to remove a few variables that were used for
+    housekeeping between the signal handler and the main loop.
+    
+    Signed-off-by: Keith Packard <[EMAIL PROTECTED]>
+
+diff --git a/include/dixstruct.h b/include/dixstruct.h
+index dd6347f..bed31dc 100644
+--- a/include/dixstruct.h
++++ b/include/dixstruct.h
+@@ -150,11 +150,9 @@ extern long SmartScheduleTime;
+ extern long SmartScheduleInterval;
+ extern long SmartScheduleSlice;
+ extern long SmartScheduleMaxSlice;
+-extern unsigned long SmartScheduleIdleCount;
+ extern Bool SmartScheduleDisable;
+-extern Bool SmartScheduleIdle;
+-extern Bool SmartScheduleTimerStopped;
+-extern Bool SmartScheduleStartTimer(void);
++extern void SmartScheduleStartTimer(void);
++extern void SmartScheduleStopTimer(void);
+ #define SMART_MAX_PRIORITY  (20)
+ #define SMART_MIN_PRIORITY  (-20)
+ 
+diff --git a/os/WaitFor.c b/os/WaitFor.c
+index ec1592c..7683477 100644
+--- a/os/WaitFor.c
++++ b/os/WaitFor.c
+@@ -217,7 +217,8 @@ WaitForSomething(int *pClientsReady)
+       XFD_COPYSET(&AllSockets, &LastSelectMask);
+ #ifdef SMART_SCHEDULE
+       }
+-      SmartScheduleIdle = TRUE;
++      SmartScheduleStopTimer ();
++
+ #endif
+       BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
+       if (NewOutputPending)
+@@ -237,13 +238,7 @@ WaitForSomething(int *pClientsReady)
+       selecterr = GetErrno();
+       WakeupHandler(i, (pointer)&LastSelectMask);
+ #ifdef SMART_SCHEDULE
+-      if (i >= 0)
+-      {
+-          SmartScheduleIdle = FALSE;
+-          SmartScheduleIdleCount = 0;
+-          if (SmartScheduleTimerStopped)
+-              (void) SmartScheduleStartTimer ();
+-      }
++      SmartScheduleStartTimer ();
+ #endif
+       if (i <= 0) /* An error or timeout occurred */
+       {
+diff --git a/os/utils.c b/os/utils.c
+index 31cb0af..6fc1f7d 100644
+--- a/os/utils.c
++++ b/os/utils.c
+@@ -1512,10 +1512,6 @@ XNFstrdup(const char *s)
+ 
+ #ifdef SMART_SCHEDULE
+ 
+-unsigned long SmartScheduleIdleCount;
+-Bool          SmartScheduleIdle;
+-Bool          SmartScheduleTimerStopped;
+-
+ #ifdef SIGVTALRM
+ #define SMART_SCHEDULE_POSSIBLE
+ #endif
+@@ -1525,7 +1521,7 @@ Bool             SmartScheduleTimerStopped;
+ #define SMART_SCHEDULE_TIMER          ITIMER_REAL
+ #endif
+ 
+-static void
++void
+ SmartScheduleStopTimer (void)
+ {
+ #ifdef SMART_SCHEDULE_POSSIBLE
+@@ -1536,38 +1532,28 @@ SmartScheduleStopTimer (void)
+     timer.it_value.tv_sec = 0;
+     timer.it_value.tv_usec = 0;
+     (void) setitimer (ITIMER_REAL, &timer, 0);
+-    SmartScheduleTimerStopped = TRUE;
+ #endif
+ }
+ 
+-Bool
++void
+ SmartScheduleStartTimer (void)
+ {
+ #ifdef SMART_SCHEDULE_POSSIBLE
+     struct itimerval  timer;
+     
+-    SmartScheduleTimerStopped = FALSE;
+     timer.it_interval.tv_sec = 0;
+     timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
+     timer.it_value.tv_sec = 0;
+     timer.it_value.tv_usec = SmartScheduleInterval * 1000;
+-    return setitimer (ITIMER_REAL, &timer, 0) >= 0;
++    setitimer (ITIMER_REAL, &timer, 0);
+ #endif
+-    return FALSE;
+ }
+ 
+ #ifdef SMART_SCHEDULE_POSSIBLE
+ static void
+ SmartScheduleTimer (int sig)
+ {
+-    int olderrno = errno;
+-
+     SmartScheduleTime += SmartScheduleInterval;
+-    if (SmartScheduleIdle)
+-    {
+-      SmartScheduleStopTimer ();
+-    }
+-    errno = olderrno;
+ }
+ #endif
+ 
+@@ -1591,14 +1577,6 @@ SmartScheduleInit (void)
+       perror ("sigaction for smart scheduler");
+       return FALSE;
+     }
+-    /* Set up the virtual timer */
+-    if (!SmartScheduleStartTimer ())
+-    {
+-      perror ("scheduling timer");
+-      return FALSE;
+-    }
+-    /* stop the timer and wait for WaitForSomething to start it */
+-    SmartScheduleStopTimer ();
+     return TRUE;
+ #else
+     return FALSE;
diff --git a/debian/patches/series b/debian/patches/series
index 93b3c1a..f4ec8a9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -16,6 +16,7 @@
 43_allow_override_BIOS_EDID_preferred_mode.diff
 44_preferredmode_infinite_loop.diff
 45_only_XF86_APM_CAPABILITY_CHANGED_for_video_change_acpi_events.diff
+46_reduce_wakeups_from_smart_scheduler.patch
 #47_fbdevhw_magic_numbers.diff
 #51_xkb-and-loathing.diff
 91_ttf2pt1


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to