diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-06-29 22:07:14 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-06-29 22:07:14 +0200 |
commit | a3d493a60de3c704b252775205bcafc3a175c853 (patch) | |
tree | 886e1d4134cdb61fdb4fedf1d0494e7b5fe5d273 /nx-X11/programs/Xserver/hw/nxagent | |
parent | 4213bf46c117e5186aa404172c5439d92a5ace7f (diff) | |
parent | ede842c21cb73ce592ebb972fff9ca1ccd239a4e (diff) | |
download | nx-libs-a3d493a60de3c704b252775205bcafc3a175c853.tar.gz nx-libs-a3d493a60de3c704b252775205bcafc3a175c853.tar.bz2 nx-libs-a3d493a60de3c704b252775205bcafc3a175c853.zip |
Merge branch 'uli42-pr/clarify_sleep' into 3.6.x
Attributs GH PR #930: https://github.com/ArcticaProject/nx-libs/pull/930
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Args.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 16 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Image.c | 14 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Options.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Options.h | 8 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 8 |
6 files changed, 32 insertions, 18 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 39fa6c5e2..1ae1b570b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -1365,7 +1365,7 @@ static void nxagentParseSingleOption(char *name, char *value) validateString(value), validateString(name), sleep_parse); } - nxagentChangeOption(SleepTime, sleep_parse); + nxagentChangeOption(SleepTimeMillis, sleep_parse); return; } else if (!strcmp(name, "tolerancechecks")) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index 411dfe933..9f0a3c9d9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -235,18 +235,18 @@ void nxagentBlockHandler(void * data, struct timeval **timeout, void * mask) * display. */ - if (NXDisplayError(nxagentDisplay) == 1 && nxagentShadowCounter == 0 && nxagentOption(SleepTime) > 0) + if (NXDisplayError(nxagentDisplay) == 1 && nxagentShadowCounter == 0 && nxagentOption(SleepTimeMillis) > 0) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: sleeping for %d milliseconds for slowdown.\n", - nxagentOption(SleepTime)); + nxagentOption(SleepTimeMillis)); #endif - usleep(nxagentOption(SleepTime) * 1000); + usleep(nxagentOption(SleepTimeMillis) * 1000); now = GetTimeInMillis(); } #ifdef TEST - else if (0 == nxagentOption(SleepTime)) { + else if (0 == nxagentOption(SleepTimeMillis)) { fprintf(stderr, "nxagentBlockHandler: not sleeping for slowdown.\n"); } #endif @@ -708,16 +708,16 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas nxagentHandleConnectionChanges(); } - if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0) + if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTimeMillis) > 0) { #ifdef TEST fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n", - nxagentOption(SleepTime)); + nxagentOption(SleepTimeMillis)); #endif - usleep(nxagentOption(SleepTime) * 1000); + usleep(nxagentOption(SleepTimeMillis) * 1000); } #ifdef TEST - else if (0 == nxagentOption(SleepTime)) { + else if (0 == nxagentOption(SleepTimeMillis)) { fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n"); } #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 9369aeb1e..db174a9de 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -492,9 +492,19 @@ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, if (nxagentShadowCounter == 0 && NXDisplayError(nxagentDisplay) == 1 && - nxagentOption(SleepTime) > 0) + nxagentOption(SleepTimeMillis) > 0) { - int us = nxagentOption(SleepTime) * 4 * (length / 1024); + /* + * The original NX code had 250us (microseconds) * length/1024 + * here and 50ms (milliseconds) elsewhere. Later ONE combined + * configurable sleep parameter was introduced, having a default + * of 50ms (that's milliseconds, not microseconds!), which is + * factor 200. For unknown reasons the factor was changed to 250 + * at the same time. Ensure the value is somewhere between 10ms + * and 1s. + */ + + int us = nxagentOption(SleepTimeMillis) * 1000 * (length / 1024) / 250; us = (us < 10000 ? 10000 : (us > 1000000 ? 1000000 : us)); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index 4d5fa3e16..0da504f06 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -157,7 +157,7 @@ void nxagentInitOptions(void) nxagentOptions.Xinerama = 1; - nxagentOptions.SleepTime = DEFAULT_SLEEP_TIME; + nxagentOptions.SleepTimeMillis = DEFAULT_SLEEP_TIME_MILLIS; nxagentOptions.ReconnectTolerance = DEFAULT_TOLERANCE; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index 166508ac3..e56860f04 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h @@ -36,7 +36,9 @@ #define UNDEFINED -1 #define COPY_UNLIMITED -1 -#define DEFAULT_SLEEP_TIME 50 + +/* in milliseconds */ +#define DEFAULT_SLEEP_TIME_MILLIS 50 extern unsigned int nxagentPrintGeometryFlags; @@ -366,9 +368,9 @@ typedef struct _AgentOptions int Xinerama; /* - * Sleep delay in microseconds. + * Sleep delay in milliseconds. */ - unsigned int SleepTime; + unsigned int SleepTimeMillis; /* * Tolerance - tightens or loosens reconnect checks. diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index b5df14f94..6b3ade715 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -788,9 +788,11 @@ enable/disable deriving session DPI automatically from real server ignored when reconnecting to a suspended session .TP 8 .B sleep=<int> -delay X server operations when suspended (provided in msec), set to -\fI0\fR to keep \fBnxagent\fR session fully functional when suspended -(e.g. useful when mirroring an \fBnxagent\fR session via VNC) +delay X server operations when suspended (provided in milliseconds), +set to \fI0\fR to keep \fBnxagent\fR session fully functional when +suspended (e.g. useful when mirroring an \fBnxagent\fR session via +VNC). Graphic intensive applications will be affected by this more +than others. The default is 50ms. .TP 8 .B tolerancechecks=<string> |