Gallium Nine Lands Big Optimization Around Dynamic System Memory Buffers

Written by Michael Larabel in Mesa on 14 March 2021 at 07:04 AM EDT. 15 Comments
MESA
In addition to recent commits improving Mesa's Gallium3D Direct3D 9 "Nine" state tracker and addressing memory issues with 32-bit games, this D3D9 state tracker is now enjoying another performance optimization helping some games.

Lead Gallium Nine developer Axel Davy merged his code for optimizing dynamic system memory "SYSTEMMEM" buffers. Up to now Gallium Nine did not specifically handle the SYSTEMMEM CPU buffers while now it's better optimized for this type of buffers.

Axel explained of what triggered him to work on it and his approach, "One example is Halo. The app uses SYSTEMMEM buffers with the DYNAMIC flags. The index buffers are locked in a round fashion (with draw calls after each lock) with the NOOVERWRITE flag (it never discards). And it has various NOOVERWRITE/DISCARD behaviours for its vertex buffers. For example for one vertex buffer it makes a lot of consecutive locks with the DISCARD flag each time, and then begins using it for rendering...The new version implements SYSTEMMEM (non-DYNAMIC takes the DYNAMIC path) by having any lock dirty the whole area (to handle writes outside the locked region), and uploading only what is needed for the draw calls in efficient fashion (I aggressively try to generate DISCARD/UNSYNCHRONIZED)."

The results of this dynamic SYSTEMMEM buffer optimization is quite significant for affected software, "As a result, the path is quite optimized and performance for affected applications is very significantly above what it used to be. Affected applications are usually from the start of the direct3D9 area, and applications with direct3D8 to direct3D9 wrappers...A user reported even reported a case where the performance goes from 1-2 fps to 34 fps (with d3d8to9. 26fps with the same wrapper on windows. 36fps on pure d3d8)."

More details within this merge request that landed this weekend for Mesa 21.1 that will be released as stable in Q2.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week