From 834b36a6d95ea9b2dfd28994069a6a46e2c7a94b Mon Sep 17 00:00:00 2001 From: chrg6 Date: Tue, 10 Nov 2026 14:22:52 -0500 Subject: [PATCH] Stamp a retired texture as used when it is taken back. While retired it got no use stamp, so it counted as idle the moment it came back, and a sweep over the video memory budget could evict it as idle in the same call that took it back: on the cards that are over budget, which are the ones the take-back is for. Co-Authored-By: Claude Fable 5.2 --- runtime/vk_texture.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/vk_texture.c b/runtime/vk_texture.c index 473147ed..2a70311f 100644 --- a/runtime/vk_texture.c +++ b/runtime/vk_texture.c @@ -1474,6 +1474,11 @@ static void retire_cancel(Tex *e) { retiring_bytes -= e->bytes; if (holds.n) nvn_hm_del(&holds, &e->key); n_retire_cancel++, n_disuse_back++; + // In use as of now: while retired the pool refresh left it out, so it carries no use stamp of that time and + // counted as idle the moment it came back. A sweep over the budget (sweep_pressure calls retire_sweep and then + // evict_idle) could evict it in the same call that took it back. + e->use_round = look_round; + e->use_frame = __atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED); tex_gen_bump(e->key.addr); }