[idd] recovery: unplug monitor without helper

When LGIddHelper is unavailable, recovery requests could remain
pending until timeout while the virtual monitor stayed connected.
This could leave a logged-out guest without a usable display.

Fall back to departing the IDD monitor for active recovery, then
re-arrive it before normal recovery completes. Serialize monitor
lifecycle changes and preserve recovery ordering across Helper
reconnects, timeouts, and stale responses.
This commit is contained in:
Geoffrey McRae
2026-08-20 16:03:58 +10:00
parent 7b059ad67e
commit 60a51fccdf
6 changed files with 777 additions and 47 deletions

View File

@@ -26,7 +26,9 @@
#include <wdf.h>
#include <IddCx.h>
#include <deque>
#include <memory>
#include <mutex>
#include <stddef.h>
#include <stdint.h>
@@ -55,6 +57,19 @@ private:
WDFTIMER m_transportTimer = nullptr;
bool m_recoveryHandlerSet = false;
std::mutex m_recoveryTransitionMutex;
CSRWLock m_localRecoveryLock;
std::deque<RecoveryAction> m_localRecoveryQueue;
RecoveryAction m_localRecoveryArrivalAction = {};
RecoveryAction m_latestRecoveryAction = {};
RecoveryAction m_helperRecoveryAction = {};
bool m_localRecoveryArrival = false;
bool m_latestRecoveryValid = false;
bool m_helperRecoveryComplete = false;
bool m_recoveryActive = false;
bool m_recoveryMonitorDisabled = false;
bool m_adapterReady = false;
UINT m_iddCxVersion = 0;
bool m_hasIddCx110DDIs = false;
bool m_canProcessFP16 = false;
@@ -67,6 +82,12 @@ private:
bool InitializeTransport();
void TransportTimer();
static bool SameRecoveryAction(
const RecoveryAction& left, const RecoveryAction& right);
bool QueueLocalRecovery(const RecoveryAction& action);
void RemoveLocalRecovery(const RecoveryAction& action);
void ProcessLocalRecovery();
void CompleteRecoveryArrival(bool arrived);
InteractionResult OnSetCursorPos(
const SourceKey& source, int32_t x, int32_t y) override;
InteractionResult OnSetResolution(const SourceKey& source,