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

+3 -1
View File
@@ -109,7 +109,9 @@ typedef struct {
uint64_t (*submit)(const uint64_t *handles, int n); // replays; returns this submission's fence value
int (*fence_wait)(uint64_t value, uint64_t timeout_ns); // 1 reached; caller has given its core up
uint64_t (*fence_done)(void); // highest value whose side effects are written
void (*present)(const tex_t *t, const int crop[4]); // queues the present; returns at once
// Queues the present and returns at once; the host present goes out at at_ns (kern_now_ns clock), at once when that
// has passed or at_ns is 0.
void (*present)(const tex_t *t, const int crop[4], uint64_t at_ns);
void (*finish)(void);
void (*read_texels)(const tex_t *t, const view_t *v, const NVNcopyRegion *r, uint8_t *dst, uint64_t row, uint64_t img);
void (*write_texels)(const tex_t *t, const view_t *v, const NVNcopyRegion *r, const uint8_t *src, uint64_t row, uint64_t img);