Keep the freezes of idle regions back after slow ones and around area loads.

After a slow freeze the passes wait 250 ms, doubled for each further slow one, but the first fast freeze after a hold started the doubling over, so in the seconds after a load a 4-5 ms freeze came every 250 ms (Kakariko, 2026-11-13: five in a row, 16 frames apart), and freezes of 4-10 ms pushed frames of 25-52 ms over the stutter line. The doubling now starts over only after freeze_quiet_ms (default 5000; 0: the old rule) without a slow freeze. No pass runs while the texture pool makes an area's textures, when the frames are held anyway and one freeze took 32.4 ms, nor for freeze_load_hold_ms (default 3000; 0: off) after that or after an area's load. The regions that go idle meanwhile stay queued and are frozen later; their write-watch queries go on until then. A region is now queued once instead of again every freeze_idle submissions while the passes are held.

The rules are in runtime/freeze_hold.h, checked by tests/freeze_hold_check.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 12:29:51 -05:00
parent f7487ceee5
commit 0e0cfe0827
8 changed files with 220 additions and 19 deletions

View File

@@ -261,7 +261,12 @@ void perf_segment(const char *name) {
plat_mutex_unlock(&seg_lock);
}
static volatile uint64_t area_load_ns; // plat_now_ns of the last area load (perf_scene), 0 none
uint64_t perf_area_load_ns(void) { return __atomic_load_n(&area_load_ns, __ATOMIC_RELAXED); }
void perf_scene(const char *name) {
__atomic_store_n(&area_load_ns, plat_now_ns(), __ATOMIC_RELAXED);
stutter_area(name);
if (!(rt_trace & RT_TRACE_PERF)) return;
char wb[24];