Commit 6884e6a5 authored by Mathieu Bérard's avatar Mathieu Bérard Committed by Mike Gabriel

The smart scheduler is not optional.

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