Gallium Nine does something interesting that few other Linux programs do — it re-implements a technology from Windows. In this case Gallium Nine is an open-source implementation of DirectX 9. As a result it matches Windows in DX9 performance and allows you to play DirectX 9 games at as performance as close to native as possible.
It’s really hard to beat the performance that Gallium Nine offers, which makes it kind of odd that support for Gallium Nine isn’t included by default in Wine. The Wine developers went as far as to reject it. You need to install a specially-configured version of Wine with additional patches to enable it.
What You Need
You need to be running the Mesa open-source drivers in order to take advantage of Gallium Nine. Support for this open-source DirectX is included in most versions of Mesa. If you compiled your own, make sure that you’ve included it.
This also means that you need to be running the open-source AMDGPU or Nouveau drivers. If you’re using a NVIDIA card, it’s probably best that you keep running the proprietary drivers and use Wine Staging instead. The performance increase that you’ll see from Gallium Nine will be outweighed by the decrease in performance from Nouveau.
Get the Packages
Ubuntu doesn’t package Mesa with Gallium Nine support. You have to enable an external PPA or build Mesa yourself to get it. The PPA route is much easier, so that’s what this guide will cover. If you’re on Debian, this method might work for you, too, but don’t bank on it. Ubuntu packages are hit-and-miss in terms of compatibility with Debian.
The PPA hasn’t been updated in a few months and only officially supports up to Ubuntu 16.10, but the available version of Mesa is still newer than what’s in 17.04, so you’re getting an upgrade anyway. Add the Mesa repository with
Apt just added a repository that doesn’t exist. You need to manually go back and change the Mesa repository from “Zesty” to “Yakkety.” Navigate to “/etc/apt/sources.list.d” in the terminal. Find the file called “oibaf-ubuntu-gallium-nine-zesty.list” and open it with
sudo and your text editor of choice. Change all instances of “zesty” to “yakkety.” Save and close the file. You should rename it to “oibaf-ubuntu-gallium-yakkety.list” to reflect the changes.
Now, add the repository for Wine. This one is more actively maintained.
After you’ve written both files, update Apt and install both Mesa and Wine.
You’ll probably need to restart your X server or your computer for the changes to Mesa to take effect.
Arch Linux offers Gallium Nine support through the AUR. You can find everything that you need on the AUR page.
Gentoo is one of the easiest distributions to get Gallium Nine to work on. Make sure that you enable the “d3d9” when building Mesa.
Then, unmask “wine-any” by adding it to “/etc/portage/package.accept_keywords.”
Then, enable the “d3d9” USE flag when building it.
Enable Gallium Nine
winecfg. When the window opens, click on the “Staging” tab. Check the box to enable Gallium Nine and apply the change. You’re now ready to use Gallium Nine with Wine!
Test It Out
Open a game that supports DirectX 9. Try to monitor the framerate. If you want to see the difference that Gallium Nine makes, open “winecfg” again and disable support. Run your game and compare the framerate. Gallium Nine will probably provide a noticeable increase in performance.
Remember to keep both Wine and Mesa updated. The open-source drivers move at a much faster pace than proprietary ones, and the Wine project is moving at an equally rapid pace. The wonderful part of that is you should also notice gradual performance gains over time at absolutely no cost to you.