From 6884e6a5b0cabdce39005470f4bcd0d960cfc956 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathieu=20B=C3=A9rard?= <mathieu.berard@crans.org>
Date: Thu, 9 Feb 2017 14:05:32 +0100
Subject: The smart scheduler is not optional.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 Backported from X.org:

 commit 9f9268821b13038556fbc029df54ab0e9b2aa77f
 Author: Mathieu Bérard <mathieu.berard@crans.org>
 Date:   Mon Aug 11 13:52:38 2008 -0400

    The smart scheduler is not optional.

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
 nx-X11/config/cf/xorg.cf                        | 11 --------
 nx-X11/programs/Xserver/damageext/damageext.c   |  2 --
 nx-X11/programs/Xserver/dix/dispatch.c          | 17 ------------
 nx-X11/programs/Xserver/dix/events.c            |  2 --
 nx-X11/programs/Xserver/hw/nxagent/Args.c       | 20 --------------
 nx-X11/programs/Xserver/hw/nxagent/Display.c    | 35 ------------------------
 nx-X11/programs/Xserver/hw/nxagent/Display.h    |  4 ---
 nx-X11/programs/Xserver/hw/nxagent/Handlers.c   | 36 -------------------------
 nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 12 ---------
 nx-X11/programs/Xserver/include/dixstruct.h     |  5 ----
 nx-X11/programs/Xserver/os/WaitFor.c            | 14 ----------
 nx-X11/programs/Xserver/os/io.c                 |  6 -----
 nx-X11/programs/Xserver/os/osinit.c             |  4 ---
 nx-X11/programs/Xserver/os/utils.c              |  9 -------
 14 files changed, 177 deletions(-)

diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf
index 2b71b90ec..513f78a43 100644
--- a/nx-X11/config/cf/xorg.cf
+++ b/nx-X11/config/cf/xorg.cf
@@ -568,23 +568,12 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
 # endif
 #endif
 
-#ifndef UseSmartScheduler
-#define UseSmartScheduler YES
-#endif
-
-#if UseSmartScheduler
-#define SmartScheduleDefines -DSMART_SCHEDULE
-#else
-#define SmartScheduleDefines /**/
-#endif
-
 /* Server defines required for all OSs */
 #ifndef XFree86ServerDefines
 # define XFree86ServerDefines	-DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH \
 				XFree86XvDefines \
 				-DXFree86Server \
 				XFree86XvMCDefines \
-				SmartScheduleDefines \
 				DebugDefines XFree86XResDefines \
 				-DX_BYTE_ORDER=$(X_BYTE_ORDER) \
 				VersionDefines
diff --git a/nx-X11/programs/Xserver/damageext/damageext.c b/nx-X11/programs/Xserver/damageext/damageext.c
index 602825449..38a624be7 100644
--- a/nx-X11/programs/Xserver/damageext/damageext.c
+++ b/nx-X11/programs/Xserver/damageext/damageext.c
@@ -84,9 +84,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
     if (pDamageClient->critical > 0)
     {
 	SetCriticalOutputPending ();
-#ifdef SMART_SCHEDULE
 	pClient->smart_priority = SMART_MAX_PRIORITY;
-#endif
     }
 }
 
diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c
index d098afdc8..2c7550371 100644
--- a/nx-X11/programs/Xserver/dix/dispatch.c
+++ b/nx-X11/programs/Xserver/dix/dispatch.c
@@ -243,8 +243,6 @@ FlushClientCaches(XID id)
 	}
     }
 }
-#ifdef SMART_SCHEDULE
-
 #undef SMART_DEBUG
 
 #define SMART_SCHEDULE_DEFAULT_INTERVAL	20	    /* ms */
@@ -345,7 +343,6 @@ SmartScheduleClient (int *clientReady, int nready)
     }
     return best;
 }
-#endif
 
 #ifndef NXAGENT_SERVER
 #define MAJOROP ((xReq *)client->requestBuffer)->reqType
