From 4467f73ead412a746c6e9c5d9517267f92f8a729 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Tue, 10 Nov 2026 10:00:18 -0500 Subject: [PATCH] The flight recorder can dump every n-th frame (NX2NAVI_FLIGHT_EVERY), so the dumps of a scripted run hold all of its frames. With n under the ring's length each dump overlaps the one before, and a run's frame records can be read back whole except for its last n frames. NX2NAVI_FLIGHT_AT takes sixteen frame numbers at most, which covered a walk at 60 fps and lost most of one at 240. Co-Authored-By: Claude Fable 5.2 --- runtime/cfg.c | 2 +- runtime/flight.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/cfg.c b/runtime/cfg.c index b7edc4e9..42c78572 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -42,7 +42,7 @@ static const char *const known[] = { "COLOR_PRESET", "COLOR_SATURATION", "CONTACT_DEBUG", "CONTACT_SHADOWS", "CORE_DIAG", "CRIT", "CRIT_OUT", "DESC_TEMPLATE", "DEVICE_PROFILE", "DISCORD_APP_ID", "DISCORD_IMAGE", "DISCORD_RPC", "DLAA", "DLAA_CAM_KEEP", "DLSS_IDLE_FREE", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR", "DUMP_LOG", "DUMP_RAW", "DUMP_SHADERS", "DUMP_FILE", "DS3", "LOG_CS_BINDS", "LOG_TEX_FLAGS", "LOG_MESH", "MESH", "POOL", "NATIVE_TENSOR", "LOG_RCOND", "LOG_RT_SIZES", "DUMP_WHITE", "DUMP_AFTER", "DUMP_MOVIE", "SUBMIT_FINISH", "ACQUIRE_WAIT", "CRASH_FILTER_GUARD", "CS_FALLBACK", "EXEFS", "FEEDBACK", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES", - "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FLUSH_UPLOAD", "FOG_CULL", "FOLIAGE_SHADOW_CULL", "FOLIAGE_SHADOW_VRS", "FOV", "FOV_PATCH", "FG_HUDLESS_SHOW", "FG_MULT", "FPS60", "FPS_LIMIT", "FRAMEGEN", "FRAMEGEN_MULTIPLIER", "FREEZE_IDLE", "FREE_CORES", + "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLIGHT_EVERY", "FLUSH_SPAN", "FLUSH_UPLOAD", "FOG_CULL", "FOLIAGE_SHADOW_CULL", "FOLIAGE_SHADOW_VRS", "FOV", "FOV_PATCH", "FG_HUDLESS_SHOW", "FG_MULT", "FPS60", "FPS_LIMIT", "FRAMEGEN", "FRAMEGEN_MULTIPLIER", "FREEZE_IDLE", "FREE_CORES", "FULLSCREEN", "FXAA", "GAME_ASPECT", "GAME_RES", "GPA", "GPA_EMPTY", "GPA_TWIN", "GPA_TWIN_MAX_KB", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_PASSES", "GPU_NAME", "HDR", "HDR_BLOWOUT", "HDR_CONTRAST", "HDR_EXPOSURE", "HDR_FLARE", "HDR_GAMMA", "HDR_GAME_NITS", "HDR_GRADE", "HDR_HIGHLIGHT_SAT", "HDR_HIGHLIGHTS", "HDR_HUE", "HDR_LIVE", diff --git a/runtime/flight.c b/runtime/flight.c index 0e363ed7..85f33204 100644 --- a/runtime/flight.c +++ b/runtime/flight.c @@ -2,8 +2,10 @@ // render-thread blocked time per perf kind, event counts) and a 320x180 thumbnail each (gfx_present.c, blitted on the // GPU by the present thread). A dump goes to /-f/: frames.tsv and f.png per // thumbnail, written by a background thread. Triggers: F8 while the game window has focus, a frame interval over -// NX2NAVI_FLIGHT_SPIKE_MS (100; 0 off; at most one dump per 10 s), and NX2NAVI_FLIGHT_AT=[,...]. A dump holds -// the frames up to FLIGHT_POST presents after the trigger, so the aftermath is in it too. tools/flight_view.py reads it. +// NX2NAVI_FLIGHT_SPIKE_MS (100; 0 off; at most one dump per 10 s), NX2NAVI_FLIGHT_AT=[,...] and +// NX2NAVI_FLIGHT_EVERY= (every n-th frame: with n under the ring's length the dumps of a run hold every frame of it +// but the last n). A dump holds the frames up to FLIGHT_POST presents after the trigger, so the aftermath is in it +// too. tools/flight_view.py reads it. // // Records come from perf_present (prof_win.c) on the render thread; the counts are differences of the NX2NAVI_TRACE=perf // running totals and of vk_exec_frame. Off, the only cost is the flight_on branch in perf_present and vk_backend.c. @@ -53,7 +55,7 @@ static uint64_t recorded; // records written so far static uint64_t spike_ns, t0_ns; static uint64_t dump_at, trig_frame, trig_interval_us, last_spike_ns; static const char *trig_why; -static uint64_t at_frames[16]; +static uint64_t at_frames[16], every; static int n_at; static char base_dir[PLAT_PATH_MAX]; static uint64_t prev_cnt[PERF_CNT_N], prev_xlated; @@ -79,6 +81,7 @@ void flight_init(void) { at_frames[n_at++] = f; p = *end == ',' ? end + 1 : end; } + every = env_u("NX2NAVI_FLIGHT_EVERY", 0); const char *d = cfg_get("NX2NAVI_FLIGHT_DIR"); char tmp[PLAT_PATH_MAX]; if (d && *d) snprintf(tmp, sizeof tmp, "%s", d); @@ -354,6 +357,7 @@ void flight_frame(uint64_t frame, uint64_t now_ns, uint64_t interval_ns, const u key_was = key; for (int i = 0; i < n_at; i++) if (at_frames[i] == frame) trigger(frame, interval_ns, "NX2NAVI_FLIGHT_AT"); + if (every && frame && frame % every == 0) trigger(frame, interval_ns, "NX2NAVI_FLIGHT_EVERY"); if (spike_ns && interval_ns > spike_ns && recorded > 30 && (!last_spike_ns || now_ns - last_spike_ns >= FLIGHT_SPIKE_GAP_NS)) { if (!dump_at) last_spike_ns = now_ns; trigger(frame, interval_ns, "spike");