[Feature request] Unmap buffers on radeonsi on buffer destruction for 32 bit builds
Hi,
Radeonsi never unmap buffers (unlike textures on 32 bit builds). I think it is fine because typically there's going to be very few vertex/index buffers at a given time.
However when releasing the buffers, they get stored in the pb cache. This is an issue for 32bits application which are GPU bound and which discard a lot of vertex/index buffers. In that case many buffers come fill the pb cache.
While the GTT consumption is an issue by itself, and could be argued should be solved in the frontend (though I think solving in pb_cache would be better, as it is better aware of placement of resources, and could decide to release/wait on resources to finish when GTT usage goes too close to the system limit), the issue here is virtual memory addressing space on 32 bits.
Indeed affected games can have 500MB to 1GB of virtual memory addressing space taken by released buffers, depending on the speed of your GPU. Which is a problem considering the 2GB available for wine 32 bits applications.
I have several users affected (crashes with affected applications) with gallium nine. Note that implicit buffer destruction (DISCARD) doesn't have this problem (as a result the affected games don't crash anymore when disabling Nine's internal worker thread).
I think a reasonable behaviour is to unmap buffers on destruction when they are added to the pb cache, on 32 bits. Please add this behaviour to radeonsi (and r600 if affected).