@@ -358,9 +355,7 @@ Dispatch(void)
     register ClientPtr	client;
     register int	nready;
     register HWEventQueuePtr* icheck = checkForInput;
-#ifdef SMART_SCHEDULE
     long			start_tick;
-#endif
 
     nextFreeClientID = 1;
     InitSelections();
@@ -380,13 +375,11 @@ Dispatch(void)
 
 	nready = WaitForSomething(clientReady);
 
-#ifdef SMART_SCHEDULE
 	if (nready && !SmartScheduleDisable)
 	{
 	    clientReady[0] = SmartScheduleClient (clientReady, nready);
 	    nready = 1;
 	}
-#endif
        /***************** 
 	*  Handle events in round robin fashion, doing input between 
 	*  each round 
@@ -409,9 +402,7 @@ Dispatch(void)
 	    isItTimeToYield = FALSE;
  
             requestingClient = client;
-#ifdef SMART_SCHEDULE
 	    start_tick = SmartScheduleTime;
-#endif
 	    while (!isItTimeToYield)
 	    {
 	        if (*icheck[0] != *icheck[1])
@@ -419,7 +410,6 @@ Dispatch(void)
 		    ProcessInputEvents();
 		    FlushIfCriticalOutputPending();
 		}
-#ifdef SMART_SCHEDULE
 		if (!SmartScheduleDisable && 
 		    (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
 		{
@@ -428,7 +418,6 @@ Dispatch(void)
 			client->smart_priority--;
 		    break;
 		}
-#endif
 		/* now, finally, deal with client requests */
 
 	        result = ReadRequestFromClient(client);
@@ -466,11 +455,9 @@ Dispatch(void)
 #endif
 	    }
 	    FlushAllOutput();
-#ifdef SMART_SCHEDULE
 	    client = clients[clientReady[nready]];
 	    if (client)
 		client->smart_stop_tick = SmartScheduleTime;
-#endif
 	    requestingClient = NULL;
 	}
 	dispatchException &= ~DE_PRIORITYCHANGE;
@@ -3593,9 +3580,7 @@ CloseDownClient(register ClientPtr client)
 	if (client->index < nextFreeClientID)
 	    nextFreeClientID = client->index;
 	clients[client->index] = NullClient;
-#ifdef SMART_SCHEDULE
 	SmartLastClient = NullClient;
-#endif
 	free(client);
 
 	while (!clients[currentMaxClients-1])
@@ -3684,12 +3669,10 @@ void InitClient(ClientPtr client, int i, void * ospriv)
     client->authId = 0;
 #endif
     client->fontResFunc = NULL;
-#ifdef SMART_SCHEDULE
     client->smart_priority = 0;
     client->smart_start_tick = SmartScheduleTime;
     client->smart_stop_tick = SmartScheduleTime;
     client->smart_check_tick = SmartScheduleTime;
-#endif
 }
 
 extern int clientPrivateLen;
diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c
index abbde67d5..fa8bfc92d 100644
--- a/nx-X11/programs/Xserver/dix/events.c
+++ b/nx-X11/programs/Xserver/dix/events.c
@@ -1542,10 +1542,8 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
 #endif
 	if (BitIsOn(criticalEvents, type))
 	{
-#ifdef SMART_SCHEDULE
 	    if (client->smart_priority < SMART_MAX_PRIORITY)
 		client->smart_priority++;
-#endif
 	    SetCriticalOutputPending();
 	}
 
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 46e01c737..3844fe046 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -2538,26 +2538,10 @@ void nxagentSetBufferSize()
 
 void nxagentSetScheduler()
 {
-  #ifdef DISABLE_SMART_SCHEDULE
-
-  #ifdef SMART_SCHEDULE
-
-  #ifdef TEST
-  fprintf(stderr, "nxagentSetScheduler: Disabling the smart scheduler.\n");
-  #endif
-
-  nxagentDisableTimer();
-
-  #endif
-
-  #else /* #ifdef DISABLE_SMART_SCHEDULE */
-
   /*
    * The smart scheduler is the default.
    */
 
-  #ifdef SMART_SCHEDULE
-
   if (nxagentOption(Shadow) == 1)
   {
     #ifdef TEST
@@ -2566,10 +2550,6 @@ void nxagentSetScheduler()
 
     nxagentDisableTimer();
   }
-
-  #endif
-
-  #endif /* #ifdef DISABLE_SMART_SCHEDULE */
 }
 
 void nxagentSetCoalescence()
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index d8e6aa7e3..eaee84855 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -597,8 +597,6 @@ Display *nxagentInternalOpenDisplay(char *display)
 
   int result;
 
