Mesa Prepares To Drop Old GLSL-To-TGSI - Big Code Removal, Win For Performance & Fixes

Written by Michael Larabel in Mesa on 20 April 2022 at 07:37 AM EDT. 7 Comments
MESA
A project more than one year in the making by Emma Anholt is about to mark its completion with GLSL-to-TGSI set to be removed from Mesa whereby Gallium3D will always go through the NIR intermediate representation while older drivers still dependent upon TGSI will make use of the NIR-To-TGSI pass. Using NIR means better performance and getting rid of the GLSL-to-TGSI code path means freeing up more than twenty thousand lines of code.

Anholt since the end of 2020 has been working to move the older/smaller drivers off their TGSI dependence and getting NIR support plumbed in by way of the NIR-to-TGSI path. From this long ongoing work Mesa has moved Virgl to NIR, GeForce FX / 6 / 7 series on Nouveau now using NIR-to-TGSI as of Mesa 22.1, Radeon R300g using this path too since last year, and the old Intel i915g driver also takes this route. With these driver changes and other Mesa work that has been mainlined over the past year, going the GLSL-to-TGSI route is being made redundant and can be eliminated. NIR is the modern intermediate representation used by the newer open-source Mesa drivers and has much better optimization potential, better designed for modern graphics needs, and all around is of better code quality and capabilities these days than TGSI that started out as the original Gallium3D IR for Mesa.


This removal is a win for Mesa developers with more than 20k lines of code removed to lower the maintenance burden, particularly for this neglected area of the massive code-base.


This merge request replaces the glsl_to_tgsi() function with using glsl_to_nir() and nir_to_tgsi(). So those drivers not natively supporting the NIR intermediate representation will go from the OpenGL Shading Language (GLSL) to NIR and back to TGSI for driver consumption. Just a few changes are still pending first around Virgl, R600g, Nouveau, and a few regression fixes before that merge can land.


Those with older GPUs can also celebrate since this effort to go through NIR means the possibility of better performance, fixes, and better tested code in general.


Emma Anholt noted on the mailing list for the benefits of passing the finish line beyond just the performance potential, "We're down to very few test regressions in the remaining drivers, and landing it nets us test fixes and performance wins while removing 22,000 lines of unmaintained, non-CI-tested code."

So assuming no last minute hurdles appear, the hope is to complete this work soon and thus should be a nice clean-up for the Mesa 22.2 release next quarter.
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