mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 09:09:56 -04:00
Add diagnostics used to find these fixes, all off by default.
NX2NAVI_TRACE=audio logs voices starting, stopping and sharing a wave buffer; NX2NAVI_DUMP_MOVIE dumps movie frames; NX2NAVI_LOG_CS_BINDS says why the stand-in for an untranslated compute program skipped a dispatch; and NX2NAVI_TRACE=perf adds heap and commit census lines on their own thread, with VMA maps when write-combined memory grows by 2 GiB. From a tester's fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -935,6 +935,11 @@ int plat_mem_state(uint64_t addr, uint64_t limit, uint64_t *end) {
|
||||
return v == PS_FREE ? PLAT_MEM_FREE : v == PS_RESERVED ? PLAT_MEM_RESERVED : v - PS_NONE;
|
||||
}
|
||||
|
||||
int plat_mem_census(uint64_t *priv, uint64_t *wc, uint64_t *wc_allocs) {
|
||||
*priv = *wc = *wc_allocs = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t plat_mem_written(uint64_t addr, uint64_t n, uint64_t *pages, uint64_t max, int reset) {
|
||||
if (!max || !n) return 0;
|
||||
if (ww_fd < 0) return UINT64_MAX;
|
||||
|
||||
@@ -215,6 +215,9 @@ int plat_mem_protect(uint64_t addr, uint64_t n, int prot); // committed pages on
|
||||
// The page at addr: PLAT_PROT_* when committed, else PLAT_MEM_RESERVED or PLAT_MEM_FREE (not reserved by us). *end
|
||||
// gets the end of the run of pages in the same state, at most limit.
|
||||
int plat_mem_state(uint64_t addr, uint64_t limit, uint64_t *end);
|
||||
// The process's committed private memory and the part of it mapped write-combined (Windows PAGE_WRITECOMBINE: memory
|
||||
// the GPU driver maps uncached for the CPU), with the number of allocations that part spans. 0 where unsupported.
|
||||
int plat_mem_census(uint64_t *priv, uint64_t *wc, uint64_t *wc_allocs);
|
||||
// The pages of a watched reservation written since the last reset, up to max page addresses into pages, in address
|
||||
// order; reset: those reported start over as unwritten. UINT64_MAX when writes to the range are not tracked.
|
||||
uint64_t plat_mem_written(uint64_t addr, uint64_t n, uint64_t *pages, uint64_t max, int reset);
|
||||
|
||||
@@ -684,6 +684,26 @@ int plat_mem_state(uint64_t addr, uint64_t limit, uint64_t *end) {
|
||||
return p == PAGE_READWRITE ? PLAT_PROT_RW : p == PAGE_READONLY ? PLAT_PROT_READ : PLAT_PROT_NONE;
|
||||
}
|
||||
|
||||
int plat_mem_census(uint64_t *priv, uint64_t *wc, uint64_t *wc_allocs) {
|
||||
*priv = *wc = *wc_allocs = 0;
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
uintptr_t a = 0;
|
||||
void *last = NULL;
|
||||
while (VirtualQuery((void *)a, &mbi, sizeof mbi) == sizeof mbi) {
|
||||
if (mbi.State == MEM_COMMIT && mbi.Type == MEM_PRIVATE) {
|
||||
*priv += mbi.RegionSize;
|
||||
if (mbi.Protect & PAGE_WRITECOMBINE) {
|
||||
*wc += mbi.RegionSize;
|
||||
if (mbi.AllocationBase != last) (*wc_allocs)++, last = mbi.AllocationBase;
|
||||
}
|
||||
}
|
||||
uintptr_t next = (uintptr_t)mbi.BaseAddress + mbi.RegionSize;
|
||||
if (next <= a) break;
|
||||
a = next;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Contains code Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
|
||||
// GetWriteWatch with the reset flag.
|
||||
uint64_t plat_mem_written(uint64_t addr, uint64_t n, uint64_t *pages, uint64_t max, int reset) {
|
||||
|
||||
Reference in New Issue
Block a user