Replace DwmFlush with modified frame release + timeout behaviour#826
Closed
psyke83 wants to merge 2 commits intoLizardByte:nightlyfrom
Closed
Replace DwmFlush with modified frame release + timeout behaviour#826psyke83 wants to merge 2 commits intoLizardByte:nightlyfrom
psyke83 wants to merge 2 commits intoLizardByte:nightlyfrom
Conversation
6ce3784 to
0f36766
Compare
0f36766 to
91dbe14
Compare
Prior to this change, we relied on the DwmFlush() workaround to avoid stutter during mouse movement and a visible mouse pointer, but DwmFlush() was causing the waitable timer to return too late, causing frame drops. This fixes two separate issues: * mouse-induced stutter (that was previously ameliorated by DwmFlush) * excessive frame capture delay seen since waitable timer was implemented Full changes: * Move release_frame() invocation to occur after snapshot() completes. * Handle DXGI_ERROR_INVALID_CALL error case in AcquireNextFrame() (occurs if snapshot() fully completes but release_frame() doesn't release successfully afterwards). * Reduce max timeout for waitable timer from 1s to frame to frame delay * Reduce AcquireNextFrame timeout to 1/2 delay period, and refund 1/2 delay period on timeout to give an extra chance to capture frame.
91dbe14 to
9018e1b
Compare
Contributor
Author
|
Closing this. I'm not happy with the current version of the PR, and I noticed that the Desktop Duplication API performance characteristics are different between Windows 10 and 11:
I'm not sure if this behaviour is specific to AMD cards, but it might be worth checking if any NVIDIA users experience the same issue on Windows 10 and might be planning to upgrade. |
5 tasks
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.
Description
Prior to this change, we relied on the DwmFlush() workaround to avoid
stutter during mouse movement and a visible mouse pointer, but DwmFlush()
was causing the waitable timer to return too late, causing frame drops.
This fixes two separate issues:
Full changes:
(occurs if snapshot() fully completes but release_frame() doesn't
release successfully afterwards).
to frame to frame delay period, which further avoids the waitable timer
from returning too late.
Comparison of DwmFlush() to PR via the following method:
wait_time_usresults.Results via nightly branch (1 minute capture, DwmFlush enabled):
Results via PR (1 minute capture):
Type of Change
.github/...)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.