fix(present): no-vsync fullscreen present flood + fullscreen direct scanout (Phase A + Phase B) - #124
Open
ariel3259 wants to merge 13 commits into
Open
fix(present): no-vsync fullscreen present flood + fullscreen direct scanout (Phase A + Phase B)#124ariel3259 wants to merge 13 commits into
ariel3259 wants to merge 13 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
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
A no-vsync fullscreen game (CS2) made the server stutter:
page_flip/scollapsed from refresh (~60) to 27–47 Hz because everyPresentOptionAsyncpresent re-composed the full 1920×1080 scene. This PR fixes the present flood at the core and enables fullscreen direct scanout (Phase A + Phase B).What changed
Phase A — async present defer + supersession (core)
22674c7e): aPresentOptionAsyncarriving mid-flip no longer re-composes; it parks.ca88a14b): a newer async present scraps the parked one (Xorg scrap semantics), so the flood coalesces to roughly one present per flip.eff=0(225551f4): immediate gate, outside the synced hold-back.Phase B — fullscreen direct scanout (KMS)
6182aa52): their presents become direct-scanout eligible.37bd6c0c).2d7ab515), with the atomic TEST_ONLY m1 probe.4c98c3fd): if the synchronized atomic unflip fails, fall back to per-output composed flips without releasing the still-scanned dma-buf or killing the session.e10f4cbd): a deferred store ref is recorded for Pictures whose backing materializes late, fixing the game-start transparency bug wherefree_pixmapdestroyed a drawable under a live Picture.cargo +nightly fmtacross the Phase A/B changes (3fa1ec7c).Key design decisions
options=0x8is NOT async. The original finding assumedPresentOptionAsync; 0x8 isPresentOptionSuboptimal(synced). The observable fix on the nvidia box comes from the pre-existing synced supersession + the merged DRI3 syncobj fixes (PR feat(dri3): serve DRI3 1.4 syncobjs through DRM #122); Phase A addresses the spec's genuinely-async flood case, which a conforming client can still hit.cursor_hw). On nvidia-drm the HW cursor strategy is off by default, so Phase B does not engage on the nvidia box unless overridden (YSERVER_HW_CURSOR_NVIDIA=1, follow-up PR). This is the plan's known software-cursor blocker, recorded as a blocker rather than a regression.present_vblank_scrapin Xorg'spresent.c.Hardware validation (2026-08-12, nvidia box, CS2 no-vsync, Cinnamon)
page_flip/sholds 59.8–61.0 through the flood (was 27–47).present_skips/scoalesces at a 266/s median.m1_probe_pass=0with no rejects/errors (HW cursor precondition unmet on this box).Files
crates/yserver-core/src/core_loop/process_request.rs— async defer/supersession + Skip eff=0.crates/yserver-core/src/present_scheduler.rs— successor/scrap scheduling.crates/yserver/src/kms/render/backend.rs— authoritative root, explicit-sync direct path, m1 pre-probe, composed-unflip degradation, late store ref.2026-08-11-cs2-fullscreen-novsync-pageflip-collapse.md), transparency-bug finding, spec (2026-08-11-async-present-defer-supersession.md), plan (2026-08-11-fullscreen-direct-scanout.md),status.md.Testing
cargo test -p yserver --lib— 798 passed.cargo test -p yserver-core --lib— 1154 passed.cargo clippy --all-targets -- -D warnings— clean.Dependency for reviewers
This branch is the base for the follow-up direct-scanout latest-wins supersession PR (
feat/direct-scanout-latest-wins), which should be reviewed only after this one lands.