-  #ifdef SMART_SCHEDULE
-
   /*
    * Stop the smart schedule timer since
    * it uses SIGALRM as we do.
@@ -606,8 +604,6 @@ Display *nxagentInternalOpenDisplay(char *display)
 
   nxagentStopTimer();
 
-  #endif
-
   /*
    * Install the handler rejecting a possible
    * loopback connection.
@@ -678,16 +674,12 @@ static void nxagentDisplayBlockHandler(Display *display, int reason)
      * for the remote display.
      */
 
-    #ifdef SMART_SCHEDULE
-
     #ifdef DEBUG
     fprintf(stderr, "nxagentDisplayBlockHandler: BLOCK! Stopping the smart schedule timer.\n");
     #endif
 
     nxagentStopTimer();
 
-    #endif
-
     if (reason == NXBlockRead)
     {
       #ifdef DEBUG
@@ -702,13 +694,9 @@ static void nxagentDisplayBlockHandler(Display *display, int reason)
 
       nxagentBlocking = 1;
 
-      #ifdef SMART_SCHEDULE
-
       if (SmartScheduleDisable == 1)
       {
 
-      #endif
-
         /*
          * Let the dispatch attend the next
          * client.
@@ -723,12 +711,8 @@ static void nxagentDisplayBlockHandler(Display *display, int reason)
         nxagentDispatch.in  = nxagentBytesIn;
         nxagentDispatch.out = nxagentBytesOut;
 
-      #ifdef SMART_SCHEDULE
-
       }
 
-      #endif
-
       /*
        * Give a chance to the next client.
        */
@@ -1022,12 +1006,8 @@ void nxagentInstallSignalHandlers()
    * Reset the SIGALRM to the default.
    */
 
-  #ifdef SMART_SCHEDULE
-
   nxagentStopTimer();
 
-  #endif
-
   newAction.sa_handler = SIG_DFL;
 
   sigfillset(&newAction.sa_mask);
@@ -1040,8 +1020,6 @@ void nxagentInstallSignalHandlers()
     FatalError("Can't set the handler for alarm signal.");
   }
 
-  #ifdef SMART_SCHEDULE
-
   /*
    * Let the smart schedule set the SIGALRM
    * handler again.
@@ -1049,8 +1027,6 @@ void nxagentInstallSignalHandlers()
 
   nxagentInitTimer();
 
-  #endif
-
   /*
    * Install our own handler for the SIGHUP.
    */
@@ -1146,12 +1122,8 @@ void nxagentResetSignalHandlers()
    * Reset the SIGALRM to the default.
    */
 
-  #ifdef SMART_SCHEDULE
-
   nxagentStopTimer();
 
-  #endif
-
   newAction.sa_handler = SIG_DFL;
 
   sigfillset(&newAction.sa_mask);
@@ -1164,8 +1136,6 @@ void nxagentResetSignalHandlers()
     FatalError("Can't set the handler for alarm signal.");
   }
 
-  #ifdef SMART_SCHEDULE
-
   /*
    * Let the smart schedule set the SIGALRM
    * handler again.
@@ -1173,7 +1143,6 @@ void nxagentResetSignalHandlers()
 
   nxagentInitTimer();
 
-  #endif
 }
 
 void nxagentOpenDisplay(int argc, char *argv[])
@@ -2969,16 +2938,12 @@ void nxagentWaitDisplay()
    * Disable the smart scheduler's interrupts.
    */
 
