Mesa 21.1 Addresses Issue Of Gallium Nine Often Hitting Memory Issues With 32-bit Games
For those using Gallium3D Nine as a Direct3D 9 state tracker when running Windows games on Linux rather than the likes of DXVK for going through Vulkan, next quarter's Mesa 21.1 will better handle 32-bit games with the Nine state tracker.
As written about a few days ago, Gallium Nine has been seeing a fresh round of improvements for this D3D9 state tracker that has long been part of Gallium3D. Gallium Nine is still used particularly by those with older hardware lacking Vulkan support where DXVK is then unsupported. Gallium Nine also generally performs better than using Wine's Direct3D 9 to OpenGL code path albeit making use of "Nine" requires a patched version of Wine.
One of the lingering issues with Gallium Nine has been with hitting memory issues when running 32-bit games: out of memory errors, other memory errors, or increased memory consumption to running without Nine have been common for a wide variety of popular D3D9 games when running the 32-bit builds through Nine. But with the newest Mesa 21.1-devel code merged today, that should be an issue of the past.
Gallium Nine lead developer Axel Davy explained in the MR that was honored this morning, "storing in memfd and release the virtual memory attached to the allocation until needed. Memfd files is a feature of the linux kernel. It enables to allocate a file stored in RAM and visible only to the app. We can map/unmap portions of the file as we need. When a portion is mapped, it takes virtual memory space. When it is not, it doesn't. The file is stored in RAM, and thus the access speed is the same as normal RAM. Basically instead of using malloc(), we create a memfd file and map it. When the data doesn't seem to be accessed anymore, we can unmap the memfd file. If the data is needed, the memfd file is mapped again. This trick enables to allocate more than 4GB on 32 bits apps, while reducing virtual memory usage."
This MEMFD trick should reduce virtual memory usage of textures and ultimately allow more of these 32-bit Direct3D 9 games to now happily run with Mesa's Nine. This addition does add some overhead but ultimately should be small and due to the way it's implemented possibly a performance boost for multi-threaded software. This new memory handling in the Nine code does not impact the 64-bit software behavior.
As written about a few days ago, Gallium Nine has been seeing a fresh round of improvements for this D3D9 state tracker that has long been part of Gallium3D. Gallium Nine is still used particularly by those with older hardware lacking Vulkan support where DXVK is then unsupported. Gallium Nine also generally performs better than using Wine's Direct3D 9 to OpenGL code path albeit making use of "Nine" requires a patched version of Wine.
One of the lingering issues with Gallium Nine has been with hitting memory issues when running 32-bit games: out of memory errors, other memory errors, or increased memory consumption to running without Nine have been common for a wide variety of popular D3D9 games when running the 32-bit builds through Nine. But with the newest Mesa 21.1-devel code merged today, that should be an issue of the past.
Gallium Nine lead developer Axel Davy explained in the MR that was honored this morning, "storing in memfd and release the virtual memory attached to the allocation until needed. Memfd files is a feature of the linux kernel. It enables to allocate a file stored in RAM and visible only to the app. We can map/unmap portions of the file as we need. When a portion is mapped, it takes virtual memory space. When it is not, it doesn't. The file is stored in RAM, and thus the access speed is the same as normal RAM. Basically instead of using malloc(), we create a memfd file and map it. When the data doesn't seem to be accessed anymore, we can unmap the memfd file. If the data is needed, the memfd file is mapped again. This trick enables to allocate more than 4GB on 32 bits apps, while reducing virtual memory usage."
This MEMFD trick should reduce virtual memory usage of textures and ultimately allow more of these 32-bit Direct3D 9 games to now happily run with Mesa's Nine. This addition does add some overhead but ultimately should be small and due to the way it's implemented possibly a performance boost for multi-threaded software. This new memory handling in the Nine code does not impact the 64-bit software behavior.
12 Comments