fix(present): stabilize no-vsync pacing and enable fullscreen direct scanout - #129
Open
ariel3259 wants to merge 16 commits into
Open
fix(present): stabilize no-vsync pacing and enable fullscreen direct scanout#129ariel3259 wants to merge 16 commits into
ariel3259 wants to merge 16 commits into
Conversation
…ializes late A Picture created over a host xid whose backing is not yet in the store took no incref (render_create_picture); a later free_pixmap then reached refcount 0 and destroyed the drawable under the live Picture - the game-start transparency bug. Record a deferred ref and apply it when the backing materializes (store_alloc), so the store refcount always pins a picture's drawable regardless of materialization timing.
…een stutter - findings: CS2 fullscreen no-vsync page-flip collapse (root cause + two adversarial review rounds) - spec: async present defer + supersession (the primary flood fix) - plan: 9-task TDD implementation plan (Phase A async defer, Phase B direct scanout efficiency) - findings: transparency bug mechanism confirmed and fixed - handoff doc for the transparency test
…ync-stutter # Conflicts: # crates/yserver-core/src/core_loop/process_request.rs # crates/yserver/src/kms/render/backend.rs # docs/status.md
Owner
|
While testing this, I noticed that #95 introduced drag-lag/latency. Will have to investigate that first. |
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.
PR handoff: async Present pacing and fullscreen direct scanout
Suggested title
fix(present): stabilize no-vsync pacing and enable fullscreen direct scanoutSummary
This PR builds the safe foundation for fullscreen no-vsync presentation in two
layers:
in flight, genuinely asynchronous Presents are parked instead of immediately
recomposing every request. A newer compatible async Present scraps the parked
predecessor using Xorg-style latest-wins semantics. Synced Present behavior is
unchanged.
act as the authoritative root and, when all scanout predicates pass, its
buffer is submitted directly to KMS. Explicit-sync sources are supported and
fullscreen candidates are pre-probed before admission.
The result is a stable VBlank-synchronized direct path. This PR does not
implement tearing or DRM async page flips.
Problem
A fullscreen no-vsync workload can produce Presents much faster than display
refresh. Sending every request through composition wastes GPU/CPU work and can
reduce the actual display flip cadence. Direct scanout also previously rejected
fullscreen Unredirected windows before reaching the KMS eligibility probe, so
eligible game buffers could not bypass composition.
Phase A controls an actual async flood at the Present scheduler. Phase B then
removes composition when the newest frame is a safe fullscreen scanout
candidate. These mechanisms are complementary but independent: Phase A is the
safe fallback when direct scanout cannot engage; Phase B is the efficient KMS
path when it can.
Implementation
Phase A
display boundary.
Skip, preserving ordering and Presentcompletion semantics.
Phase B
candidates.
than assuming that target is always the Composite Overlay Window.
degrade to composed per-output flips instead of terminating the server.
The branch also retains deferred store references for Pictures whose backing
materializes late. This prevents a live Picture from losing its drawable during
game startup.
Hardware validation
Testing used Cinnamon with fullscreen CS2/no-vsync on the NVIDIA KMS system.
The direct path was exercised with the opt-in NVIDIA hardware-cursor validation
lever.
Initial validation established that:
the 60 Hz display refresh;
The capture also corrected an important premise: CS2's observed
options=0x8is
PresentOptionSuboptimal, notPresentOptionAsync. Therefore that specificsession was stabilized primarily by the already-merged synced supersession and
DRI3 syncobj fixes. Phase A remains necessary for clients that really send
PresentOptionAsyncorPresentOptionAsyncMayTear, but it must not be creditedas the mechanism for that
0x8capture.Post-#95 pacing investigation
#95 made direct and composed-unflip transactions visible to the per-output
Present scheduler. A diagnostic selector compared that production
post95behavior with the earlier scheduler boundary using the same commit and binary.
The counterbalanced
post95-1 -> pre95 -> post95-2run did not givepre95atelemetry advantage: average
page_flip/swas 56.6 / 55.3 / 55.9, and samplesat or above 55 Hz were 87.0% / 84.3% / 86.7%. Phase B engaged in all three
cases, retiring 21,217 / 18,195 / 27,660 direct frames without a panic or fatal
server error. Perceived quality improved with run order rather than with the
selector.
Follow-up repeatability runs kept production
post95behavior, the same binaryand duration, and recorded workload markers, NVIDIA load, Present stages, and
KMS page-flip jitter. None of those post95 runs reproduced perceived-Hz lag.
The evidence therefore rejects the post-#95 visibility change as a sufficient
cause and does not support reverting #95.
Scope boundary: no tearing in this PR
This PR intentionally uses VBlank-synchronized KMS flips. A user disabling
VSync is represented by effective Present option bits, not inferred from request
rate or game settings. The follow-up Phase C may select tearing only when all of
the following hold:
That follow-up will advertise
async_may_tear, submitPAGE_FLIP_ASYNC, andown the additional buffer-retirement, fence, fallback, cursor, and multi-output
validation. Keeping it separate means async tearing can be reviewed or reverted
without losing the safe Phase A/B infrastructure in this PR.
Review notes
YSERVER_PHASE_B_FLIP_VISIBILITY=pre95switch is diagnostic only;production behavior remains
post95.YSERVER_HW_CURSOR_NVIDIA=1is an opt-in hardware-validation lever; it doesnot change the default NVIDIA cursor policy.
coverage, cursor, overlay, synchronization, and output eligibility checks.
be compared with identical binaries and explicit workload markers.