Log RivaTuner Statistics Server's hold only while its want is still the current one.

The review found that A-11's fix stores the hold after every decision but also logs it then: when the want changed
while the worker wrote the profile (frame generation switched on during the first write), rtss_limit.c set_active
logged "RivaTuner Statistics Server does the limiting; the game's own limiter stands aside" while the game's limiter
was pacing the new want (rtss_limit_active compares the hold with the want), and the kept-out line followed one poll
later. set_active still stores the hold every time, so that a want going w, w2 and w again never finds an older hold,
but logs a hold only while the want is still the one decided for; a decision that RTSS does not hold the game is
logged as before. The next poll logs what holds the newer want.

tests/rtss_worker_check.c active_logged switches frame generation on inside the first SaveProfile (a hook in the fake
RTSS): no line may say RTSS does the limiting, the next poll logs the kept-out line, and a later limit is held and
logged. It fails on the code before this change. Log only; rtss_limit_check passes 27 of 27, active_race included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 17:52:08 -05:00
parent 4c919882fa
commit 55e03cf792
2 changed files with 33 additions and 2 deletions

View File

@@ -222,11 +222,13 @@ static void put_back_op(void *ctx, const RtssOut *o) { // rtss_poll's RtssOps.
// Whether RTSS holds the game to the want w this poll read, and the log of which limiter is in use: the first decision,
// then each change. The want may have changed since the poll read it: rtss_limit_active compares the two, so a stale
// store never lets the game's limiter stand aside for a newer want.
// store never lets the game's limiter stand aside for a newer want. The store is made either way (a want that went
// w, w2, w again must not find an older hold), but a hold is logged only while its want is still the current one: the
// game's limiter paces a newer want, and the next poll logs what holds it.
static void set_active(int64_t w, int on, const char *why) {
static int logged = -1;
atomic_store(&active_for, on ? w : RTSS_UNSET);
if (logged == on) return;
if (logged == on || (on && atomic_load(&want) != w)) return;
logged = on;
if (on) rt_log("frame rate: RivaTuner Statistics Server does the limiting; the game's own limiter stands aside");
else rt_log("frame rate: the game's own limiter (%s)", why);