fix(windows): skip hybrid GPU hook on single-GPU systems#4938
Open
SeMmyT wants to merge 1 commit intoLizardByte:masterfrom
Open
fix(windows): skip hybrid GPU hook on single-GPU systems#4938SeMmyT wants to merge 1 commit intoLizardByte:masterfrom
SeMmyT wants to merge 1 commit intoLizardByte:masterfrom
Conversation
…xgi.dll crash The NtGdiDdDDIGetCachedHybridQueryValue hook was introduced in LizardByte#3530 to prevent DXGI output reparenting on multi-GPU/hybrid systems. On single-GPU systems, this hook is unnecessary and causes an access violation (0xc0000005) in dxgi.dll at a consistent offset on Windows 11 24H2 build 29558+. The crash occurs because dxgi.dll's internal code path doesn't correctly handle the spoofed D3DKMT_GPU_PREFERENCE_STATE_UNSPECIFIED value on newer Windows builds, resulting in a crash loop where the service wrapper continuously restarts the process. This fix: - Enumerates DXGI adapters before installing the hook to detect single vs multi-GPU - Deduplicates adapters by VendorId+DeviceId (same physical GPU can appear as multiple DXGI adapters due to cross-adapter copies) - Skips the hook entirely on single-GPU systems where output reparenting is not a concern - Adds error handling for MH_Initialize and MH_CreateHookApi return values - Adds logging for hook installation status Tested on: RTX 4070 Ti (single GPU), Windows 11 24H2 build 29558, NVIDIA 591.86 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Guided-By: SeMmy
|
Member
|
Thank you for the PR submission, but I noticed you didn't use our PR template. Please update the PR to use the correct template. You can find it at https://github.com/LizardByte/.github/blob/master/.github/pull_request_template.md?plain=1 |
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.




Summary
NtGdiDdDDIGetCachedHybridQueryValueMinHook on single-GPU systems where it's unnecessary0xc0000005indxgi.dll) on Windows 11 24H2 build 29558+Problem
The hybrid GPU workaround hook introduced in #3530 causes an access violation in
dxgi.dllon recent Windows 11 builds (24H2, build 29558+) with single-GPU systems. The crash is deterministic — always at offset0x6cb2findxgi.dll— and creates an infinite crash loop where the service wrapper restartssunshine.exeevery ~6 seconds.Crash signature:
Root cause: the hook spoofs
D3DKMT_GPU_PREFERENCE_STATE_UNSPECIFIEDas the return value, but the updateddxgi.dllin build 29558 doesn't handle this state correctly on a code path that only executes when the hook is active.Fix
Before installing the hook, enumerate DXGI adapters to detect if the system has multiple physical GPUs:
Adapters are deduplicated by
VendorId+DeviceIdsince the same physical GPU can appear as multiple DXGI adapters.Also adds:
MH_Initialize()andMH_CreateHookApi()return valuesTest Plan
🤖 Generated with Claude Code