diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-31 19:10:31 -0400 |
|---|---|---|
| committer | kraibse <33869366+kraibse@users.noreply.github.com> | 2026-11-01 17:29:56 +0100 |
| commit | 4d6a13e3d9eaa7bf17381fce0e50d5275ac8957e (patch) | |
| tree | fa79a4ed7c46c2c80c649c8585b7816f4a510395 /src/video_core/vulkan_common/vulkan_wrapper.cpp | |
| parent | 6957331b913bd50dfab106071e8c7ff4fa662599 (diff) | |
nx2: map and unmap sparse texture tiles (nx2:gpu 216)
Switch 2 games commit and release the memory behind sparse textures by
remapping tiles: nvnMemoryPoolMapVirtual goes through NvRm's remap into
nn::gpu::sdk::ExecuteSparseMapRequests, nx2:gpu sub-session command 216,
a batch of 40-byte requests. A map points a tile at the game's own
GPU-accessible memory (the handle sub 101 returned, plus an offset), an
unmap makes it read zero again; the sparse region itself never has memory.
NvRm only remaps when the GPU characteristics report
NVGPU_GPU_FLAGS_SUPPORT_REMAP (bit 35). Without it every remap failed
before reaching the server, so Mario Kart World streamed its terrain into
unmapped sparse memory and each 4 MiB block it touched got memory that
was never freed (2.5 GB after 10 minutes, still growing).
Report the flag (EDEN_NX2_SPARSE_REMAP=0 leaves it out) and serve 216:
- Sparse regions: a tile's device pages show the game's memory, or are
unmapped, in GPU thread order, without invalidating the caches over
them; the region keeps its GPU mapping, so the texture cache keeps its
images. A region the game maps tiles into gets no more blocks (writes
outside its tiles are dropped, as on the console), gives back the
blocks it already had, and marks a block written when the GPU first
writes it, so array layers it only maps tiles into get no memory or
uploads.
- GPU-only regions (214 without the sparse flag): the game also sends
216 for its render targets and, with remap support, for two texture
arrays (5.8 GB and 1.4 GB). Regions whose memory another GPU-only
region maps (render-target groups) keep the memory 214 gave them:
applied, the texture cache flushed and re-uploaded the overlapping
render targets every frame. Regions 214 backs as they are written
keep their blocks too, since the texture cache reads an image's memory
in full when it uploads it, which makes the game's pages resident on
the host (about 1 GB more 150 s in). The rest get the game's memory
the way 211 maps it, so writes through the game's own address reach
the same device pages; an unmap points the range back at the region's
own memory.
Mario Kart World, 10 minutes: no sparse blocks backed (2.5 GB before),
24.6 presents a second instead of 19.3. 216 totals are logged every 30 s.
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_wrapper.cpp')
0 files changed, 0 insertions, 0 deletions
