Repository navigation
Description
@inada-s-ai
Instruction from @inada-s:
1.10.1 shipped with the setting that lowers the delay. Some players say the lag is terrible, maybe because their rollbacks do not keep up. Check whether, with TR off + vsync on, there is enough time in a frame for the rollbacks.
Background
1.10.1 includes these changes:
- PR Split one-way latency into rollback and input delay budgets for GGPO delay #559: input delay from the ping test now leaves 1.5 frames of one-way latency to rollback. That means a lower input delay and more and deeper rollbacks than 1.10.0.
- PR Rollback battles: present and input before the rollback, TR on limiter on the emu thread #543: Present and input before the rollback (TR off), and
MaxFrameLatency1. - The rollback speedups from Speed up emulation, measured by replay skip playback time #551.
TR off + vsync on is the recommended setting. Within one frame (16.68 ms) it has to fit:
- emulation;
- render;
- Present, which can block with vsync on;
- the rollback (load + N rerun frames);
- the limiter.
Hypothesis: at the RTTs where PR 559 lowered the delay, the rollback depth grows. On slower PCs, or when Present blocks, a frame overruns. The game then slows down or stutters, which players call lag. This is not verified.
Measure first, report only, no fix yet
Use the existing perf tooling (gdxsv_tests/perf/, GDXSV_PERF_TRACE, PresentMon). TR off, vsync on, DX11, 2 peers.
- Use the real delay selection.
- Do not set
TEST_GGPO_DELAY. Let the ping test pick the delay. - Use several send delays, for example 30/30, 50/50, 80/80 and 120/120 ms one-way. Pick ones where 1.10.1 chooses a smaller delay than 1.10.0 did.
- Run each on 1.10.0 and on 1.10.1, alternating.
- Do not set
- Per frame, from the trace:
- time used in total;
- the time in each part: emulation, render, Present (including the vsync block), load, rerun × depth, save;
- the remaining slack before the next frame.
- Report per build and delay setting:
- the chosen input delay;
- the rollback depth histogram and rolled-back frames per minute;
- the share of frames that overrun 16.68 ms;
- the worst frame times;
- the B3 frame period (59.94 kept?);
- GGPO timesync waits;
- press-to-display latency (A2).
- A slower PC. windows-mini is not the slowest PC players use. Repeat the worst setting with the emulator limited to fewer cores (CPU affinity), and say how much slower that makes a frame.
- Then a short proposal. For example: tune the rollback budget (1.5 frames) or cap the depth; make the budget depend on measured frame cost; or something else. Give the expected effect of each.
Time box: about one session of measuring. Post tables, not only conclusions. Do not change code until @inada-s decides.
Runner: windows-mini
Activity
inada-s-ai commentedon Oct 23, 2026
Measured: TR off + vsync on, 1.10.0 vs 1.10.1, delay from the real ping test (windows-mini)
Short answer: on windows-mini the rollbacks fit easily. No frame's own work went over 16.68 ms in 14 matches (about 29,000 frames). The worst frame took 10.5 ms, on 1.10.0. On 1.10.1 the worst was 10.1 ms, and a depth-2 frame takes about 6.2 ms. The frame period held at 59.94 and missed vblanks stayed at 0 to 0.1 % on both builds. On this box the budget is not what players feel as lag. I could not show the "slower PC" case: pinning the emulator to fewer cores does not slow a frame (below).
Setup
pvr.rend=2),ThreadedRendering=no,vsync=yes,DelayFrameSwapping=no. NoTEST_GGPO_DELAYand noTEST_PING_MS, so the default 7.5 s ping test picks the delay.GGPO_NETWORK_DELAY= d on both peers.inada-s/flycastmain8859c0b, which is 1.10.1 plus the perf trace (PR 547). For 1.10.0 I used taggdxsv-1.10.0with PR 547 cherry-picked; 2 conflicts inggpo.cpp, where I kept the 1.10.0 code and added the trace lines. The release exes have noGDXSV_PERF_TRACE. Builds were run alternately.Chosen delay (as the code predicts)
Per run
Work by rollback depth, 50 ms on 1.10.1 (frames, med, max ms): depth 0 (1967, 2.28, 7.46), depth 1 (101, 4.31, 6.20), depth 2 (31, 6.23, 7.35). One rerun frame costs about 1.75 ms and one load about 0.5 ms. The rollback speedups show in the numbers: a depth-1 rollback takes 4.3 to 4.7 ms on 1.10.0 and 2.2 ms on 1.10.1. Median work also fell from about 3.2 ms to 2.2 ms.
What the numbers say
addcarries the press to the display of that frame + 2. That fits battle.py, where the delay is fixed at 2. With the ping-test delay it does not: A2 reads about 75 ms for delay 2 and for delay 8 alike. The real press-to-display ≈ A2 + (delay − 2) × 16.68 ms. This is derived, not measured on screen. On that basis 1.10.1 shows a press 33 ms sooner at 50 ms and 80 ms, and at 120 ms.A slower PC (item 4): not shown
powercfgmaximum processor state) or a weak GPU used. That is not done.Likely sources of the reported lag (hypothesis, not tested)
Proposals (no code changed)
GdxMinDelayin the UI, or a budget option). Players who see the snapping can pick the 1.10.0 behaviour.max_rtt=... delay=..., GGPO stats) to tell hypothesis 1 from 2. Fix A2 for a delay other than 2 so press-to-display is measured on screen, not derived.Not done / where
inada-s/gdxsv-revengtools/rollback_budget/.Handover
powercfgmaximum processor state) for item 4; (b) proposal A with the same rig (budget 2.0 or 2.5): rolled-back frames per minute at 50 and 80 ms; (c) an A2 that works for any input delay.Status: waiting
inada-s commentedon Oct 23, 2026
@inada-s-ai Field data from the live server for this issue. Please investigate. The questions are at the end.
Summary
Data source and metrics
frame_count > 3000and at least 7fps_historysamples. The first 2 samples are dropped.fps_historyisstats.extra.current_fps(fpsAvg), sampled every 600 frames.blk=input_block_count_0+1+2per 10k frames. These count waits at the prediction barrier (MAX_PREDICTION_FRAMES = 6), inaddLocalInputandgdxsv_ggpo_wait_prediction_barrier.ts=total_timesyncper 10k frames.max_rtt/2/16.68 - delay.max_rttanddelaycome from themax_rtt=... delay=...line in before_log.1. One peer jitters alone, and the others wait (1.10.x only)
These are battles where all peers ran the same version. "Jitter" means the jitteriest peer has FPS stdev > 2 and every other peer has < 1.5. "Calm" means the jitteriest peer has < 0.8.
On 1.10 the jittery peer does not timesync more itself; the others do. Before 1.10 the jittery peer itself had the higher timesync.
Count of "jitters alone" battles per player:
Player A's delay is 2 on both versions (RTT about 25 ms). So for Player A this is not "a lower delay means deeper rollbacks". Something else in 1.10.x changed for that PC. Player A, per version:
Example
fps_historyof Player A on 1.10.1, battle 1792767195435, delay 2, max_rtt 35. It swings both ways, which looks like late frames followed by short frames:59.8 57.4 52.7 60.8 57.1 61.3 64.2 61.7 50.5 55.5 58.8 57.6 60.1 61.2 55.7 60.8 52.4 57.0 61.5 61.4 ... 67.6 ... 68.3 ... 48.3Most stable peers sit at stdev 0.1–0.4, for example 59.9 ± 0.3.
2. Jitter by predicted rollback depth (1.10 only, per player)
All peers together:
Player B's delay went from 3.5 (1.9.6) to 2.5 (1.10.1). Over the same change, Player B's blk went from 116 to 347 per 10k frames. Player C's delay went from 3.0 to 2.0, and blk from 0.7 to 222.
Battles at predicted depth ≥ 1 that show the two kinds of pattern. Each cell is FPS stdev / blk / ts.
All peers in these battles ran 1.10.1, delay 2 or 3, max_rtt 89 to 138.
3. Stalls at low RTT (1.10.1 vs 1.9.6)
input_block_count_0was 31.2 per 10k frames on all-1.10.1 battles and 3.3 on all-1.9.6 battles.Hardware of Player A (Sentry crash report, 2026-10-10, 1.9.6, same machine_id as today's 1.10.1 logins)
pvr.rend=2(DX11), window maximized, not fullscreen,rend.vsync=yes,rend.FixedFrequency=2(59.94),rend.ThreadedRendering=no,rend.DupeFrames=no,rend.Resolution=960,aica.LimitFPS=yes,gdxsv.MinDelay=2.nvspcap64.dll) is loaded in the process.FixedFrequency: Over slept 1000-1550 [us]every few minutes.platform_inforecords it.Relevant 1.9.6 → 1.10.x changes found so far
743c39edf(1.10.0) Frame limiter: an absolute schedule.6acf2c8d0(1.10.0) Rollback frame order:b81dd7f15(1.10.1) delay = ceil(one-way frames − 1.5). Lower delay, more rollbacks; your rig measured 190 to 280 rolled-back frames per minute.gdxsv_sleep_usand the 1 ms network pump (IdleLoop) have no functional changes in this range.Hypotheses to test
Asks
addtraces of the local peer (send interval jitter)wakeslack distributionplatform_infofields so field data can split these cases:Player names are replaced with letters. Raw data, mapping and battle codes are available from inada-s on request.
inada-s commentedon Oct 23, 2026
@inada-s-ai Field data from production (P2PMatchingReport, 2026-10-22 to 10-24). Please investigate.
Some players say 1.10.x battles are not comfortable, although the rollback speedups should allow the lower delay. Player names are replaced with letters.
Data
Others timesync more when one peer's FPS jitters (1.10 only). These are battles where all peers ran the same version. "One jitters" means one peer has FPS stdev > 2 and every other peer has < 1.5. "ts" is
total_timesyncper 10k frames.Player A: delay 2 and RTT about 25 ms on both versions. FPS stdev 1.83 on 1.9.6 (n=11) and 3.05 on 1.10.1 (n=9). Player A was the only jittery peer in 8 of 20 battles on 1.10.1, against 1 of 20 on 1.9.6.
FPS jitter grows with predicted rollback depth (
max_rtt/2/16.68 - delay) on 1.10:Battles where only one peer waits little while the other peers stall a lot. Each cell is FPS stdev / input blocks per 10k frames.
Input blocks at low RTT. At max_rtt ≤ 20 ms,
input_block_count_0was 31.2 per 10k frames on all-1.10.1 battles and 3.3 on all-1.9.6 battles.Hypotheses to check
743c39edf, frame order6acf2c8d0).ggpoMutexheld innextFrame,DoPollskipped in rollback). Packets are then lost or delayed.inada-s commentedon Oct 23, 2026
@inada-s-ai Instruction from @inada-s, in addition to the field data above (#573 (comment), #573 (comment)):
Work from the field data, not only from the windows-mini rig.
Add packet loss to the investigation
Where loss could come from on 1.10.x (to check, not verified):
ggpoMutexis held throughnextFrame, andDoPollis skipped during a rollback. A late frame (the limiter's late/short pattern) or a long rollback then leaves the UDP socket unread longer. If the OS receive buffer fills, datagrams are dropped.SO_RCVBUF(the Windows default is small).Measure on the rig, with 1.9.6, 1.10.0 and 1.10.1, alternating:
GGPO_NETWORK_DELAY. Add loss and jitter if a switch exists; else a small test-only switch is fine (runtime, documented).WSAEMSGSIZE, a buffer counter, or sent/received counts.Then a short proposal, if loss rises on 1.10.x. For example:
SO_RCVBUF;Keep the earlier rules: report first, no code change until @inada-s decides. Put the measurement scripts in this repository (
gdxsv_tests/) if they will be reused; otherwise drop them. Do not put them in gdxsv-reveng: movetools/rollback_budget/out of it the same way.Runner: windows-mini
Generated by Claude Code
inada-s commentedon Oct 23, 2026
@inada-s-ai Instruction from @inada-s, follow-up to #573 (comment):
The packet loss @inada-s sees is the on-screen stats OSD. Compare that figure across 1.9.6, 1.10.0 and 1.10.1. Nothing else to add. (An earlier version of this comment asked to count reordered packets; drop that, it is not in scope.)
Runner: windows-mini
Generated by Claude Code
inada-s commentedon Oct 23, 2026
@inada-s-ai Instruction from @inada-s:
The rise in packet loss is compared with 1.9.6. There is no field data for 1.10.0; it was live too briefly.
Report the numbers and which change it is. No fix until @inada-s decides.
Runner: windows-mini
Generated by Claude Code
inada-s commentedon Oct 23, 2026
@inada-s-ai Instruction from @inada-s:
A peer forwards relayed packets only when it reads its socket (
Peer2PeerBackend::OnMsg,p2p.cpp).So if one PC's reads stall, two things happen to the packets it relays for two other players:
The players on both ends then see loss and lag, though their own PCs are fine. One slow PC could raise the loss for the whole room.
Include this in the measurement:
Still report only; no fix until @inada-s decides.
Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 23, 2026
Packet loss: a first answer (windows-mini, code + 3 rig runs)
Short answer: the loss figure counts sequence-number gaps. It is not a count of dropped datagrams. A single lost packet adds 2, a single reordered packet adds 2 (and the late packet is then thrown away), and every session starts with about 10 phantom losses. That counting and the socket setup are the same in 1.9.6 and 1.10.x. On the rig, rollbacks make the socket go unread up to 3× longer (2.6 → 9.6 ms), but the receive buffer still holds about 400 datagrams, so OS buffer overflow is ruled out at these rates. Why players see more loss on 1.10.x is still open. The best lead is reordering from bunched sends, which counts as loss (hypothesis).
Where the figure comes from
↓ N(recv_packet_loss) and↑ N(send_packet_loss, the peer's↓sent back in its quality report every 1 s). The connection grade uses the increase over the last 2 s (lossHealth: 0 / ≤2 / ≤4 / ≤7). P2PMatchingReport has no loss field.udp_proto.cppOnMsg:skipped = seq - last_seq; whenskipped != 1,loss += skipped. Measured effects:seq < lastwraps to a largeskipped).last_seq(9d352ac6e, since 1.9.3), so the first input arrives withlast=0,seq=10.udp.cpp, the sequence logic, the send queue, or the OSD loss code (bc6a34d9ais in both). A rise between them comes from the traffic, not from the counter.Socket
SO_RCVBUF=SO_SNDBUF= 16384 (macOS 9216), inudp.cpp, unchanged.Receive Errors(netstat -s -p udp) is 0 since boot (2026-10-17). Loopback traffic is not counted there (+26 datagrams over a whole run), so this says nothing about the rig peers.Rig: gap between socket reads (scratch trace build, main 8859c0b, 2 peers, 50 ms send delay, TR off, vsync, DX11)
TEST_GGPO_DELAY=4GGPO_OOP_PERCENT=1What this means for the field reports (hypothesis)
GGPO_OOP_PERCENTholds a packet back by up to 10 × delay + 1 s).Proposals (no code changed)
skipped - 1; do not count a gap at the first message after sync; count late arrivals separately as "reordered". Then the OSD shows real loss. Needed before any loss number can be compared across versions.SO_RCVBUF, or polling during rollbacks.Not done yet
743c39edf, others timesyncing, low-RTT stalls): not started. Next run: trace theaddinterval andwakeslack on 1.9.6 / 1.10.1 / 1.10.1 with743c39edfreverted, windowed DX11, on a monitor that is not 59.94 Hz if possible.tools/rollback_budget/from gdxsv-reveng togdxsv_tests/: not done.Scratch trace diff (GGPO_TEST_LOG=1 → NETTRACE lines)
Handover
addtrace) and the remote timesync for field-data hypothesis 1, including743c39edfreverted; (3) movetools/rollback_budget/intogdxsv_tests/.Status: continue
inada-s commentedon Oct 23, 2026
@inada-s-ai Instruction from @inada-s (replaces "no fix until @inada-s decides" in my earlier comments):
The case that matters most: ping about 100 ms with delay = 2. Relay is unknown, so test both with and without relay.
On the rig:
GGPO_NETWORK_DELAYset for about 100 ms RTT, delay 2, 4 peers, 1.9.6 vs 1.10.1, compare the OSD loss.Try the suspects without asking first. Experimental builds and draft PRs are fine; merging still waits for @inada-s. Examples:
SO_RCVBUF;Keep each try measured against 1.9.6, interleaved, and post a short table: build, OSD loss, rollback frames, the longest gap between socket reads. Stop a branch of the search when it shows no effect.
Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 23, 2026
@inada-s Seen: #573 (comment), #573 (comment), #573 (comment), #573 (comment). They arrived while this run was ending, after the report above. Plan for the next run:
↓counter (recv_packet_loss) per loss event and the longest gap between socket reads per 10 s window.b81dd7f15reverted;743c39edf+6acf2c8d0reverted;SO_RCVBUF, smoothed sends.GGPO_NETWORK_DELAY=50(about 100 ms RTT), delay 2 (TEST_GGPO_DELAY=2, the same for every build), with and without relay. With relay: one peer forwards for two others, and only that peer is loaded.Status: continue
inada-s-ai commentedon Oct 23, 2026
4 peers, ~100 ms RTT, delay 2, with and without relay: 1.9.6 vs main (windows-mini)
Short answer: on the rig, no build loses a packet. 1.9.6 and main show the same OSD
↓figure: only the 10–13 phantom losses at session start. The suspects that act on the receiving socket (poll during rollbacks, a biggerSO_RCVBUF) have nothing to fix here. The longest gap between socket reads is ≤ 20 ms on both builds, and main has 3–4× fewer gaps ≥ 8 ms than 1.9.6. The bunched-send suspect is the wrong way round. 1.9.6 sends unevenly (23 % of input sends 5–10 ms apart, 32 % 20–34 ms apart). Main sends evenly (98.5 % 14–20 ms apart). Reverting743c39edfchanges nothing there.Setup
GGPO_NETWORK_DELAY=50on every peer (about 100 ms RTT),TEST_GGPO_DELAY=2, TR off, vsync, DX11, 4 windowed peers,rand_input, 90 s runs, order interleaved.TEST_RELAY=single. p1 reaches p4 through p2, and p2 receives about 2450 datagrams per 10 s instead of 1830.1.9.6= tag + trace.main= 8859c0b + trace (1.10.1 + perf trace only; 15 commits, nothing in GGPO or pacing).rev743= main + trace +743c39edfreverted by hand (relative limiter schedule).GGPO_TEST_LOG=1) logs each loss event with therecv_packet_losstotal, out-of-order drops, the read gap per 10 s window, and a histogram of the intervals between input sends. Diff: gdxsv-revengtools/rollback_budget/nettrace.diff. Runner:run4.py,sendhist.py(gdxsv-reveng 292ff94).Results (per run, all 4 peers)
Interval between input sends (all peers and queues, after the first 600 sends of each queue)
743c39edf). The likely source is6acf2c8d0(input before the advance), but that is not tested.What this rules out, and what is left
SO_RCVBUF, smoothed sends, the743c39edfrevert.b81dd7f15(delay budget) only changes the chosen delay, and this case fixes it at 2, so it was not run.GGPO_NETWORK_DELAYqueue keeps packets in order, so this rig cannot show it. Two ways forward:skipped - 1, no gap counted at the first message after sync, late packets counted apart). Then field loss numbers mean what they say and can be compared across versions. Small change; I can open it as a draft PR next run.GGPO_DROP_PERCENT, a short in-order jitter) to see whether 1.10.x needs more retransmits, or rolls back deeper, for the same real loss.Where
inada-s-ai commentedon Oct 23, 2026
Handover
743c39edfreverted, 13 interleaved runs (report above). No real loss on any build. Read gaps and send intervals are not worse on 1.10.x; 1.9.6 is the one that sends unevenly.SO_RCVBUF, smoothed sends, the743c39edfrevert.GGPO_OOP_PERCENTcan show the reorder count; (2) a scratch drop knob (B): same real loss rate on 1.9.6 and main, then compare rollback depth and retransmits; (3)6acf2c8d0revert, only if the send-interval difference matters.tools/rollback_budget/run4.py,sendhist.py,nettrace.diff(292ff94).Status: continue
inada-s commentedon Oct 23, 2026
@inada-s-ai Instruction from @inada-s's monitor, on #573 (comment):
run4.py,sendhist.pyandnettrace.diffare again in gdxsv-reveng. Move them to flycastgdxsv_tests/if they will be reused, else drop them.Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 23, 2026
B: same real loss on 1.9.6 and main: 4 peers, ~100 ms RTT, delay 2, ±relay (windows-mini)
Answers #573 (comment).
Short answer: with the same real loss, 1.9.6 and main show the same OSD loss for the same drops (about 2.15× the dropped datagrams on both builds). A lost input is recovered just as fast on both: 87–89 % within 20 ms, by the next packet. One drop does not lead to more loss or stalls on main. Packet size is the same: 43.5–43.7 B per datagram on both. Main sends about 1.5 % more datagrams. So, on an equally lossy line, main does not show a higher loss figure than 1.9.6. Main does timesync 2–5× more than 1.9.6, with or without loss. That matches field pattern 1. Reverting
743c39edfdoes not remove it. Reverting6acf2c8d0leaves it at 6–43 against 6–14 on 1.9.6, which is not conclusive.Setup
GGPO_DROP_PERCENT=2drops 2 % of the datagrams each peer receives. Drops come before relay forwarding, so a relayed packet can be lost on either hop. The same diff is applied to both builds.total_timesyncandinput_block_countevery 600 frames (the P2PMatchingReport fields).GGPO_NETWORK_DELAY=50on all peers,TEST_GGPO_DELAY=2, TR off, vsync, DX11, 4 windowed peers, 90 s, builds interleaved. Sums are over all 4 peers.1.9.6= tag + trace + knob.main= 8859c0b + trace + knob.2 % drop
skippedrather thanskipped - 1, and the 10–13 phantom losses at session start.Timesync without loss (0 % drop, relay single)
743c39edfreverted6acf2c8d0reverted (input after the advance, MaxFrameLatency 0)* zIa–d were meant to turn the restored
RollbackInputBeforeAdvanceback on. The--configoverride did not reachemu.cfg(it still hadno), so all six runs are the same build in the same mode.What this says
743c39edf, and6acf2c8d0is not shown. Next: bisect 1.9.6..main on the 0 % timesync count. A run takes 95 s and the count varies run to run, so use ≥3 runs per build.Where
G:/ai/reveng/s654on windows-mini (nettrace3.diff,rev6acf.diff,run4.py,table.py). Not committed.inada-s-ai commentedon Oct 23, 2026
Handover
743c39edfrevert has no effect on timesync.6acf2c8d0revert withRollbackInputBeforeAdvance=yes. Theconfig:gdxsv.RollbackInputBeforeAdvance=yesoverride passed throughrbk_lib.run_matchdid not reachemu.cfg. Next run: find out why, or flip the default in the build.gdxsv-1.9.6..8859c0b26on the timesync count at 0 % drop, ≥3 runs per build, with the 1.9.6 control interleaved. Scratch diffs and runner are on windows-mini inG:/ai/reveng/s654(nettrace3.diffapplies to both builds;rev6acf.diff;run4.py <exe> <tag> 50 2 single <drop%>;table.py).Status: continue
24 remaining items
inada-s commentedon Oct 24, 2026
@inada-s-ai Instruction from @inada-s, on the choices in #573 (comment):
budget_exhausted_*as the real slack. That is P − (cycle − Present block − limiter sleep), as in the report. Keep the cost rules (fixed histograms, no allocation on hot paths).(b) How to investigate
Find the mechanism first; don't bisect yet.
TimeSync::recommend_frame_wait_duration);_local_frame_advantagesamples that went into it;nextFrame, the local frame advantage,last_received_input.frameper remote. That shows how the advantage moves.743c39edf) or with input-before-advance (6acf2c8d0; the input is sent before the advance, andSetLocalFrameNumberuses delay + 1)?743c39edfhalved it at302bec0b9, and a second step came later (part 3 above);Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 24, 2026
Handover (windows-mini)
PR 574 (SIO_UDP_CONNRESET): done, see #574 (comment). C1: 62–67
10054lines per remaining peer before, 0 after; default suite all PASS.(a) budget = real slack, PR 575: code written, built, not verified, not pushed.
rollback_budgetitself becomes the slack (proto saysbudget_exhausted_frames= frames withrollback_budget <= 0, so one definition): per limiter cycle (wake to wake, from the first wake after the first input)period − (cycle − Present blocking on the limiter's thread − limiter sleep). Present blocking is counted only with TR off (TR on: the UI thread presents; same as the s664 analysis). No allocation; two time points and an int64 more.pb.gocomment line regenerated with protoc 3.13,go buildok). flycastgdxsv.pb.*carry no comments: no regen.G:/ai/reveng/s666r/a575.diff(apply onai/net-reportc166b49). Builds:s666r/fly575N.exe(clean),s666r/fly575D.exe(+ report dump at wake 3000,present_b/sleep_bperf-trace events).battle.py --exe s666r/fly575D.exe --cells 30_170_tr0_vs1(andtr1), thenpython s666r/slack.py <out>/<cell>_1/p1(and p2): report vs CSV slack must match; then commit + push toai/net-report, update the PR body.(b) timesync 10×: first data, mechanism hypothesis (probe
s666r/tsprobe.diffon GGPO lib, same on both builds;ts196.exe= 1.9.6 + nettrace3 + probe,ts110.exe= gdxsv-master 8859c0b + same; rigs666r/run4t.py,tsbatch.sh, analysists.py out/<run>).Over slepton p1), timesync events per peer:_local_frame_advantage(the samples TimeSync averages), 12 pairs × 3 runs: 1.9.6 mean +0.08…+0.49, sd 0.55–0.84. 1.10 mean +0.03…−1.10, sd 0.75–1.54. Both peers of a pair shift by about −0.8 frame (symmetric, so it cancels as expected: confirmed), and the spread nearly doubles.radv − adv ≥ 3(round to ≥ 2 frames). The trigger cases are mostlyl = −2 ×10, r = +1 ×10: steady one-frame offsets on both sides, not spikes. With a doubled spread of the difference, ≥ 3 is hit far more often → hypothesis: the 10× comes from the wider advantage distribution, not from the bias.743c39edf) or input-before-advance (6acf2c8d0). The F lines include re-run frames (they come fromIncrementFrame), so use S-line times for frame pacing.wakeslack (perf.csv on 1.10) to test the limiter link; then propose a fix.Scratch:
G:/ai/reveng/s666r/on windows-mini.Status: continue
inada-s commentedon Oct 24, 2026
@inada-s-ai Instruction from @inada-s, add to the current run, next to the p2
present_waitquestion (#575 (comment)):Does fullscreen change the Present wait?
present_wait,rollback_room,over_period), plus PresentMon for:Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 24, 2026
Handover (b): where the timesync spread comes from (windows-mini)
About #573 (comment) (fullscreen vs Present wait): not run yet. It is the first Next item for the next session; this session's context is at its limit.
Hardware Composed: Independent Flipfor each (sync interval 1, no tearing).present_waitfollows the display target's rate, not the mode.Continues #573 (comment). Same rig and probe (
s666r/ts196.exe,ts110.exe,run4t.py). New scripts are inG:/ai/reveng/s668/.1. The advantage spread is real peer desync, not measurement noise.
adv = (last_recv − frame) + rtt·60/1000(comp.py; sd in frames, per-pair mean removed):age.py): the time since the remote sent the last received input is p50 47–49 ms on both versions; sd 6 ms on 1.10, 7.5–12.5 ms on 1.9.6.dsync.py: D(f) = time peer j sends frame f − time peer i sends it, per pair, mean removed; ms):out/n{110,196}_{1,2}, interleaved, load 1–6 %,Over slept0–1 on p1. The vsync-off setting took effect: frame dt p50 is 9.6–16 ms, with no 16.7 ms quantization.2. Link to vsync / input order (
verifiedmechanism, partial share).addLocalInput(SendInput, where adv is sampled) → advance/rollback. The SendInput time after the wake therefore includes the Present wait. It varies 5–16 ms per peer (send.py), and it switches with the Present state (see gdxsv: rollback, Present, input and limiter timing stats in P2PMatchingReport #575 (comment)). p2 inv110_1drifts 16 µs per frame (locked to the 60.00 Hz display); p3 and p4 sit at fixed levels (59.94 Hz).(off_i − off_j)/P, 3 runs, n = 2532: slope +1.06 (+1 predicted), r = 0.41 (reg.py).dser.py out v110_2).3. The rest (vsync off: 1.10 slow sd 9–12 ms vs 1.9.6 3–4):
hypothesis= the limiter change743c39edf.period − elapsed(relative, ~59.0 fps). 1.10 keeps an absolute schedule and skips whole periods after a stall. Not tested.late.py out v110_1) mark the 5–7 frame events.Fix proposal (not built):
Next:
battle.pycell30_170_tr0_vs1(PR 575 debug builds667f/flyD.exedumpsframe_timing), with p1 windowed / borderless / exclusive fullscreen (check the DX11 path first), ≥ 2 runs each, alternated. Load < 5 % before each run. Capture with PresentMon unfiltered (--process_namewrote nothing;pmp.pysplits by pid). Report one table: present mode,present_wait,rollback_room,over_period, and Present → display latency. Note which display target each peer locks to (phase.pywithVBL_MS=16.6674vs16.68335).743c39edfreverted (fly540 tree, incremental). Run 2× vsync off vsts110.exe, interleaved. Prediction if the limiter is the cause: slow sd 9–12 → 3–4 ms, timesyncs 3–13 → 0–2 per peer.v110_*.Status: continue
inada-s commentedon Oct 24, 2026
@inada-s-ai Instruction from @inada-s, for any fix of the Present wait (no fix yet, this is about scope):
DO_NOT_WAIT, VulkanMAILBOX/ present wait,CAMetalLayerdrawable count /displaySyncEnabled, GL swap interval.present_wait, windowed vs fullscreen), also run the TR off + vsync case on OpenGL and Vulkan on windows-mini. Then we know whether the wait is DX11-specific.Runner: windows-mini
Generated by Claude Code
inada-s commentedon Oct 24, 2026
@inada-s-ai Instruction from @inada-s, clarifying #573 (comment):
No Present-wait fix is requested yet. Do not prototype or open a PR for one.
For now, only report the investigation:
present_waitwas long;@inada-s will decide on a fix after seeing the results. The renderer and Mac scope in that comment only applies when a fix is asked for.
Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 24, 2026
Results for #573 (comment), scoped by #573 (comment): investigation only, no fix built (windows-mini).
Setup:
battle.pycell30_170_tr0_vs1(TR off, vsync on, 2 peers), PR 575 debug builds667f/flyD.exe. Each run'sNETREPORTframe_timingcovers 2400 frames. PresentMon captured all processes and was split by peer pid; the first 20 % of each run is skipped. 8 runs, alternated:gl,win,bfs,vk,win,gl,vk,bfs. CPU load 1–9 % before each run, defrag task idle,Over slept0 in every peer log. Box: Ryzen 3400GE / Radeon Vega 11 iGPU, two HDMI targets cloned at 60.000 and 59.940 Hz. The display gap mode (16.67 / 16.68 ms) shows which target a peer flips on.present_waitp50 / p99 (µs)rollback_roomp5 / p50 (µs)over_period/2400workp50 is similar everywhere: DX11 1.9–2.3 ms, VK 2.5–2.8 ms, GL 2.8–3.0 ms.1. Why the p2
present_waitwas long (DX11). The cause was found in #575 (comment) and both runs here reproduce it.MaxFrameLatency 1, the frame queued at start-up never drains. Each Present then waits 14.4 ms:present_waitp50 14464 µs, PresentMon in-Present 14.3 ms.rollback_roomp50 is only 14–47 µs and 36–46 % of frames overrun.2. Windowed vs borderless vs exclusive fullscreen (DX11).
window:fullscreen=yes, i.e. SDLFULLSCREEN_DESKTOP) is still Independent Flip, the same mode as windowed.over_period85–199 is the same range as windowed p1 (29–214). So the present mode is not what changes the wait; the target's refresh rate is. My earlier prediction holds.hypothesis, not tested. A user with a single 59.94 Hz display should be in the p2 case whatever the window mode (hypothesis; this box has no single-display setup).Composed: Flip. Its Present does not block (in-Present 0.1 ms,over_period12–172). Display latency goes up to 33 ms, though: DWM adds about one frame.core/sdl/sdl.cpponly ever usesSDL_WINDOW_FULLSCREEN_DESKTOP(except GLES builds), andcore/rend/dx11/dx11context.cppnever callsSetFullscreenState. Not run.3. DX11 vs OpenGL vs Vulkan (both peers on that API, windowed).
present_waitp50 11.6–12.7 ms,rollback_roomp50 0.8–2.2 ms,over_period563–653 (23–27 %). PresentMon's in-Present is 0, so the block is inside the GL swap call, outside the present that PresentMon times. The cause of the GL block is not separated (driver render-ahead throttle,hypothesis).present_waitp50 71–77 µs, p99 ≤ 340 µs,rollback_roomp5 13.4 ms,over_period2–8.vulkan_context.cppskips MAILBOX on AMD.Composed: Copy with GPU GDI, so the image is released at once. The time is not hidden elsewhere either:workp50 is only about 0.4 ms above DX11.What windows-mini can and cannot check:
FrameTimingfields; PresentMon.Data and scripts:
G:/ai/reveng/s669a/(modes.pyruns variants viabattle.py,ana.pybuilds the table,out/<run>/p{1,2}/flycast.log,out/<run>_pm.csv,out/<run>_pids.txt).Next:
743c39edfreverted) and the input-at-frame-top prototype A. Both are on hold until @inada-s decides on scope.Status: waiting
inada-s commentedon Oct 24, 2026
@inada-s-ai Instruction from @inada-s, add to the current investigation (the p2
present_wait, fullscreen and renderer comparison). Investigation only, no fix.Does the Present wait really take rollback time, or is it elastic slack?
MaxFrameLatency 1, Present waits until a buffer is free. If the work before it gets longer, the wait should just get shorter, and the frame still makes its vblank. Then a longpresent_waitis not lost budget. Time is only lost when a vblank is missed.present_wait) and in a p1-like state:present_waitshrinks by about the rollback time;over_period/rollback_roomcount elastic vsync waits as lost time. If they do, note how the definition should change. Don't change it yet.Runner: windows-mini
Generated by Claude Code
Revert the GGPO delay rollback budget (PR 559) to stop the 1.10.1 lag
inada-s-ai commentedon Oct 24, 2026
Answer to #573 (comment). This is investigation only; no code was changed. All of it ran on windows-mini.
Data: I re-analyzed the 8 runs from #573 (comment) frame by frame. That is cell
30_170_tr0_vs1with TR off and vsync on, PR 575 debug build. Each peer hasperf.csv(QPC eventswake,wb/wearound Present,load_b,rerun_e,sleep_b) and PresentMon withTimeInQPC. Each trace frame is matched to the PresentMon row nearest its Present start. For DX11 the match is within 4–5 µs (p50). I skip the first 20 % of each match. A miss is a display-change gap of more than 1.5 periods, or a dropped frame. Scripts:G:/ai/reveng/s670/ela.pyanddrain.py.1. DX11 (default renderer): the wait is elastic slack. "Next pw" is the
present_waitof the frame after the rollback. "Post" is the work after Present, which includes the rollback.2. Pacing state. The frame period does not separate p1 from p2, so the hypothesis needs a correction:
hypothesis).3. OpenGL is different: real loss. GL blocks inside the swap call. Its wait is only partly elastic (slope −0.39 to −0.49), and deep rollbacks miss vblanks:
4. PR 575
over_period/rollback_roomcount the elastic wait as lost time.busy= limiter wake → next limiter call, andbusyincludespresent_wait:over_period=period < busy;rollback_room=period − (busy − rollbackWork).over_periodcounted 923 and 1044 frames per 2412 (680 of win_1's 862 in the NETREPORT were at depth 0). Of those, 0 were followed by a missed vblank.rollback_roomp50 is 14–47 µs, but the real room is about 14 ms.late_frames_*/dropped_framescounters already measure the interval; they would need the depth split.busyonly when it is a vblank wait. Taking it out everywhere would hide GL's loss (section 3), so the Present-interval miss count should be the headline number.over_periodstays valid for limiter-gated frames (p1, VK, vsync off).Conclusion (TR off + vsync):
verifiedfor rollbacks up to 7.2 ms (360 frames after a rollback on p2, 0 misses, same as the drained p1).Next:
over_period/rollback_roomdefinition change (section 4) and whether a Present-wait / latency fix is in scope. Open from 1.10.1: reports of heavy lag; check the rollback time budget with TR off + vsync on #573 (comment): the limiter A/B and input-at-frame-top prototype A.Status: waiting
inada-s commentedon Oct 24, 2026
@inada-s-ai Instruction from @inada-s: fix the frame-timing fields that shipped in 1.10.2. Open the PR as a draft and keep it a draft until the check below passes; @inada-s decides when it is ready.
Background: #573 (comment).
over_period/rollback_roomcount the elastic DX11 vsync wait as lost time. On DX11 p2, about 900 frames were flagged "over", and 0 vblanks were really missed.Change
Follow section 4 of your report:
late_frames_*/dropped_framestiming where possible.over_periodonly where it is valid (limiter-gated frames), or drop it. Do not reuse old field numbers with a new meaning: mark the shipped fields deprecated, add new numbers in the gdxsv proto (gdxsv PR, with the LBS log and a test), and note in the proto how to read 1.10.2 data.Check (required before ready)
Runner: windows-mini
Generated by Claude Code
inada-s-ai commentedon Oct 24, 2026
Answer to #573 (comment). Draft PRs: #577 and inada-s/gdxsv#440. The check does not pass yet, so both stay draft.
Done
rollback_room/over_period/over_period_depth_histare marked deprecated, and the proto says how to read 1.10.2 data. New fields:present_depth_hist,late_present_depth_hist,dropped_depth_hist(42–44);FrameTiming.present_wait_elasticity(10) androllback_slack(11).Check (windows-mini, Vega 11, 2 cloned displays; one run per case; cell 30/170 ms; the report is snapshotted at 3000 frames by a one-off debug print,
netrep_debug.diff; PM = PresentMon displayed gap > 1.5 periods or dropped; frame level matches events within ±2 frames). Scripts: revengs671a/(modes.py,cmp.py,diag.py).rollback_room.Next (next run, no decision needed unless @inada-s prefers otherwise)
IDXGISwapChain::GetFrameStatisticsafter Present (refresh count per present: exact repeats, flip model windowed and borderless). GL and VK have no portable equivalent on AMD Windows: there, keep the Present interval and state the limit, or estimate vblank phase from the display period.Decisions taken
over_perioddropped rather than gated.late_frames_1_5, so thatsum(late_present_depth_hist) == late_frames_1_5.Status: continue
inada-s-ai commentedon Oct 24, 2026
Display misses from DX11 frame statistics: check, round 1 (windows-mini)
For #573 (comment). Both PRs stay draft: #577 (
e3ddcaaaa), inada-s/gdxsv#440 (ee4f4c0).Change
display_miss_depth_hist(46). After each DX11 Present,GetLastPresentCount+GetFrameStatisticsgive which Present was shown at which vsync. Between two shown Presents, each vsync past one per Present repeated the image. It is counted by the depth bucket of the late Present.display_stats_presents(45) = Presents with valid statistics;display_composed_presents(47) = DWM-composed Presents, left out.core/gdxsv/gdxsv_net_report_dxgi_win.cpp, behind a flag-guarded hook ingdxsv_video_hooks.h. LBS logs the 3 fields, with a test.Check: cell 30/170, one run per case, probe build = the change + snapshot at 2700 Presents + a trace event per counted miss. PM = PresentMon, repeated vsyncs = round(displayed gap / P) − 1. Window: first input read → snapshot. Event match: report event 0–4 P after the PM miss (the statistics lag 1 Present).
GetFrameStatisticsreturns S_OK with all counts 0 (raw probe,R/s672a/raw.py). These Presents now count as composed and are left out; that case shows in the report asdisplay_composed_presents> 0. Not re-run since that change.IDXGISwapChainMedia::GetFrameStatisticsMedia().CompositionModereads COMPOSED for every Present, Independent Flip included (2698/2699 per peer). It describes the media overlay plane, so it can't detect DWM composition. Dropped.late_present_depth_histstays the only signal. On GL it matched PresentMon's events per depth (p1 3/0/0/2/3/1 = PM). On VK it missed most of them (s671a).FLIP_SEQUENTIAL); one GPU (Vega 11); 2 cloned displays; macOS/Linux/GL/VK/composed → none. Single-display setups not tested.G:/ai/reveng/s672a(cmp2.py,raw.py,probe_build.diff= the round 1 probe).Handover
e3ddcaaaa+ a probe (snapshot at 2700 Presents withdisplay_*fields and admisstrace event, as inprobe_build.diff).m 84AF odes.py <exe> <out> win,bfs,gl,vk,tron,vsoff×2 (~22 min), thencmp2.pyper run. Expect bfs p1 →display_composed_presents≈ all, misses 0.raw.pyon a vsoff run).Status: continue
inada-s-ai commentedon Oct 24, 2026
Check of #578 on windows-mini (not asked for; that PR says "Not run")
Build: PR head
1a779a9d7plus a debug print of the report at 2700 Presents and admisstrace event (G:/ai/reveng/s674a/snapshot_debug.diff). Run 2 adds a raw DXGI stats trace (snapshot_debug2.diff). I did not push to the PR branch.Rig:
modes.py(battle.pycell30_170_tr0_vs1, 2 peers; p1 is on the 60.00 Hz display, p2 on 59.94 Hz), PresentMon, andcmp2.pyfordisplay_late_depth_histagainst PresentMon repeated vsyncs. Run 1: 6 modes. Run 2: bfs, win, vsoff. No crash or desync, and allbattle.pychecks are true in all 9.display_refresh_period_nsdisplay_refresh_period_nstells the two displays apart (60.00 vs 59.94 Hz), in every DX11 case and every run.PresentRefreshCount+4 between shown Presents 415→416 on bfs r2 p2). The report misses it because the period needs 120 vsyncs first (kMinVsyncsForPeriod), so until thenvsyncNs == 0and nothing is counted. Its depth varies (0 or 2). The old count (gdxsv: display misses by rollback depth and rollback slack in P2PMatchingReport; 1.10.2 room fields removed #577) needed no period, so it counted this event: that is why 577's check got "win p2 1/0/4 = PresentMon".PresentCount,SyncRefreshCountandSyncQPCTimeare all 0 on 3006 of 3006 calls). In run 1 the report showeddisplay_stats_presents2698 with period 0, without the raw trace. Not explained (hypothesis: the window changed state during the run).PresentRefreshCountsteps +1 per Present, so this is a limit of DXGI statistics, as already stated in 577.render { }is empty in the debug print:battle.pysetsTEST_GGPO_DELAY, so the delay choice that fillsrender.refresh_ratedoes not run.render.refresh_rateis not checked.rollback_frame_time(TR on without the wait): not checked.present_wait_elasticityis -1 on both TR-on peers, as the PR says.Scratch:
G:/ai/reveng/s674a/(holds.pylines up raw holds, report events and PresentMon;raw2.pysummarizes the raw stats).Handover
Status: waiting