Repository navigation
Harden 1.2 GPU acquisition and display reset recovery with regression tests - #5
Merged
Merged
Conversation
…et, and fix release tag pattern - Distinguish discrete GPU candidates from integrated graphics; remember preferred adapter by Windows Locally Unique Identifier (LUID) to prevent trapping onto integrated GPUs on disconnect. - Introduce explicit AppState machine (NoDiscreteGpu, Acquiring, Active, DeviceLost, WaitingForDiscreteGpu, Resetting). - Add WM_DEVICECHANGE (DBT_DEVNODES_CHANGED) handling for instantaneous eGPU/dGPU plug-and-play re-acquisition. - Overhaul CycleAllDisplayAdapters with ResetResult enum and CM_Get_DevNode_Status driver startup verification. - Propagate reset exit codes to parent process to prevent relaunch loops on failure and warn user via balloon. - Fix GitHub Actions release tag trigger to standard glob 'v*'. - Update README for Windows 10/11 Graphics Settings alongside NVIDIA Control Panel.
… docs - Prevent preference drift by locking g_preferredLuid to the initial discrete selection; support temporary fallback adapters and auto-restore preference on reconnection. - Treat PartialDisable as an incomplete reset in WM_RESET_DONE with explicit balloon warning rather than silent relaunch. - Log state transitions via SetAppState using AppStateToString. - Clean up unused candidate vector in main.cpp. - Tighten comments and README regarding PCI device targeting and event-driven devnodes notifications. - Fix troubleshooting anchor link in README to #one-time-gpu-preference-setup.
…t check Avoid tearing down and rebuilding active D3D11 fallback devices on non-GPU devnode changes or periodic timer ticks by checking IsAdapterPresent(g_preferredLuid) before attempting reacquisition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and resulting behavior
GPU acquisition previously destroyed a healthy fallback before trying the preferred GPU. Display resets could also overlap, wait indefinitely without feedback, and re-enable adapters without preserving their initial disabled state.
This combined 1.2 candidate retains a healthy device until a replacement is created. A verified successful display reset now cleanly exits GPU-Switcher without relaunching, restoring the original intent of clearing GPU clients and allowing the dGPU to become inactive. It serializes cooperating reset helpers with a machine-wide named mutex, snapshots initial device state, and applies bounded recovery only to adapters successfully disabled by the current operation.
Changes
Validation
Integration and limits
PR #5 was merged into main as be7c45d. PR #4's head is included as a merge parent in the combined implementation.
The user retested 1893b60: launch, delayed resume acquisition, clean Exit, and panel return to Intel succeeded. LockApp's continued NVIDIA use after ordinary Exit was clarified by the user as expected Windows behavior, not a GPU-Switcher defect; clearing such clients is the purpose of manual Restart Display Adapters. No independent LockApp investigation is needed.
The corrected successful reset-to-exit path at 8fe69f0 passed the user's manual test: both adapters recovered after their first enable requests, the helper reported Success in 6547 ms, and the parent exited cleanly without relaunch at 13:11:46. The user confirmed the intended behavior. Historical builds' reset/relaunch results remain recorded accurately. Failed resets may still leave an adapter unresolved. There is no persistent recovery journal for a forcibly terminated helper. Other hardware, physical failure recovery, and cross-account/cross-session UAC remain unverified. Cross-process/cross-account logging and universal GPU classification remain follow-ups. The global mutex coordinates this tool's helpers, not external device managers.