Skip to content

dma: preserve live linked-list reads with word-cost timing - #304

Merged
mstan merged 4 commits into
RetroPortingToolKit:masterfrom
Alexbeav:pr/gpu-dma2-correctness-ff7
Sep 3, 2026
Merged

dma: preserve live linked-list reads with word-cost timing#304
mstan merged 4 commits into
RetroPortingToolKit:masterfrom
Alexbeav:pr/gpu-dma2-correctness-ff7

Conversation

@Alexbeav

@Alexbeav Alexbeav commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve guest-visible GPU DMA2 linked-list slicing while restoring the one-clock cost per transferred 32-bit word.

Each payload word is read from live RAM at its own guest-cycle event. Late service consumes every elapsed boundary. Widescreen prepass metadata is discarded when a live packet or link changes. The obsolete polygon-drop filter is removed.

This combines the reviewed correctness work from Alexbeav#13 with the FF7-compatible transfer cost demonstrated by #299 and #302.

Regression

#277 fixed Vampire Hunter D and Spot Goes to Hollywood by allowing a guest to change later ordering-table data while DMA remained active. Its separate 8-clock header and 5-clock setup charges also kept large Final Fantasy VII ordering tables busy long enough to reach the game's timeout path.

This change keeps the sliced reads but charges one clock for each header or payload word. It does not claim to implement complete physical-bus arbitration.

The DMA snapshot now stores the in-flight payload index. Boot-state version 6 rejects version-5 files at the header before any state section changes the live machine.

Tests

  • Runtime and oracle targets build with Clang 22.1.8.
  • dma_gpu_linked_list_timing_test passes 20 consecutive runs.
  • ws_prepass_guard_test passes 20 consecutive runs.
  • savestate_status_protocol_test passes 20 consecutive runs.
  • The runtime suite passes 61 of 62 enabled tests.
  • The remaining mod_runtime_test crash reproduces on unchanged base 22fbbfca.
  • Two pre-existing tests remain disabled.
  • git diff --check passes.

The earlier correctness head reached frame 616 in fresh Vampire Hunter D and Spot builds. User testing reported correct FF7 geometry after the lower-cost correction. New visible VHD and Spot runs on this exact combined head remain open.

Review

Fork review: Alexbeav#20

Cubic reviewed exact head 9dfb4174adea419c259b132eda512525cf9b8dea and reported no issues across 13 files. Both earlier review threads are resolved.

Developed with AI assistance; validated as described (test evidence in PR body). AI writes the code and the PR, but I always test before I send something up. Happy to iterate on this process with your feedback.

@mstan
mstan merged commit 71f3c8c into RetroPortingToolKit:master Sep 3, 2026
Ed1z19 pushed a commit to Ed1z19/psxrecomp that referenced this pull request Sep 4, 2026
Add passive DMA2 ordering-table counters to dma_state so long or aborted linked-list walks are visible without relying on screenshots. The counters track starts, duplicate starts dropped while a walk is active, completions, cancels, last/max walk size and cycle cost, CHCR poll counts, the initiator PC, and the last eight cancel records.

This intentionally does not port PR RetroPortingToolKit#302's superseded walker changes or the PSX_GPU_LL_SYNC diagnostic lever; PR RetroPortingToolKit#304 remains the timing implementation.

Co-authored-by: Kevin Kline <9866117+kerokline@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants