Count a frame's bookkeeping that a submission runs for an earlier present as that thread's replay time.

The review of cd2fd454 found that vk_sync.c submit calls vk_present_frames_owed before its replay timing starts
(t0 = perf_begin), so the owed bookkeeping a submitting thread runs was timed nowhere: a DLSS release in
vk_dlaa_frame (16 to 45 ms, F-4-02) would have shown as unattributed time in the frame-time and slow-frame lines, where
the design counts it as that thread's replay time. vk_present_frames_owed now times the frames it runs and adds them
with perf_replay. The present thread's catch-up before a blit (present_frame_closed) is not replay: it shows in the
present thread's own blit time and in the frame bookkeeping line.

Checks that passed: pass_cc_check of vk_backend.c with no new -Wall -Wextra warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:44:35 -05:00
parent b0baa981ff
commit b18fff6439

View File

@@ -331,9 +331,14 @@ static int fo_try(void *arg) {
return vk_sync_try_locked(fo_here);
}
// vk_sync.c submit, sub_lock held, before its replay: the frames presented while another thread held the lock.
// vk_sync.c submit, sub_lock held, before its replay: the frames presented while another thread held the lock. Their
// time counts as this thread's replay time (perf_replay), as submit's own timing starts after this call: a DLSS release
// in vk_dlaa_frame (tens of milliseconds) then shows as replay in the frame-time and slow-frame lines, not unattributed.
void vk_present_frames_owed(void) {
if (fo_waiting(&FO)) __atomic_add_fetch(&fo_late_n, fo_run(&FO, fo_end, NULL), __ATOMIC_RELAXED);
if (!fo_waiting(&FO)) return;
uint64_t t0 = perf_begin();
__atomic_add_fetch(&fo_late_n, fo_run(&FO, fo_end, NULL), __ATOMIC_RELAXED);
perf_replay(t0);
}
// The present thread, before it uses frame (present_main): frame_end of a frame the presenting thread left owed has run