mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 00:29:58 -04:00
Staged mirror uploads: the replay copies guest bytes for the VRAM mirrors while it records, and the first-submission wait ends once the replay has submitted; 8 texture pool sets.
On 0.9.1 this is the release's own mirror capture (NX2NAVI_MIRROR_CAPTURE_KB) turned on: with NX2NAVI_MIRROR_STAGE=1 (the default) the pages the CPU wrote are copied out of guest memory, up to 64 MiB a part, when the part is handed to the queue. A submission whose prologue copied everything that way reads no guest memory late, so the game's wait after a frame's first submission ends once the replay has submitted it (vk_sync_recorded_wait). One with a range left to the GPU-time copy (a pool with a write-back in flight or a twin) or a draw that reads a pool without a mirror is noted (vk_mem_note_live), and its wait is the GPU's. Also 8 texture pool sets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -518,8 +518,22 @@ int mem_lazy_skip(uint64_t a, uint64_t n, uint64_t h0, int64_t delta, uint64_t o
|
||||
return k;
|
||||
}
|
||||
|
||||
// 0 when no page of [a, a + n) can be inaccessible right now (armed by the lazy write-back or probed), so the CPU can
|
||||
// read it without a fault; 1 when one may be.
|
||||
int mem_lazy_touches(uint64_t a, uint64_t n) {
|
||||
if (!n) return 0;
|
||||
if (a >= RT_ADDRESS_LIMIT || a + n > RT_ADDRESS_LIMIT || __atomic_load_n(&prb_on, __ATOMIC_RELAXED)) return 1;
|
||||
if (!__atomic_load_n(&lz_on, __ATOMIC_RELAXED)) return 0;
|
||||
int any = 0;
|
||||
for (uint64_t r = a >> FRZ_SHIFT; r <= (a + n - 1) >> FRZ_SHIFT && !any; r++) any = __atomic_load_n(&lzr[r], __ATOMIC_ACQUIRE);
|
||||
if (!any) return 0;
|
||||
int hit = 0;
|
||||
plat_mutex_lock(&lz_lock);
|
||||
for (int i = 0; i < lz_n && !hit; i++) hit = lzs[i].lo < a + n && lzs[i].hi > a;
|
||||
plat_mutex_unlock(&lz_lock);
|
||||
return hit;
|
||||
}
|
||||
|
||||
// [a, a + n) is armed as a whole still.
|
||||
int mem_lazy_armed(uint64_t a, uint64_t n) {
|
||||
if (!__atomic_load_n(&lz_on, __ATOMIC_RELAXED)) return 0;
|
||||
|
||||
Reference in New Issue
Block a user