Let Reflex hold the frame limit with DLSS Frame Generation, and the game's pacer keep only its ceiling while it does.

With DLSS-G, Reflex's sleep held each frame's start with no limit while the game's pacer still held the limit on the
present thread and at the window image's acquire (A-16, P-16): the pacer's wait came after the picture was drawn, so
the pad was read up to a period before the picture left, on top of Reflex's own wait for the GPU.
vk_dlssg.c vk_dlssg_pace, on the presenting guest thread in nvnQueuePresentTexture, asks dlssg_pace.h which limit Reflex
should hold and stores it; vk_dlssg_frame on the present thread hands a changed limit to Streamline before its present
(reflex_apply, under the present lock, which keeps Streamline's options calls on one thread at a time), as does each
new swapchain, which has neither mode nor limit. GfxBackend.frame_paced now returns the period the pacer still holds:
vk_backend.c vk_be_frame_paced gives the game's ceiling (frame_step_ceiling_ns, 240) while Reflex holds the limit,
0 where a driver's low latency holds it (vk_lowlat_pace, unchanged), else the period; during a movie the back ends get
0 and the pacer keeps the movie's period and catch-up slots as before. The pacer takes the limit back before the first
host present, after 200 ms without one, with a DLL older than nx2sl_reflex2 (one log line at start), for a limit
Streamline refused, and for the run when the frames show Reflex does not hold it; the "frame rate:" lines name who
holds it, the "dlssg: present N" line counts the frame starts Reflex held, and Reflex's sleep now counts as pacing
(perf_end_any, on whichever thread acquires). No wait is added on a drawing thread: the limiter's wait moves from the
acquire's sleep_until and the present thread's slot to Reflex's sleep a few lines later in the same acquire, and the
present thread's options call returns at once. docs/architecture.md names Reflex as a limiter. Not reproduced before
the change (no RTX 40 or 50 here); vk_dlssg.c, vk_backend.c and nvn_api_obj.c compile clean with the dev build's
flags, and dlssg_pace_check, fg_reset_check and frame_step_check pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 18:57:18 -05:00
parent 2bf32649af
commit dc3f424fde
6 changed files with 188 additions and 38 deletions

View File

@@ -896,11 +896,17 @@ NVN_API(nvnQueuePresentTexture) {
}
if (hitch_every && o->presents % (uint64_t)hitch_every == 0) plat_wait_ns((uint64_t)hitch_ms * 1000000);
uint64_t period = present_period(o), now = kern_now_ns();
// A driver's low-latency sleep (vk_lowlat.c) holds the next frame to the period where the frame starts, before
// its pad read, so this pacer holds nothing: the present goes out as soon as it is drawn and the image is free at
// once. A wait here as well would be a second one, after the picture is drawn. Not while a movie plays: its slots
// are kept through a late frame (pace), which only this pacer does, so the back end is told there is no period.
if (gfx_backend()->frame_paced && gfx_backend()->frame_paced(frame_step_movie_hz() > 0 ? 0 : period)) period = 0;
// A driver's low-latency sleep (vk_lowlat.c) or Reflex with DLSS Frame Generation (vk_dlssg.c) holds the next frame
// to the period where the frame starts, before its pad read, so this pacer holds at most the game's ceiling: the
// present goes out as soon as it is drawn and the image is free again at once, or a ceiling's period after its
// slot. A wait here as well would be a second one, after the picture is drawn. Not while a movie plays: its slots
// are kept through a late frame (pace), which only this pacer does, so the back end is told there is no period and
// the pacer keeps the movie's.
if (gfx_backend()->frame_paced) {
int movie = frame_step_movie_hz() > 0;
uint64_t held = gfx_backend()->frame_paced(movie ? 0 : period);
if (!movie) period = held;
}
uint64_t slot = now + pace(&o->pace, now, period);
gfx_backend()->present(t, o->crop, slot);
o->ticket[idx] = o->presents;