Pace presents at the back edge, just before the host present

The pacer gave each frame its display time but the present thread queued vkQueuePresentKHR as soon as the game
handed the frame over, so every present shifted with the frame's replay time: at 60.0 fps mean, 17-18 ms intervals
alternated with 15-16 ms ones. The present thread now submits the blit at once (vk_present_blit, so
vk_present_drain and queue order are unchanged) and holds the host present until the pacer's slot
(vk_present_flip). Acquire keeps waiting until the image's slot plus one period, which is now the time the next
frame really goes out.

TOTK_TRACE=present logs one line per present: host interval, the game's present-call interval, wait and lateness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-23 23:26:43 +03:00
1 parent 2d714537e7
commit ebdba400df
9 files changed
+97 -26

No files matched your search

+2 -2
View File
@@ -18,8 +18,8 @@
// ---- logging and results
void rt_log(const char *fmt, ...) __attribute__((format(printf, 1, 2))); // "[host] <msg>\n" to stderr, one write
enum { RT_TRACE_SVC = 1, RT_TRACE_HOSTCALL = 2, RT_TRACE_IPC = 4, RT_TRACE_FS = 8, RT_TRACE_GFX = 16, RT_TRACE_PERF = 32,
RT_TRACE_SCHED = 64, RT_TRACE_AUDIO = 128 };
extern unsigned rt_trace; // from TOTK_TRACE=svc,host,ipc,fs,gfx,perf,sched (or all)
RT_TRACE_SCHED = 64, RT_TRACE_AUDIO = 128, RT_TRACE_PRESENT = 256 };
extern unsigned rt_trace; // from TOTK_TRACE=svc,host,ipc,fs,gfx,perf,sched,audio,present (or all)
// prof_win.c: TOTK_PROFILE=<path> sampling profiler; TOTK_TRACE=perf frame timing (waits of the render thread)
// PERF_TEX: texture uploads on the render thread (deswizzle, decode, staging), PERF_ASTC included
enum { PERF_PACE, PERF_FENCE, PERF_DRAIN, PERF_PIPE, PERF_XLATE, PERF_TEX, PERF_ASTC, PERF_N };