-  #ifdef SMART_SCHEDULE
-
   #ifdef DEBUG
   fprintf(stderr, "nxagentWaitDisplay: Stopping the smart schedule timer.\n");
   #endif
 
   nxagentStopTimer();
 
-  #endif
-
   if (nxagentDisplay != NULL)
   {
     #ifdef TEST
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.h b/nx-X11/programs/Xserver/hw/nxagent/Display.h
index fe8ae1d43..75da371d8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.h
@@ -116,8 +116,6 @@ Bool nxagentReconnectDisplay(void *p0);
  * Deal with the smart scheduler.
  */
 
-#ifdef SMART_SCHEDULE
-
 #define nxagentInitTimer() \
 \
     SmartScheduleInit();
@@ -149,8 +147,6 @@ Bool nxagentReconnectDisplay(void *p0);
 \
     SmartScheduleDisable = 1;
 
-#endif /* #ifdef SMART_SCHEDULE */
-
 /*
  * File descriptor currently used by
  * Xlib for the agent display.
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
index 1721be9fb..8e80a1524 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
@@ -564,16 +564,12 @@ void nxagentBlockHandler(void * data, struct timeval **timeout, void * mask)
    * the client is scheduled in.
    */
 
-  #ifdef SMART_SCHEDULE
-
   #ifdef DEBUG
   fprintf(stderr, "nxagentBlockHandler: Stopping the smart schedule timer.\n");
   #endif
 
   nxagentStopTimer();
 
-  #endif
-
   nxagentPrintGeometry();
 
   #ifdef BLOCKS
@@ -601,13 +597,9 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
     nxagentHandleConnectionStates();
   }
 
-  #ifdef SMART_SCHEDULE
-
   if (SmartScheduleDisable == 1)
   {
 
-  #endif
-
     #ifdef DEBUG
     fprintf(stderr, "nxagentWakeupHandler: Resetting the dispatch state after wakeup.\n");
     #endif
@@ -617,12 +609,8 @@ void nxagentWakeupHandler(void * data, int count, void * mask)
     nxagentDispatch.in  = nxagentBytesIn;
     nxagentDispatch.out = nxagentBytesOut;
 
-  #ifdef SMART_SCHEDULE
-
   }
 
-  #endif
-
   /*
    * Can become true during the dispatch loop.
    */
@@ -897,13 +885,9 @@ void nxagentShadowWakeupHandler(void * data, int count, void * mask)
     nxagentHandleConnectionStates();
   }
 
-  #ifdef SMART_SCHEDULE
-
   if (SmartScheduleDisable == 1)
   {
 
-  #endif
-
     #ifdef DEBUG
     fprintf(stderr, "nxagentShadowWakeupHandler: Resetting the dispatch state after wakeup.\n");
     #endif
@@ -913,12 +897,8 @@ void nxagentShadowWakeupHandler(void * data, int count, void * mask)
     nxagentDispatch.in  = nxagentBytesIn;
     nxagentDispatch.out = nxagentBytesOut;
 
-  #ifdef SMART_SCHEDULE
-
   }
 
-  #endif
-
   /*
    * Can become true during the dispatch loop.
    */
@@ -1095,13 +1075,9 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
       #endif
     }
 
-    #ifdef SMART_SCHEDULE
-
     if (SmartScheduleDisable == 1)
     {
 
-    #endif
-
       /*
        * Pay attention to the next client if this
        * client produced enough output.
@@ -1131,12 +1107,8 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
       }
       #endif
 
-    #ifdef SMART_SCHEDULE
-
     }
 
-    #endif
-
     return;
   }
   else if (in > 0)
@@ -1178,13 +1150,9 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
      * the inner dispatch loop forever.
      */
 
-    #ifdef SMART_SCHEDULE
-
     if (SmartScheduleDisable == 1)
     {
 
-    #endif
-
       if  (client -> index != nxagentDispatch.client)
       {
         #ifdef DEBUG
@@ -1230,12 +1198,8 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out)
         #endif
       }
 
-    #ifdef SMART_SCHEDULE
-
     }
 
