From 0a92f9b1860f027f35c5196c8654f37822b8f23c Mon Sep 17 00:00:00 2001 From: itaskaev2 <165683571+itaskaev2@users.noreply.github.com> Date: Mon, 16 Nov 2026 08:12:34 +0100 Subject: [PATCH] Hold Reflex to the pacer's frame limit, so fps_limit = display no longer caps it at 60 reflex_apply_locked read TOTK_FPS_LIMIT with cfg_int, which turns "display" into the setting's default, 60: with Reflex on, a 144 Hz monitor stayed at 60 fps. It now takes frame_step_limit_hz, the rate the pacer holds (the setting, the monitor's rate for display, 60 without the real-time step), and checks it on every present, as the window measures the monitor's rate after the swapchain is made. Co-Authored-By: Claude Opus 5.5 --- docs/settings.md | 2 +- runtime/gfx_present.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/settings.md b/docs/settings.md index 1b0193fe..af489a70 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -180,7 +180,7 @@ Many rows below are developer tools that only act together with another setting | `mvprev_grow` (default `1`) | `0` keeps only three banks in the previous-frame tables. | Object motion that depends on the other banks is no longer tracked. | Caution | | `mvprev_skip` | Hex bank mask of banks left out of the previous-frame copy, replacing the default. | Different banks are tracked, which changes object motion. | Caution | | `mvprev_trust` | Hex bank mask of banks whose found previous-frame copy is taken without the check. | A copy that does not match is used anyway, which can give wrong motion. | Caution | -| `reflex` (default `off`) | `off`, `on`, or `boost`; enables NVIDIA Reflex Low Latency (`VK_NV_low_latency2`) to reduce system input latency. Read at start. | On NVIDIA GPUs supporting the extension, coordinates simulation and presentation cadence to lower latency; `boost` keeps GPU clocks high in CPU-bound scenes. Has no effect on non-NVIDIA GPUs. | Safe | +| `reflex` (default `off`) | `off`, `on`, or `boost`; enables NVIDIA Reflex Low Latency (`VK_NV_low_latency2`) to reduce system input latency. Read at start. | On NVIDIA GPUs supporting the extension, coordinates simulation and presentation cadence to lower latency, holding frames to the frame limit the pacer uses (`fps_limit`, the monitor's rate for `display`); `boost` keeps GPU clocks high in CPU-bound scenes. Has no effect on non-NVIDIA GPUs. | Safe | ## Scheduling and host diff --git a/runtime/gfx_present.c b/runtime/gfx_present.c index f63092e5..d375f572 100644 --- a/runtime/gfx_present.c +++ b/runtime/gfx_present.c @@ -22,6 +22,7 @@ #include "fs.h" #include "gfx.h" #include "gfx_wsys.h" +#include "host.h" #include "nvn_api.h" #include "platform/platform.h" #include "ui/menu.h" @@ -246,6 +247,9 @@ static void window_settings_live(void) { static int started; static char present[16]; // the TOTK_VK_PRESENT the swapchain was made with unsigned v = cfg_version(); + // Every present: Reflex follows the frame limit, and with fps_limit = display the window measures the monitor's + // rate after the swapchain is made, with no settings change to announce it. Unchanged, it returns at once. + if (started) reflex_apply_locked(); if (started && v == seen) return; seen = v; res_fov_live(); @@ -306,8 +310,11 @@ static void reflex_apply_locked(void) { } int mode = reflex_mode_from_cfg(); uint32_t min_us = 0; - int limit = cfg_int("TOTK_FPS_LIMIT"); - if (limit > 0) min_us = (uint32_t)(1000000 / limit); + // The driver's sleep holds frames to the same rate as the pacer (frame_rate.c frame_step_limit_hz): the setting, + // the monitor's rate for fps_limit = display, 60 without the real-time step. cfg_int would read "display" as the + // setting's default, 60, and Reflex would hold a 144 Hz monitor to 60 fps. + double hz = frame_step_limit_hz(); + if (hz > 0) min_us = (uint32_t)(1e6 / hz); if (mode == g_reflex_mode && min_us == g_reflex_min_us) return; g_reflex_mode = mode; g_reflex_min_us = min_us;