fix(vk): texture noise when system RAM runs low: a staging arena of the size needed when 64 MB can't be pinned #1514
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1514
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/texture-noise-low-ram-staging-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Without resizable BAR, a texture staging arena is 64 MB of system memory the driver must pin. On a 16 GB laptop with RAM nearly gone, no 64 MB arena could be made, even for a 36 KB upload, so texture uploads failed and drew as noise. This falls back to an arena of the size the upload needs.
Related: #993. Part of splitting up #1023.
Problem
On an RX 5500M laptop (4 GB VRAM, 16 GB RAM), the game's pools were imported (about 2 GB pinned), only 2.9 GB of RAM was available, and Windows was paging.
texture_framehad given the idle arenas back, as it does after 30 s on a card of 6 GB or less, and making a new 64 MB one failed:The system heap's budget had room, but pinning a new 64 MB block failed under RAM pressure. Every upload failed until an arena came free.
Change
staging()tries one of the size the upload needs, rounded up to 1 MB. Both outcomes are logged once in a while:vk: staging: no 64 MB arena could be made (N kept); one of the size asked for instead, or...; the upload waits.texture_framegives the small arenas back as it does the others. Upstream's arena timing log is kept.Who it affects
Only a machine where a 64 MB staging arena can't be pinned: low free RAM, no resizable BAR. Everywhere else
staging()makes the same 64 MB arenas as before, and the new path never runs.Tests
tests/test_staging_arena_fallback.py(new) checks the order of the attempts, the cleanup and the log line. It fails on main without this change.Tested on
no 64 MB arena could be made ...; one of the size asked for instead8 times, 0 failed texture uploads, no noise