diff options
| author | NotRexed <therealnothingfn@gmail.com> | 2026-11-28 16:35:02 -0500 |
|---|---|---|
| committer | NotRexed <therealnothingfn@gmail.com> | 2026-11-28 16:35:02 -0500 |
| commit | c7fcf49a77e4974bec8e8fc7e7bce66c071e1c5b (patch) | |
| tree | 21d0e0ba2ef974adaa565d477e104eacc774dbbd /runtime/src/bcpack.cpp | |
| parent | eaecc6ac1e6a750fccebd1a65c8c6bb1cb59a730 (diff) | |
Frame generation: Reflex sleeps where the title begins a frame and its markers are the title's own events (LEONIDA_FG_MARKERS=1; unset: at our present, as before)
Before, fg.rs sent SimulationStart, SimulationEnd, RenderSubmitStart and
RenderSubmitEnd together at the host's present and took Reflex's sleep after
it, on our submitting thread (leonida-submit) with the frame generation lock
held, frames numbered by the presents: Reflex paced our submitting thread, and
its frame limit (LEONIDA_FG_LIMIT_FPS) held back our presents while the title
went on at its own pace. With the switch a Reflex frame follows the title:
- frame.rs, the title's frame-start wait (after our tick): a new Reflex frame,
its sleep on the title's thread under no lock of ours, then SimulationStart.
A wait opens a frame only once the open one has had its first submission
(the title polls the wait in cutscenes); only such a wait sleeps. A sleep
over 250 ms is warned of, and after one over 2 s none is taken this run.
- queue.rs, the frame's first submission to a direct queue (ExecuteCommandLists
and ...X, before the lists go anywhere; found atomically): SimulationEnd and
RenderSubmitStart.
- queue.rs, the title's present: the newest frame that has submitted is the one
it shows; its index is kept by the present's number, which reaches the
presenter (present_planes), whose RenderSubmitEnd, constants, tags,
PresentStart and PresentEnd carry it: one token for everything of a frame.
The sleep after our present is gone with the switch.
Tokens are made and read one at a time under a small lock of their own (the
programming guide calls slGetNewFrameToken not thread safe), never held across
the sleep or the proxy's Present; Streamline is out of the presenter's lock,
which only the presenter takes now, so the title's threads never wait for it.
After Leandroazc/Azc-Low-End (streamline/reflex.rs Frames, streamline.rs
frame_begins / title_submits / title_presents / reflex_sleep, GPL-3.0), without
its pad readings: here the frame-start wait alone opens frames.
Counters (a line every 300 title presents) and Reflex's own latency report
(every 300 host presents) are logged with the switch on or off.
Measured 2026-11-28: waterside save, Series X, 1080 lines, frame generation
2x, RTX 4060 Ti, Ryzen 5 7600X, standing; one start each way, phases of 10 s
switching LEONIDA_PRESENT_SMOOTH (next commit); phases of 100 frames or more
in the world while frames were generated (Streamline's presented=2).
- Counters, both ways: 1.00 frame-start waits per title present, each opens a
frame (no polls; no present took a frame made or repeated); the waits, the
first submissions and the presents on one title thread; its present's frame
token and its ExecuteCommandListsX tokens always the last one our wait
handed out. The host presents on leonida-submit. No cutscene was measured.
- Reflex's limit at 28: its simulation starts 71.4 ms apart at the median and
p90 with the switch (65.4 and 88.4 without); the title sleeps about 50 ms a
frame in it; Reflex counts 53 ms from simulation start to present end.
- The frames handed over to be shown, with the switch against without
(presents not held / held): the change from one interval to the next 11.5 /
7.8 ms against 13.5 / 7.6, spread 11.5 / 8.7 against 12.3 / 8.4, median
71.2 / 71.9 against 72.0 / 72.2, p90 - median 8.8 / 8.5 against 9.5 / 11.0.
The asked summary of the title's presents (first two phases skipped, over
3,000 draws, not held): mean 81.9 (a stall in one phase) / median 73.2 / p90
83.8 / p90 - median 10.6 against 75.7 / 73.7 / 84.7 / 11.0.
- No limit: 10.1 / 7.2 against 11.1 / 7.7, spread 13.0 / 7.6 against 10.4 /
8.2, median 70.1 / 68.3 against 68.9 / 68.9.
A phase's figure varies by 1-3 ms (the standard deviation of the jitter of
phases not held), so the switch is not measurably better: off by default.
Test: fg::reflex_frame_tests::reflex_frames_follow_the_titles_events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/bcpack.cpp')
0 files changed, 0 insertions, 0 deletions