[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

@@ -25,6 +25,7 @@
#include <Windows.h>
#include <wdf.h>
#include <IddCx.h>
#include <mutex>
#include <vector>
#include "config/CSettings.h"
@@ -61,9 +62,14 @@ private:
// IddCx callback threads, the swap-chain thread, and the transport timer.
CSRWLock m_lock;
// Serializes monitor arrival/departure calls. IddCx can finish adapter
// initialization on a different thread from transport recovery work.
std::mutex m_lifecycleMutex;
bool m_replugMonitor = false;
bool m_replugPending = false;
bool m_monitorDeparted = false;
bool m_enabled = true;
bool m_swapChainAssigned = false;
bool m_swapChainReady = false;
bool m_waitForSwapChainRelease = false;
@@ -77,6 +83,8 @@ private:
public:
bool Create(UINT connectorIndex, IDDCX_ADAPTER adapter,
std::vector<BYTE> edid, CDeviceContext * owner);
bool Disable();
void Enable();
ReplugAction Replug();
void RequestMode(const CSettings::DisplayMode& mode);