8000 Zdxsv: time the rerun VU1 and SPU2 split only with ZDXSV_RERUN_SPLIT by inada-s-ai[bot] · Pull Request #616 · inada-s/pcsx2 · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/zdxsv/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ turns GGPO off and leaves the other extensions on. Any other value turns it on.
| `ZDXSV_RERUN_REVERB=1` | off | control | SPU2 reverb runs in rerun frames. Default: skipped (their sound is dropped) unless an SPU2 IRQ address lies in the reverb work area. |
| `ZDXSV_RERUN_VU1=1` | off | control | VU1 microprograms run in every rerun frame. Default: only in the last rerun frame of a rollback, whose drawing the first present after the rollback shows; none with the single draw list. |
| `ZDXSV_RERUN_TAIL=n` | 2 (0 with the single draw list) | control | The last n rerun frames of a rollback run the game's render callbacks, the last n - 1 VU1 microprograms (n with the single draw list). Without the single draw list, below the default the picture after a rollback breaks (`tests/zdxsv/rerunpic.py` FAIL control). |
| `ZDXSV_RERUN_SPLIT=1` | off | diagnostic | The battle report's `rerun frame split` line measures the VU1 and SPU2 time per rerun frame. Off: both read 0 (the timers cost time in rerun frames). `benchab.py` sets it. |
| `ZDXSV_SINGLE_DRAW_LIST=0` | on | control | Z game: no single draw list (the game draws a frame's draw list in the next frame, as stock). See rollback.md. |
| `ZDXSV_LOW_LATENCY_PRESENT=0` | on | control | Z game: no low-latency present. On: present the finished frame before the frame limiter sleeps, and poll input right before the next frame runs (in a net battle: before the sleep, see [rollback.md](rollback.md)). |
| `ZDXSV_AUTH_SIGNIN_TEST=1\|signout` | unset | test | At app start, `1` signs in once through `ZdxsvAuthUrl` and logs `Zdxsv: auth: open <url>` instead of opening a browser; `signout` signs out. |
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/SPU2/spu2sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ __forceinline void TimeUpdate(u64 cClocks)
lClocks = cClocks - dClocks;
}

const u64 zdxsv_t0 = (Zdxsv::g_ggpo_in_rollback && dClocks >= TickInterval) ? Common::Timer::GetCurrentValue() : 0;
const u64 zdxsv_t0 = (Zdxsv::g_rerun_split_time && Zdxsv::g_ggpo_in_rollback && dClocks >= TickInterval) ? Common::Timer::GetCurrentValue() : 0;
ScopedGuard zdxsv_time([zdxsv_t0]() {
if (zdxsv_t0)
Zdxsv::g_rerun_spu2_ticks += Common::Timer::GetCurrentValue() - zdxsv_t0;
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Zdxsv/CpuHooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Zdxsv
extern bool g_ggpo_active; // a session runs
extern bool g_ggpo_in_rollback; // rerunning frames: no throttle
extern u64 g_rerun_vu1_ticks; // Common::Timer ticks in VU1 microcode during rerun frames (microVU.cpp)
extern const bool g_rerun_split_time; // ZDXSV_RERUN_SPLIT: the rerun ticks above are measured
// this rerun frame starts no VU1 microprogram (vu1ExecMicro; Ggpo.cpp AdvanceFrame, ZDXSV_RERUN_VU1)
extern bool g_rerun_vu1_skip;
extern bool g_replay_fast_frame; // not throttled
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Zdxsv/Ggpo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ namespace Zdxsv
bool g_rerun_vu1_skip = false;
bool g_rerun_draw_skip = false;
u64 g_rerun_spu2_ticks = 0;
const bool g_rerun_split_time = Zdxsv::TestEnv("ZDXSV_RERUN_SPLIT") != nullptr;
bool g_gs_rerun_frame = false;
bool s_net_env = false; // net=1 in s_options, or a replay plays (GgpoOnVmInitialize)
// ZDXSV_RBK=i/N: until GGPO arms, every lobby / battle connect RPC is answered here (RbkCall).
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Zdxsv/MediaHooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Zdxsv
extern bool g_ggpo_active; // a session runs
extern bool g_ggpo_in_rollback; // rerunning frames
extern u64 g_rerun_spu2_ticks; // Common::Timer ticks in the SPU2 mixer during rerun frames (spu2sys.cpp TimeUpdate)
extern const bool g_rerun_split_time; // ZDXSV_RERUN_SPLIT: the rerun ticks above are measured

// GS thread: the vsync packet being handled ends a rollback rerun frame (MTGS::PostVsyncStart copies
// g_ggpo_in_rollback into the packet). GSRenderer::VSync skips its present, as for a duplicate frame:
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/x86/microVU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ void recMicroVU1::Execute(u32 cycles)
return;
}
VU1.VI[REG_TPC].UL <<= 3;
const u64 t0 = Zdxsv::g_ggpo_in_rollback ? Common::Timer::GetCurrentValue() : 0;
const u64 t0 = (Zdxsv::g_rerun_split_time && Zdxsv::g_ggpo_in_rollback) ? Common::Timer::GetCurrentValue() : 0;
((mVUrecCall)microVU1.startFunct)(VU1.VI[REG_TPC].UL, cycles);
if (t0)
Zdxsv::g_rerun_vu1_ticks += Common::Timer::GetCurrentValue() - t0;
Expand Down
4 changes: 2 additions & 2 deletions tests/zdxsv/benchab.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
`differs` only when the two ranges do not overlap. Parts: rerun frame mean (wall), spu2 / vu1 ms per
rerun frame, save / load ms mean, emulate mean.
OUT=<dir> python tests/zdxsv/benchab.py "<A env>" "<B env>" [R=2] (e.g. "" "ZDXSV_RERUN_REVERB=1")
Env: as rbk.py; defaults TRACE=0 LAT=40 JITTER=8. PCSX2_ENV is kept, the side's env is appended.
Env: as rbk.py; defaults TRACE=0 LAT=40 JITTER=8. PCSX2_ENV is kept, ZDXSV_RERUN_SPLIT=1 and the side's env are appended.
Logs: $OUT/a1, b1, a2, .. (rbk.py OUT), summary $OUT/benchab.txt. A failed rbk.py run stops it (exit 1).
"""
import glob
Expand Down Expand Up @@ -41,7 +41,7 @@ def main(argv):
os.makedirs(out, exist_ok=True)
for k, v in (("TRACE", "0"), ("LAT", "40"), ("JITTER", "8")):
os.environ.setdefault(k, v)
base = zrig.env("PCSX2_ENV")
base = zrig.env("PCSX2_ENV") + " ZDXSV_RERUN_SPLIT=1"
for r in range(1, int(reps) + 1):
for s, e in (("a", a), ("b", b)):
print(f"== {s}{r}: {e or '(no env)'}", flush=True)
Expand Down
0