summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch')
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch151
1 files changed, 151 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch b/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch
new file mode 100644
index 0000000000..395bc7d511
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch
@@ -0,0 +1,151 @@
1>From 48e4d08e99de41047c6b6fde5ba9d12787881c23 Mon Sep 17 00:00:00 2001
2From: root <root@benny.jf.intel.com>
3Date: Sun, 28 Oct 2007 09:37:52 +0100
4Subject: [PATCH] The smart scheduler itimer currently always fires after each request
5 (which in turn causes the CPU to wake out of idle, burning precious power).
6 Rather than doing this, just stop the timer before going into the select()
7 portion of the WaitFor loop. It's a cheap system call, and it will only get
8 called if there's no more commands batched up from the active fd.
9
10This change also allows some of the functions to be simplified; setitimer()
11will only fail if it's passed invalid data, and we don't do that... so make
12it void and remove all the conditional code that deals with failure.
13
14The change also allows us to remove a few variables that were used for
15housekeeping between the signal handler and the main loop.
16---
17 include/dixstruct.h | 6 ++----
18 os/WaitFor.c | 11 +++--------
19 os/utils.c | 28 +++-------------------------
20 3 files changed, 8 insertions(+), 37 deletions(-)
21
22diff --git a/include/dixstruct.h b/include/dixstruct.h
23index dd6347f..bed31dc 100644
24--- a/include/dixstruct.h
25+++ b/include/dixstruct.h
26@@ -150,11 +150,9 @@ extern long SmartScheduleTime;
27 extern long SmartScheduleInterval;
28 extern long SmartScheduleSlice;
29 extern long SmartScheduleMaxSlice;
30-extern unsigned long SmartScheduleIdleCount;
31 extern Bool SmartScheduleDisable;
32-extern Bool SmartScheduleIdle;
33-extern Bool SmartScheduleTimerStopped;
34-extern Bool SmartScheduleStartTimer(void);
35+extern void SmartScheduleStartTimer(void);
36+extern void SmartScheduleStopTimer(void);
37 #define SMART_MAX_PRIORITY (20)
38 #define SMART_MIN_PRIORITY (-20)
39
40diff --git a/os/WaitFor.c b/os/WaitFor.c
41index ec1592c..7683477 100644
42--- a/os/WaitFor.c
43+++ b/os/WaitFor.c
44@@ -217,7 +217,8 @@ WaitForSomething(int *pClientsReady)
45 XFD_COPYSET(&AllSockets, &LastSelectMask);
46 #ifdef SMART_SCHEDULE
47 }
48- SmartScheduleIdle = TRUE;
49+ SmartScheduleStopTimer ();
50+
51 #endif
52 BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
53 if (NewOutputPending)
54@@ -237,13 +238,7 @@ WaitForSomething(int *pClientsReady)
55 selecterr = GetErrno();
56 WakeupHandler(i, (pointer)&LastSelectMask);
57 #ifdef SMART_SCHEDULE
58- if (i >= 0)
59- {
60- SmartScheduleIdle = FALSE;
61- SmartScheduleIdleCount = 0;
62- if (SmartScheduleTimerStopped)
63- (void) SmartScheduleStartTimer ();
64- }
65+ SmartScheduleStartTimer ();
66 #endif
67 if (i <= 0) /* An error or timeout occurred */
68 {
69diff --git a/os/utils.c b/os/utils.c
70index 31cb0af..6fc1f7d 100644
71--- a/os/utils.c
72+++ b/os/utils.c
73@@ -1513,10 +1513,6 @@ XNFstrdup(const char *s)
74
75 #ifdef SMART_SCHEDULE
76
77-unsigned long SmartScheduleIdleCount;
78-Bool SmartScheduleIdle;
79-Bool SmartScheduleTimerStopped;
80-
81 #ifdef SIGVTALRM
82 #define SMART_SCHEDULE_POSSIBLE
83 #endif
84@@ -1526,7 +1522,7 @@ Bool SmartScheduleTimerStopped;
85 #define SMART_SCHEDULE_TIMER ITIMER_REAL
86 #endif
87
88-static void
89+void
90 SmartScheduleStopTimer (void)
91 {
92 #ifdef SMART_SCHEDULE_POSSIBLE
93@@ -1537,38 +1533,28 @@ SmartScheduleStopTimer (void)
94 timer.it_value.tv_sec = 0;
95 timer.it_value.tv_usec = 0;
96 (void) setitimer (ITIMER_REAL, &timer, 0);
97- SmartScheduleTimerStopped = TRUE;
98 #endif
99 }
100
101-Bool
102+void
103 SmartScheduleStartTimer (void)
104 {
105 #ifdef SMART_SCHEDULE_POSSIBLE
106 struct itimerval timer;
107
108- SmartScheduleTimerStopped = FALSE;
109 timer.it_interval.tv_sec = 0;
110 timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
111 timer.it_value.tv_sec = 0;
112 timer.it_value.tv_usec = SmartScheduleInterval * 1000;
113- return setitimer (ITIMER_REAL, &timer, 0) >= 0;
114+ setitimer (ITIMER_REAL, &timer, 0);
115 #endif
116- return FALSE;
117 }
118
119 #ifdef SMART_SCHEDULE_POSSIBLE
120 static void
121 SmartScheduleTimer (int sig)
122 {
123- int olderrno = errno;
124-
125 SmartScheduleTime += SmartScheduleInterval;
126- if (SmartScheduleIdle)
127- {
128- SmartScheduleStopTimer ();
129- }
130- errno = olderrno;
131 }
132 #endif
133
134@@ -1592,14 +1578,6 @@ SmartScheduleInit (void)
135 perror ("sigaction for smart scheduler");
136 return FALSE;
137 }
138- /* Set up the virtual timer */
139- if (!SmartScheduleStartTimer ())
140- {
141- perror ("scheduling timer");
142- return FALSE;
143- }
144- /* stop the timer and wait for WaitForSomething to start it */
145- SmartScheduleStopTimer ();
146 return TRUE;
147 #else
148 return FALSE;
149--
1501.5.3.4
151