From 2fac543e72883d4ab34d7e97b2d6266350dd7d7c Mon Sep 17 00:00:00 2001 From: Christopher Pitstick Date: Mon, 12 Jun 2023 19:41:22 -0400 Subject: [PATCH] Fix corruption at low latency. This fix was introduced to prevent an infinite timeout/loop problem that resulted from certain edge cases in the dynamic resolution state machine. However, further improvements have rendered this unnecessary. An unintended side effect of this was disabling high-quality timing of the shared memory, resulting in corruption issues. Stress tested the resizing feature again without this, and it works fine. --- module/rdpClientCon.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/module/rdpClientCon.c b/module/rdpClientCon.c index 7c6095fb..792ce941 100644 --- a/module/rdpClientCon.c +++ b/module/rdpClientCon.c @@ -922,7 +922,8 @@ rdpClientConProcessMsgClientInput(rdpPtr dev, rdpClientCon *clientCon) cx = (param2 >> 16) & 0xffff; cy = param2 & 0xffff; clientCon->rect_id = 0; - clientCon->rect_id_ack = INT_MAX; + //clientCon->rect_id_ack = INT_MAX; + clientCon->rect_id_ack = 0; LLOGLN(0, ("rdpClientConProcessMsgClientInput: invalidate x %d y %d " "cx %d cy %d", x, y, cx, cy)); clientCon->shmemstatus = convertSharedMemoryStatusToActive(clientCon->shmemstatus); @@ -2896,7 +2897,7 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) #define MIN_MS_BETWEEN_FRAMES 40 #define MS_TO_WAIT_FOR_RETRY_UPDATE 4 #define MIN_MS_TO_WAIT_FOR_MORE_UPDATES 1 -#define UPDATE_RETRY_TIMEOUT 200 // After this number of retries, give up and perform the capture anyway. This prevents an infinite loop. +//#define UPDATE_RETRY_TIMEOUT 200 // After this number of retries, give up and perform the capture anyway. This prevents an infinite loop. static void rdpScheduleDeferredUpdate(rdpClientCon *clientCon, Bool can_call_now) @@ -2905,12 +2906,12 @@ rdpScheduleDeferredUpdate(rdpClientCon *clientCon, Bool can_call_now) uint32_t msToWait; uint32_t minNextUpdateTime; - if (clientCon->updateRetries > UPDATE_RETRY_TIMEOUT) { - LLOGLN(10, ("rdpScheduleDeferredUpdate: clientCon->updateRetries is %d" - " and has exceeded the timeout of %d retries." - " Overriding rect_id_ack to INT_MAX.", clientCon->updateRetries, UPDATE_RETRY_TIMEOUT)); - clientCon->rect_id_ack = INT_MAX; - } + // if (clientCon->updateRetries > UPDATE_RETRY_TIMEOUT) { + // LLOGLN(10, ("rdpScheduleDeferredUpdate: clientCon->updateRetries is %d" + // " and has exceeded the timeout of %d retries." + // " Overriding rect_id_ack to INT_MAX.", clientCon->updateRetries, UPDATE_RETRY_TIMEOUT)); + // clientCon->rect_id_ack = INT_MAX; + // } curTime = (uint32_t) GetTimeInMillis(); /* use two separate delays in order to limit the update rate and wait a bit