-    #endif
-
   }
 
   /*
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
index 452fe8c43..8fc6cf5fd 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
@@ -241,9 +241,7 @@ Dispatch(void)
     register ClientPtr	client;
     register int	nready;
     register HWEventQueuePtr* icheck = checkForInput;
-#ifdef SMART_SCHEDULE
     long			start_tick;
-#endif
 
     unsigned long currentDispatch = 0;
 
@@ -389,13 +387,11 @@ Reply   Total	Cached	Bits In			Bits Out		Bits/Reply	  Ratio
 
          #endif
 
-#ifdef SMART_SCHEDULE
 	if (nready && !SmartScheduleDisable)
 	{
 	    clientReady[0] = SmartScheduleClient (clientReady, nready);
 	    nready = 1;
 	}
-#endif
        /***************** 
 	*  Handle events in round robin fashion, doing input between 
 	*  each round 
@@ -418,9 +414,7 @@ Reply   Total	Cached	Bits In			Bits Out		Bits/Reply	  Ratio
 	    isItTimeToYield = FALSE;
  
             requestingClient = client;
-#ifdef SMART_SCHEDULE
 	    start_tick = SmartScheduleTime;
-#endif
 	    while (!isItTimeToYield)
 	    {
 	        if (*icheck[0] != *icheck[1])
@@ -428,7 +422,6 @@ Reply   Total	Cached	Bits In			Bits Out		Bits/Reply	  Ratio
 		    ProcessInputEvents();
 		    FlushIfCriticalOutputPending();
 		}
-#ifdef SMART_SCHEDULE
 		if (!SmartScheduleDisable && 
 		    (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
 		{
@@ -437,7 +430,6 @@ Reply   Total	Cached	Bits In			Bits Out		Bits/Reply	  Ratio
 			client->smart_priority--;
 		    break;
 		}
-#endif
 		/* now, finally, deal with client requests */
 
                 #ifdef TEST
@@ -535,11 +527,9 @@ Reply   Total	Cached	Bits In			Bits Out		Bits/Reply	  Ratio
 #endif
 	    }
 	    FlushAllOutput();
-#ifdef SMART_SCHEDULE
 	    client = clients[clientReady[nready]];
 	    if (client)
 		client->smart_stop_tick = SmartScheduleTime;
-#endif
 	    requestingClient = NULL;
 	}
 	dispatchException &= ~DE_PRIORITYCHANGE;
@@ -1318,9 +1308,7 @@ CloseDownClient(register ClientPtr client)
 	if (client->index < nextFreeClientID)
 	    nextFreeClientID = client->index;
 	clients[client->index] = NullClient;
-#ifdef SMART_SCHEDULE
 	SmartLastClient = NullClient;
-#endif
 	free(client);
 
 	while (!clients[currentMaxClients-1])
diff --git a/nx-X11/programs/Xserver/include/dixstruct.h b/nx-X11/programs/Xserver/include/dixstruct.h
index 5019dea4a..ca50c7ca7 100644
--- a/nx-X11/programs/Xserver/include/dixstruct.h
+++ b/nx-X11/programs/Xserver/include/dixstruct.h
@@ -141,15 +141,12 @@ typedef struct _Client {
     struct _FontResolution * (*fontResFunc) (    /* no need for font.h */
 		ClientPtr	/* pClient */,
 		int *		/* num */);
-#ifdef SMART_SCHEDULE
     int	    smart_priority;
     long    smart_start_tick;
     long    smart_stop_tick;
     long    smart_check_tick;
-#endif
 }           ClientRec;
 
-#ifdef SMART_SCHEDULE
 /*
  * Scheduling interface
  */
@@ -170,8 +167,6 @@ extern Bool SmartScheduleStopTimer(void);
 
 extern Bool SmartScheduleInit(void);
 
