nv2a-trace
nv2a-trace copied to clipboard
Add memory page cache
A major bottleneck for nv2a-trace is the amount of traffic between the Xbox and the development PC. A single frame can easily take 600MB of RAM if textures and surfaces are dumped for each draw call.
In practice, most of this data will obviously be constant. So if nv2a-trace knew that a page wasn't modified, we could skip the transfer.
One way to implement this, is to filter memory reads: Before each read, nv2a-trace would ask the Xbox to generate a hash for the RAM pages (page size does not have to be 0x1000 bytes). If nv2a-trace already has a page with the returned hash in it's local cache, then the transfer could be skipped. If the returned hash is not in the cache, nv2a-trace would have to load that page into its cache.
I have already written some scripts for prototyping which can be found on my personal repository: https://github.com/JayFoxRox/nv2a-trace/pull/6
A more abstract solution could possibly be promoted to xboxpy and nxdk-rdt. However, nv2a-trace is the biggest stakeholder at the moment.
Dirty bit tracking is probably not a suitable alternative because it would be unaware of changes done by the DSP, IO DMA or the GPU itself.