[PATCH 5/6] dix/dispatch.c, os/utils.c: Disable smart scheduler on WIN32

Jon TURNEY jon.turney at dronecode.org.uk
Tue Nov 13 05:40:50 PST 2012


setitimer() and SIGALRM aren't available on WIN32, so smart scheduler
code cannot be built.  Provide only stubs for smart scheduler timer
code, and disable smart scheduler by default.

Signed-off-by: Ryan Pavlik <rpavlik at iastate.edu>
Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Tested-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
 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 2df1a6e..99ba277 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -223,7 +223,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 d6c6ebb..3f75f18 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -71,6 +71,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>
@@ -898,6 +899,7 @@ ProcessCommandLine(int argc, char *argv[])
             i = skip - 1;
         }
 #endif
+#ifdef SMART_SCHEDULE_POSSIBLE
         else if (strcmp(argv[i], "-dumbSched") == 0) {
             SmartScheduleDisable = TRUE;
         }
@@ -916,6 +918,7 @@ ProcessCommandLine(int argc, char *argv[])
             else
                 UseMsg();
         }
+#endif
         else if (strcmp(argv[i], "-render") == 0) {
             if (++i < argc) {
                 int policy = PictureParseCmapPolicy(argv[i]);
@@ -1127,6 +1130,7 @@ XNFstrdup(const char *s)
 void
 SmartScheduleStopTimer(void)
 {
+#ifdef SMART_SCHEDULE_POSSIBLE
     struct itimerval timer;
 
     if (SmartScheduleDisable)
@@ -1136,11 +1140,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)
@@ -1150,6 +1156,7 @@ SmartScheduleStartTimer(void)
     timer.it_value.tv_sec = 0;
     timer.it_value.tv_usec = SmartScheduleInterval * 1000;
     setitimer(ITIMER_REAL, &timer, 0);
+#endif
 }
 
 static void
@@ -1161,6 +1168,7 @@ SmartScheduleTimer(int sig)
 void
 SmartScheduleInit(void)
 {
+#ifdef SMART_SCHEDULE_POSSIBLE
     struct sigaction act;
 
     if (SmartScheduleDisable)
@@ -1176,6 +1184,7 @@ SmartScheduleInit(void)
         perror("sigaction for smart scheduler");
         SmartScheduleDisable = TRUE;
     }
+#endif
 }
 
 #ifdef SIG_BLOCK
-- 
1.7.9



More information about the xorg-devel mailing list