diff options
| author | Ross Burton <ross@openedhand.com> | 2008-01-21 17:46:08 +0000 |
|---|---|---|
| committer | Ross Burton <ross@openedhand.com> | 2008-01-21 17:46:08 +0000 |
| commit | 57b10da4bc6b3034a854401bb7b04e7e9953b1d4 (patch) | |
| tree | d5ddf8a38e0afa9c0431675b2007ee271dc0795d | |
| parent | 5bf734fe498713097c887960dd566a57f43cab68 (diff) | |
| download | poky-57b10da4bc6b3034a854401bb7b04e7e9953b1d4.tar.gz | |
xserver-kdrive: add a patch from git master to reduce scheduling
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3565 311d38ba-8fff-0310-9ca6-ca027cbcb966
| -rw-r--r-- | meta/packages/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch | 151 | ||||
| -rw-r--r-- | meta/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb | 5 |
2 files changed, 154 insertions, 2 deletions
diff --git a/meta/packages/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch b/meta/packages/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch new file mode 100644 index 0000000000..395bc7d511 --- /dev/null +++ b/meta/packages/xorg-xserver/xserver-kdrive-1.3.0.0/scheduler.patch | |||
| @@ -0,0 +1,151 @@ | |||
| 1 | >From 48e4d08e99de41047c6b6fde5ba9d12787881c23 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: root <root@benny.jf.intel.com> | ||
| 3 | Date: Sun, 28 Oct 2007 09:37:52 +0100 | ||
| 4 | Subject: [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 | |||
| 10 | This change also allows some of the functions to be simplified; setitimer() | ||
| 11 | will only fail if it's passed invalid data, and we don't do that... so make | ||
| 12 | it void and remove all the conditional code that deals with failure. | ||
| 13 | |||
| 14 | The change also allows us to remove a few variables that were used for | ||
| 15 | housekeeping 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 | |||
| 22 | diff --git a/include/dixstruct.h b/include/dixstruct.h | ||
| 23 | index 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 | |||
| 40 | diff --git a/os/WaitFor.c b/os/WaitFor.c | ||
| 41 | index 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 | { | ||
| 69 | diff --git a/os/utils.c b/os/utils.c | ||
| 70 | index 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 | -- | ||
| 150 | 1.5.3.4 | ||
| 151 | |||
diff --git a/meta/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb b/meta/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb index fa1563d549..b2acdd57c8 100644 --- a/meta/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb +++ b/meta/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb | |||
| @@ -3,7 +3,7 @@ require xserver-kdrive.inc | |||
| 3 | DEPENDS += "libxkbfile libxcalibrate" | 3 | DEPENDS += "libxkbfile libxcalibrate" |
| 4 | 4 | ||
| 5 | PE = "1" | 5 | PE = "1" |
| 6 | PR = "r17" | 6 | PR = "r18" |
| 7 | 7 | ||
| 8 | SRC_URI = "${XORG_MIRROR}/individual/xserver/xorg-server-${PV}.tar.bz2 \ | 8 | SRC_URI = "${XORG_MIRROR}/individual/xserver/xorg-server-${PV}.tar.bz2 \ |
| 9 | file://extra-kmodes.patch;patch=1 \ | 9 | file://extra-kmodes.patch;patch=1 \ |
| @@ -19,6 +19,7 @@ SRC_URI = "${XORG_MIRROR}/individual/xserver/xorg-server-${PV}.tar.bz2 \ | |||
| 19 | file://enable-tslib.patch;patch=1 \ | 19 | file://enable-tslib.patch;patch=1 \ |
| 20 | file://enable-xcalibrate.patch;patch=1 \ | 20 | file://enable-xcalibrate.patch;patch=1 \ |
| 21 | file://hide-cursor-and-ppm-root.patch;patch=1 \ | 21 | file://hide-cursor-and-ppm-root.patch;patch=1 \ |
| 22 | file://xcalibrate_coords.patch;patch=1" | 22 | file://xcalibrate_coords.patch;patch=1 \ |
| 23 | file://scheduler.patch;patch=1" | ||
| 23 | 24 | ||
| 24 | S = "${WORKDIR}/xorg-server-${PV}" | 25 | S = "${WORKDIR}/xorg-server-${PV}" |
