startup: native draws serialise on the exclusive draw lock; readable-memory page probes dominate the hold in heavy scenes #3899
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#3899
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@SimSalabimse on GitHub · 2026-12-02 23:22 UTC · original
Summary
Native-path draws serialise on the exclusive draw lock. In a heavy scene (hundreds of translated draws per present) about two thirds of the wall time is spent holding that lock, and most of the hold is readable-memory page probes that take about one page fault each.
What was measured
Two runs of the same scene on the Windows test PC (Simsalabim), about 410 s each, with per-draw phase timers and, in the second run, a frame copy compare change (neither is upstream yet). One run per build, so treat the figures as one sample each, not a benchmark.
Steady slow phase (second half of each run), per present:
In the second run, where the frame copy was split into probe, compare, snapshot alloc, memcpy and ring reserve:
The system was also near its memory ceiling in the slow phase (low available RAM, commit close to the limit).
What is not known
The log cannot separate two readings of the faults: (1) memory pressure pages guest memory out and the probe pays the page-in, or (2) something faults once per range on every probe (a guard or protected page that is tripped and re-armed). The two runs also differ in build and scene timing, so the 10% fps gap is not a clean A/B.
Idea (not tested)
Related
AI-Assisted
github-bot referenced this issue2026-12-03 13:42:11 +00:00
@triggered02 on GitHub · 2026-12-03 13:43 UTC · original
Claiming the counter half of this, not the phase timers.
Slice: add probe accounting around
probe_readable(src/startup_stubs/local_log.h:166) — calls, bytes requested, pages actually touched, and a gated tick total — and surface it on the totals line next to the existingreads refused before a fault. Extendtests/startup_local_log_check.cppwith cases whose page-touch counts are hand-computable, so the numbers are pinned rather than asserted loosely.Deliberately not taking yet: the per-draw phase timers and the frame-copy phase split. Two reasons: this is a hot path, and a
QueryPerformanceCounterper probe would distort the thing it measures unless it is carefully gated; and the issue's phase split depends on counters that do not exist yet. Counters first, then phases with a measured baseline to compare against.What I can verify here: the check builds with clang-cl + an xwin splat and runs under Wine, and
startup_local_log_checkalready asserts probe semantics on mapped, freed and guard pages plus a simulated debugger, so extending it is a real gate rather than a smoke test. I will report the exact commands and the counts I expect per case.What stays open, and will stay stated as such: whether the 1.3–1.65k faults per present are pressure page-ins or per-range guard re-arms is not something a counter can answer on its own — attribution needs the Windows test PC and the title's scene. Wine timing is not Windows verification, so I will not present any fps or hold-time number as measured.
Overlap: no comments, no assignee, no open PR. The reporter mentions a draft PR series for the phase timers; I will not touch that part, and I will say so in the PR body if the counters land before the phases do.
AI-assisted.
github-bot referenced this issue2026-12-03 13:55:06 +00:00