[PATCH 7/9] dix/dispatch.c, os/utils.c: Disable smart scheduler on WIN32
Jon TURNEY
jon.turney at dronecode.org.uk
Wed Jan 11 12:13:27 PST 2012
From: Ryan Pavlik <rpavlik at iastate.edu>
setitimer() and SIGALRM aren't available on WIN32, so smart scheduler
code cannot be built.
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
dix/dispatch.c | 4 ++++
os/utils.c | 9 +++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/dix/dispatch.c b/dix/dispatch.c
index b91b41f..b3777e5 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -225,7 +225,11 @@ UpdateCurrentTimeIf(void)
#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+#if defined(WIN32) && !defined(__CYGWIN__)
+Bool SmartScheduleDisable = TRUE;
+#else
Bool SmartScheduleDisable = FALSE;
+#endif
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
diff --git a/os/utils.c b/os/utils.c
index 5ef37ac..0cfa3db 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -72,6 +72,7 @@ __stdcall unsigned long GetTickCount(void);
#if !defined(WIN32) || !defined(__MINGW32__)
#include <sys/time.h>
#include <sys/resource.h>
+# define SMART_SCHEDULE_POSSIBLE
#endif
#include "misc.h"
#include <X11/X.h>
@@ -916,6 +917,7 @@ ProcessCommandLine(int argc, char *argv[])
i = skip - 1;
}
#endif
+#ifdef SMART_SCHEDULE_POSSIBLE
else if ( strcmp( argv[i], "-dumbSched") == 0)
{
SmartScheduleDisable = TRUE;
@@ -939,6 +941,7 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg();
}
+#endif
else if ( strcmp( argv[i], "-render" ) == 0)
{
if (++i < argc)
@@ -1154,6 +1157,7 @@ XNFstrdup(const char *s)
void
SmartScheduleStopTimer (void)
{
+#ifdef SMART_SCHEDULE_POSSIBLE
struct itimerval timer;
if (SmartScheduleDisable)
@@ -1163,11 +1167,13 @@ SmartScheduleStopTimer (void)
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = 0;
(void) setitimer (ITIMER_REAL, &timer, 0);
+#endif
}
void
SmartScheduleStartTimer (void)
{
+#ifdef SMART_SCHEDULE_POSSIBLE
struct itimerval timer;
if (SmartScheduleDisable)
@@ -1177,6 +1183,7 @@ SmartScheduleStartTimer (void)
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = SmartScheduleInterval * 1000;
setitimer (ITIMER_REAL, &timer, 0);
+#endif
}
static void
@@ -1188,6 +1195,7 @@ SmartScheduleTimer (int sig)
void
SmartScheduleInit (void)
{
+#ifdef SMART_SCHEDULE_POSSIBLE
struct sigaction act;
if (SmartScheduleDisable)
@@ -1204,6 +1212,7 @@ SmartScheduleInit (void)
perror ("sigaction for smart scheduler");
SmartScheduleDisable = TRUE;
}
+#endif
}
#ifdef SIG_BLOCK
--
1.7.5.1
More information about the xorg-devel
mailing list