-#endif
-
 /* This prototype is used pervasively in Xext, dix */
 #define DISPATCH_PROC(func) int func(ClientPtr /* client */)
 
diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c
index 899b1de0b..0ecca8b7a 100644
--- a/nx-X11/programs/Xserver/os/WaitFor.c
+++ b/nx-X11/programs/Xserver/os/WaitFor.c
@@ -190,9 +190,7 @@ WaitForSomething(int *pClientsReady)
     int nready;
     fd_set devicesReadable;
     CARD32 now = 0;
-#ifdef SMART_SCHEDULE
     Bool    someReady = FALSE;
-#endif
 
 #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
     fprintf(stderr, "WaitForSomething: Got called.\n");
@@ -215,7 +213,6 @@ WaitForSomething(int *pClientsReady)
 	    ProcessWorkQueue();
 	if (XFD_ANYSET (&ClientsWithInput))
 	{
-#ifdef SMART_SCHEDULE
 	    if (!SmartScheduleDisable)
 	    {
 		someReady = TRUE;
@@ -224,13 +221,11 @@ WaitForSomething(int *pClientsReady)
 		wt = &waittime;
 	    }
 	    else
-#endif
 	    {
 		XFD_COPYSET (&ClientsWithInput, &clientsReadable);
 		break;
 	    }
 	}
-#ifdef SMART_SCHEDULE
 	if (someReady)
 	{
 	    XFD_COPYSET(&AllSockets, &LastSelectMask);
@@ -238,7 +233,6 @@ WaitForSomething(int *pClientsReady)
 	}
 	else
 	{
-#endif
         wt = NULL;
 	if (timers)
         {
@@ -252,10 +246,8 @@ WaitForSomething(int *pClientsReady)
 	    wt = &waittime;
 	}
 	XFD_COPYSET(&AllSockets, &LastSelectMask);
-#ifdef SMART_SCHEDULE
 	}
 	SmartScheduleIdle = TRUE;
-#endif
 	BlockHandler((void *)&wt, (void *)&LastSelectMask);
 	if (NewOutputPending)
 	    FlushAllOutput();
@@ -394,7 +386,6 @@ WaitForSomething(int *pClientsReady)
 	    i = XTestProcessInputAction (i, &waittime);
 	}
 #endif /* XTESTEXT1 */
-#ifdef SMART_SCHEDULE
 	if (i >= 0)
 	{
 	    SmartScheduleIdle = FALSE;
@@ -402,7 +393,6 @@ WaitForSomething(int *pClientsReady)
 	    if (SmartScheduleTimerStopped)
 		(void) SmartScheduleStartTimer ();
 	}
-#endif
 	if (i <= 0) /* An error or timeout occurred */
 	{
 #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
@@ -442,7 +432,6 @@ WaitForSomething(int *pClientsReady)
 			selecterr);
 		}
 	    }
