Gallium Nine Lands Big Optimization Around Dynamic System Memory Buffers
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.