Voodoo: default LFB relax frontsync + wait stats#6728
Merged
Conversation
Make LFB relax/front-sync the default for V1/V2, keep wait stats opt-in, document sync behavior, and reduce Windows swap/event stalls.
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
Enable front-sync LFB relax and wait stats by default (with env disable), remove unused pending_* counters, add clarifying comments around LFB sync/swap behavior, reduce swap wait stalls on Windows by using a zero‑ms sleep in the swap-complete loop, and avoid redundant fifo_empty_event resets to cut Win32 ResetEvent churn. Improvements target Voodoo 1 and Voodoo 2 behavior, stabilizing menu/gameplay hot spots across multiple titles.
Root Cause
On Voodoo 1/2, LFB reads always forced a full FIFO drain and render-thread idle, even when the CPU was reading from the back buffer. Games like Dungeon Keeper 2 (menu), Descent 2 (Voodoo mode when rockets hit walls), Sub Culture, and Thief issue frequent LFB reads, so the main thread repeatedly stalled the pipeline and speed could drop dramatically (menus down to ~85% or worse, and ~30% in the heaviest cases). The safer relax/frontsync path that avoids unnecessary flushes was only active when the env vars were set manually, so default runs never benefited; enabling it by default (while still forcing sync for front/aux reads) resolves those slowdowns without reintroducing artifacts. On Linux (Wayland), the stalls were far less pronounced and the relax path delivered stable 100% behavior quickly; on Windows, additional latency came from Sleep(1) granularity in the swap‑pending loop and heavy ResetEvent churn on the FIFO empty event. Switching to Sleep(0) and gating fifo_empty_event resets removes those extra Windows‑specific stalls while preserving correctness, bringing Windows behavior in line with the Linux results.
thanks to @unreal9010 for extensive testing across titles.
Checklist
References
Provide links to datasheets or other documentation that helped you implement this pull request.