-#ifdef SMART_SCHEDULE
 	    else if (someReady)
 	    {
 		/*
@@ -452,7 +441,6 @@ WaitForSomething(int *pClientsReady)
 		XFD_COPYSET(&ClientsWithInput, &clientsReadable);
 		break;
 	    }
-#endif
 #if defined(NX_TRANS_SOCKET)
             if (*checkForInput[0] != *checkForInput[1])
             {
@@ -499,10 +487,8 @@ WaitForSomething(int *pClientsReady)
                         return 0;
 	        }
 	    }
-#ifdef SMART_SCHEDULE
 	    if (someReady)
 		XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask);
-#endif	    
 	    if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable))
 	    {
 		NewOutputPending = TRUE;
diff --git a/nx-X11/programs/Xserver/os/io.c b/nx-X11/programs/Xserver/os/io.c
index 3771d40fb..87739cfb1 100644
--- a/nx-X11/programs/Xserver/os/io.c
+++ b/nx-X11/programs/Xserver/os/io.c
@@ -430,11 +430,9 @@ ReadRequestFromClient(ClientPtr client)
 	    FD_SET(fd, &ClientsWithInput);
 	else
 	{
-#ifdef SMART_SCHEDULE
 	    if (!SmartScheduleDisable)
 		FD_CLR(fd, &ClientsWithInput);
 	    else
-#endif
 		YieldControlNoInput();
 	}
     }
@@ -442,16 +440,12 @@ ReadRequestFromClient(ClientPtr client)
     {
 	if (!gotnow)
 	    AvailableInput = oc;
-#ifdef SMART_SCHEDULE
 	if (!SmartScheduleDisable)
 	    FD_CLR(fd, &ClientsWithInput);
 	else
-#endif
 	    YieldControlNoInput();
     }
-#ifdef SMART_SCHEDULE
     if (SmartScheduleDisable)
-#endif
     if (++timesThisConnection >= MAX_TIMES_PER)
 	YieldControl();
 #ifdef BIGREQS
diff --git a/nx-X11/programs/Xserver/os/osinit.c b/nx-X11/programs/Xserver/os/osinit.c
index 7aa961a56..59b567356 100644
--- a/nx-X11/programs/Xserver/os/osinit.c
+++ b/nx-X11/programs/Xserver/os/osinit.c
@@ -55,9 +55,7 @@ SOFTWARE.
 #include "osdep.h"
 #include <nx-X11/Xos.h>
 
-#ifdef SMART_SCHEDULE
 #include "dixstruct.h"
-#endif
 
 #ifndef PATH_MAX
 #ifdef MAXPATHLEN
@@ -216,11 +214,9 @@ OsInit(void)
      * log file name if logging to a file is desired.
      */
     LogInit(NULL, NULL);
-#ifdef SMART_SCHEDULE
     if (!SmartScheduleDisable)
 	if (!SmartScheduleInit ())
 	    SmartScheduleDisable = TRUE;
-#endif
     OsInitAllocator();
     if (!OsDelayInitColors) OsInitColors();
 }
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index 5f7542a2d..204494d63 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -134,9 +134,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
 
 #include "opaque.h"
 
-#ifdef SMART_SCHEDULE
 #include "dixstruct.h"
-#endif
 
 #ifdef XKB
 #include "xkbsrv.h"
@@ -635,10 +633,8 @@ void UseMsg(void)
     ErrorF("+rrxinerama            Enable XINERAMA (via RandR) extension (default)\n");
     ErrorF("-rrxinerama            Disable XINERAMA (via RandR) extension\n");
 #endif
-#ifdef SMART_SCHEDULE
     ErrorF("-dumbSched             Disable smart scheduling, enable old behavior\n");
     ErrorF("-schedInterval int     Set scheduler interval in msec\n");
-#endif
     ErrorF("+extension name        Enable extension\n");
     ErrorF("-extension name        Disable extension\n");
 #ifdef XDMCP
@@ -1038,7 +1034,6 @@ ProcessCommandLine(int argc, char *argv[])
 	    i = skip - 1;
 	}
 #endif
-#ifdef SMART_SCHEDULE
 	else if ( strcmp( argv[i], "-dumbSched") == 0)
 	{
 	    SmartScheduleDisable = TRUE;
@@ -1062,7 +1057,6 @@ ProcessCommandLine(int argc, char *argv[])
 	    else
 		UseMsg();
 	}
-#endif
 #ifdef RENDER
 	else if ( strcmp( argv[i], "-render" ) == 0)
 	{
@@ -1367,8 +1361,6 @@ XNFstrdup(const char *s)
     return ret;
 }
 
-#ifdef SMART_SCHEDULE
-
 unsigned long	SmartScheduleIdleCount;
 Bool		SmartScheduleIdle;
 Bool		SmartScheduleTimerStopped;
@@ -1494,7 +1486,6 @@ SmartScheduleInit (void)
     return FALSE;
 #endif
 }
-#endif
 
 #ifdef SIG_BLOCK
 static sigset_t	PreviousSignalMask;
-- 
cgit v1.2.3