Conversation
presentCommon() calls QueryVideoMemoryInfo() on every Present on the best NVIDIA adapter, without a check that the app renders on it. On a laptop with an idle NVIDIA dGPU in runtime D3 and an eGPU from another vendor, each call waits for the GPU power arbiter and stalls Present for ~150 ms. Select the NVIDIA adapter only when its LUID matches the app device LUID (D3D12 and D3D11). If no adapter matches, ctx.adapter stays null, the same as on a system without an NVIDIA adapter. If the LUID is not available, keep the previous selection. Fixes NVIDIA-RTX#124. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fixes #124.
Problem
presentCommon()queriesQueryVideoMemoryInfo()on every Present. It queriesctx.adapter, which is the best NVIDIA adapter in the system. The code does not check that the app renders on that adapter.On a laptop with an NVIDIA dGPU and an eGPU from another vendor, the dGPU is idle in runtime D3. Each query then waits on the dxgkrnl adapter core lock while
DpiPowerArbiterThreadwakes the dGPU. In Diablo IV this caused stalls of about 145 ms, several per second. Traces and measurements are in #124.Change
getAppDeviceAdapterLuid(). It reads the adapter LUID of the app device fromctx.compute:ID3D12Device::GetAdapterLuid()IDXGIDevice::GetAdapter()andDXGI_ADAPTER_DESC::AdapterLuidctx.adapterstays null. This is the same path that a system without an NVIDIA adapter already takes, so the VRAM budget query is skipped.Behavior does not change when the app renders on an NVIDIA adapter.
Testing
I could not build Streamline locally, so this change is not compiled or tested. Please treat it as a proposed fix.
The workaround for the reported case is confirmed: with the NVIDIA dGPU disabled, the stutter stops. That is the same state this change produces for
ctx.adapter.CLA
I have not signed the CLA yet. If you want to take this change, tell me and I will send it.