Add experimental "unpaced" and "serial" processing options (Windows only)#1203
Add experimental "unpaced" and "serial" processing options (Windows only)#1203ns6089 wants to merge 7 commits intoLizardByte:nightlyfrom
Conversation
|
|
||
| if (config::video.unpaced && mouse_pointer_visible) { | ||
| // Wait for vblank and flush Desktop Duplication API mouse pointer updates. | ||
| DwmFlush(); |
There was a problem hiding this comment.
The "use_dwmflush" has some logic behind it and using DwmFlush bypasses it completely.
There was a problem hiding this comment.
Yes, and this was intentional.
DwmFlush() basically does WaitForVBlank() from direct3d and ensures duplication api has the most recent mouse pointer position (for some reason it normally gets delayed). Because this is unpaced path that disables sleeps, we need to limit update rate and call AcquireNextFrame() at even intervals for smooth mouse movement, WaitForVBlank() (or in this case DwmFlush()) accomplishes both.
There was a problem hiding this comment.
WaitForVBlank() and DwmFlush() don't behave similarly in terms of resolving capture issues related to the mouse pointer.
DwmFlush() was explicitly added to alleviate this issue: loki-47-6F-64/sunshine#227, but using it causes problems if the host monitor refresh rate is lower than the client requested framerate. See the description here: 2d969c2
Bypassing the host refresh rate detection before using DwmFlush() will cause this issue to reoccur on those configurations. I have not checked this PR, but I would recommend investigating ways to smoothen frametime consistency without involving DwmFlush() at all. IMO, it should be removed entirely, as the original mouse-induced stuttering bug can be resolved by invoking ReleaseFrame() immediately after acquiring the frame and copying the buffer (see PR on original repo for reference: loki-47-6F-64/sunshine#286)
There was a problem hiding this comment.
I will see if calling ReleaseFrame() before sleeping with WaitForVBlank() eliminates mouse delay in the next AcquireNextFrame(). If it does, we can safely move from DwmFlush() to WaitForVBlank() in this particular path.
There was a problem hiding this comment.
Hard to test this objectively, but looking at mouse trails over recursive moonlight window, this seems to work. Thanks!
|
Display Resolution 4K 120Hz (vsync disabled and freesync enabled) and Stream 4K60 HEVC SDR Base : 80 FPS (100%) Only in the case where serial processing is enabled, I reproduce an old bug that I had reported a while ago. |
|
Thanks for the feedback, but a short disclaimer so the discussion doesn't get derailed. |
I understood it very well. Currently, my skills do not allow me to invest in the code of Sunshine. |
ReenigneArcher
left a comment
There was a problem hiding this comment.
Overall, the docs looks go to me. I just have two minor suggestions.
|
Turns out "unpaced" path in its current form is more problematic than I thought. Encoder bitrate budget is calculated based on the bitrate and frame rate requested by he client, and we can't change this budget mid-stream due to ffmpeg limitations. This means exceeding the framerate requested be the client can (but not necessarily) also mean exceeding the bitrate requested by the client. Probably needs safeguards and additional documentation. Will think about it. |
|
This PR is stale because it has been open for 90 days with no activity. Comment or remove the stale label, otherwise this will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
Description
Bring back serial processing path (with optimizations) in attempt to maximize frame time consistency.
Spiritual successor to #1168
Screenshot
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.