Gallium Nine

From LinuxReviews
Jump to navigationJump to search
Gallium Nine
Original author(s)Axel Davy
Developer(s)Axel Davy & Mesa dev team
Repositorygithub.com/iXit/wine-nine-standalone (Wine driver) and gitlab.freedesktop.org/mesa/mesa/-/tree/main/src/gallium/targets/d3dadapter9 (Mesa driver)
Operating systemLinux, Unix-like
PlatformMesa/Gallium
Included withMesa
Pcie-card-icon.svg

Gallium Nine (or "d3dadapter9") is a multi-GPU DirectX 9 graphics driver for GNU/Linux and other operating systems where it is possible to use the Gallium graphics driver API from the free software Mesa graphics stack. It is mostly useful as a Wine back-end for Windows software using the DirectX 9 API.

Gallium Nine is the fastest Wine back-end for DX9 due to it's shorter rendering path compared to DXVK and Wine's build-in wined3d DX9 to OpenGL translation layer.

The wined3d DirectX 9 rendering path goes Direct3D 9 ▸ OpenGL ▸ Mesa's Gallium Hardware State Tracker ▸ GPU Hardware.

Gallium Nine cuts that down to Direct3D 9 ▸ Mesa's Gallium Hardware State Tracker ▸ GPU Hardware.

While Gallium Nine is the faster option for Direct3D 9, it isn't as hugely faster than DXVK as you'd might expect. The difference between Wine's builtin wined3d implementation and Gallium Nine is significant, but it's barely measurably faster than DXVK.

Unigine Heaven Benchmark 4.0

Heaven-wine-native-crash.jpg
Wine with wined3d did not want to run the Unigine Heaven benchmark with DirectX 9 rendering.

Wine 6.7 won't run the Unigine Heaven Benchmark 4.0 in DirectX 9 mode when the wined3d DX9 to OpenGL translation layer is in use. It works just fine with Gallium Nine and DXVK. The Heaven benchmark lets you choose between DirectX 9, DirectX 11 and OpenGL and the Heaven benchmark does run just fine with wined3d if DirectX 11 is used. We have therefore included wined3d using DirectX 11 along-side the DXVK and Gallium Nine results using DirectX 9. We've also included the native Linux version as a contrast since Unigine Heaven happens to be available in a native Linux version. The OpenGL API is the only option in the native Linux version so we used that with the exact same settings.

Unigine Heaven Benchmark 4.0, 1080p, High, x2 AA, FPS
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Heaven Benchmark 4.0, 1440p, High, x2 AA, FPS
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Heaven Benchmark 4.0, 720p, Low, No AA, FPS
Mesa 21.1, Intel Broadwell i7-5500U CPU/iGPU
Unigine Heaven Benchmark 4.0, 1080p, High, x2 AA, Score
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Heaven Benchmark 4.0, 1440p, High, x2 AA, Score
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Heaven Benchmark 4.0, 720p, Low, No AA, Score
Mesa 21.1, Intel Broadwell i7-5500U CPU/iGPU

The difference between wined3d and DXVK and Gallium Nine is pretty big at 1080p on the AMD test machine. It is a bit less at 1440p, but there's still a gap.

The tiny difference between Gallium Nine and DXVK on the AMD machine at both 1440p and 1080p is the more interesting result. It shows that Gallium Nine has a small performance advantage over DXVK. It is faster, but only by a hair. We had expected to see a larger difference. It is also interesting that the difference between the native Linux version with OpenGL and the Windows version with DXVK is about zero at 1080p with Gallium Nine score slightly higher than both of those. It gets worse for the native Linux version at 1440p, both DXVK and Gallium Nine race ahead of the native Linux version and it's OpenGL rendering path at the higher resolution.

The picture is slightly different on the Intel test machine. It could barely run at 720p Low, so it's not exactly something that is generally usable for games or graphics. Gallium Nine would be the better choice if you were to run games in Wine on a weak Intel iGPU. The gap between the native Linux version using OpenGL and Gallium Nine is much bigger on the Intel machine than it is on the AMD system, though it would be pretty bad to play a game with an average frame rate of both 34.1 and 30.9 at 720p low.

Unigine Valley Benchmark 1.0

Valley-benchmark.jpg
The native Linux version of the Unigine Valley Benchmark 1.0 using OpenGL.

The Unigine Valley benchmark is made by the same folks who made the Unigine Heaven Benchmark. Wine's wined3d DX9 implementation doesn't work with that one either, so we used DX11 for comparison to DXVK and Gallium Nine in that one too.

Unigine Valley Benchmark 1.0, 1080p, High, x2 AA, FPS
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Valley Benchmark 1.0, 1440p, High, x2 AA, FPS
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Valley Benchmark 1.0, 1080p, High, x2 AA, Score
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,
Unigine Valley Benchmark 1.0, 1440p, High, x2 AA, Score
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600,

The Wine built-in wined3d DX9 implementation scores about the same at 1080p and 1440p making the gap between it and DXVK and Gallium nine much bigger at 1080p than it is at 1440p.

Gallium Nine wins over DXVK by a clear margin at both resolutions, only to be beat by the native Unigine Valley Benchmark 1.0 version using OpenGL.

Quantum by Outracks vs Nazareth Creations

The Quantum PC demo scene demo by Outracks vs Nazareth Creations does not work with the wined3d DX9 implementation in Wine 6.7 or 6.8. It works fine with both Gallium Nine and DXVK. Both provide pretty equal frame-rates, though Gallium Nine does have a lead.

Quantum by Outracks vs Nazareth Creations, 1080p, Vsync off
Mesa 21.1, MSI RX 570 8 GiB, AMD Ryzen 5 1600x
Quantum by Outracks vs Nazareth Creations, 4K, Vsync off
Mesa 21.1, MSI RX 570 8 GiB, AMD Ryzen 5 1600x

The data was gathered from GALLIUM_HUD and VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay with one second intervals.

Fr-025 : t h e . p o p u l a r . d e m o

Fr-025 : t h e . p o p u l a r . d e m o from 2003 uses DirectX 9 and it works with wined3d, Gallium Nine and DXVK. Fr-025 does not support resolutions above 1080p. The frame-rates it produces on somewhat modern dedicated GPU hardware are rather high.

Fr-025 : t h e . p o p u l a r . d e m o, 1080p, Quality: 2
Mesa 21.1, MSI RX 470 8 GiB, AMD Ryzen 5 2600

Gallium Nine isn't doing too good against DXVK in the Fr-025 : t h e . p o p u l a r . d e m o demo scene demo on AMD hardware. It is actually doing worse the wined3d in some areas. The results aren't what you'd expect in this particular demo.

Fr-025 : t h e . p o p u l a r . d e m o, 1080p, Quality: 2
Mesa 21.1, Intel i7-5500U (iGPU)

The results differ with the weak and pathetic graphics chip in the Intel i7-5500U CPU. Galliun Nine is a clear overall winner on that machine, though it does have the same strange dips below the other two mid-way through the demo and again towards the end.

Compatibility

Most Windows software using DirectX 9 will work fine with Gallium Nine, but there are some exceptions. Don't expect that everything will just work. You can, as a general rule, expect that anything that works with DXVK will also work with Gallium Nine.

Some software that won't work with the stock Wine wined3d DX9 to OpenGL translation layer will work fine with Gallium Nine. The PC demo scene demo Fr-041: d e b r i s is one example, it works with DXVK and Gallium Nine but it just crashes during the loading screen with Wine's wined3d DX9 implementation.

There is a problem with using the Gallium heads-up display with Gallium Nine. GALLIUM_HUD=fps works fine with OpenGL applications (ie GALLIUM_HUD=fps glxgears) but it makes all the DX9 applications in Wine crash if you use Gallium Nine. Don't use GALLIUM_HUD= with Gallium Nine or you will have a bad day.

Conclusions

Gallium Nine may be worth it if you want a few extra frames per second in DirectX 9 games in Wine. It will be a lot faster than the built-in wined3d Direct3D 9 implementation, but it won't be much faster than DXVK. You will get a few more frames than you get with DXVK, but it's just a few more. More is more, but there is more to this story: There are a few programs (specially PC demo scene demos) that work with DXVK that don't work with Gallium Nine. It is not always the best choice if compatibility is your biggest concern. A few more frames in some games isn't all that if others don't work.. and that is why you may want to keep a separate WINEPREFIX for it and the DX9 applications that work best with it. You could use a simple shell script if you do not want to type WINEPREFIX=whatever wine game.exe every time you start a game:

File: bin/wine9
#!/bin/bash
WINEPREFIX="$HOME/.wine-gallium-nine" wine $@

Installation

You will need two things to use Gallium Nine:

  • The Mesa libd3d package. It is in the repositories of any distribution shipping the Mesa graphics drivers, and that would be all of them. You will likely have to install it, distributions do not tend to include it by default.
  • The "gallium-nine-standalone" package available from github.com/iXit/wine-nine-standalone/releases.

The "gallium-nine-standalone" package is probably not in your distributions repositories even if the Mesa libd3d package is. You can acquire pre-built binaries from github.com/iXit/wine-nine-standalone/releases.

It is also possible to build it from source. There are instructions on github.com/iXit/wine-nine-standalone/wiki/Compiling if you want to go that route. We recommend against it. Compiling it is easy enough if you have the dependencies. There are quite a few of them and you need the development packages for both the x86-64 and i686 versions of the required libraries (wine, d3dadapter9, liblx11, libxcb, libdrm, valgrind, libXau-devel, libgl/libglvnd).

Installing Gallium Nine is easy if you go the easy route and use the release tarball. You can simply extract it and run the nine-install.sh from within the tarball. You should run wine ninewinecfg once it is installed, it will tell you if it works or if you are missing something important like i686 version of the Mesa libd3d package.

You may want to create a separate dedicated WINEPREFIX= for Gallium Nine and DirectX 9 games and applications; the ninewinecfg does absolutely not provide any easy means of switching between Gallium Nine and DXVK in case some game doesn't work with one or the other.

Choosing Wine Driver

This is where it gets a bit messy and annoying. There isn't any way to easily switch between Gallium Nine and DXVK on a per-game level when you run games.

The best, and seemingly only (perhaps there is a way we are not ware of) way to choose what Wine should use for specific games without annoying work is to create different WINEPREFIX folders. That's one way that works, you can set a prefix like WINEPREFIX=$HOME/.wine-dxvk or WINEPREFIX=$HOME/.wine-nine and install games to the Wine installation you prefer.

It is possible to run wine ninewinecfg and disable the Enable Gallium Nine for better D3D9 graphics performance option. That work work and make sense if ninewinecfg wasn't broken useless garbage. It is, so that option disables any and all DX9 support, not just Gallium Nine. The reason is that ninewinecfg will move the existing d3d9.dll libraries to d3d9.dll.old and make symbolic links from d3d9-nine.dll to d3d9.dll when it is installed and remove the symbolic link and leave it at that when it's disabled. That's obviously not going to leave the end-user with any working DX9 implementation. It would not be a shame if whomever thought that was a good idea gets slammed with 1000mm Ø50mm industrial steel rod.

One solution is to re-install DXVK, but that's not exactly something you will want to do all the time. The better solution is to use a different WINEPREFIX= until someone comes up with a solution that makes DXVK and Gallium Nine play nice together.

Links


avatar

Anonymous (6b411b7d)

17 months ago
Score 0

I came to about the same conclusion a while ago:

https://www....ne_with_enb/

I can run the GALLIUM_HUD fine however.
avatar

Chaekyung

17 months ago
Score 0++
Can you use GALLIUM_HUD with Fr-041: d e b r i s? I wrongly assumed it doesn't work with anything when the first two I tried it with crashed with it and not without it - but it does work fine with some programs like the Quantum PC scene demo. It's a bit.. odd.
avatar

Anonymous (2977eb5c)

17 months ago
Score 0

Debris is packed with kkrunchy so called malware, unlike Quantum which is packed with upx. These apps arent so small, just crazy compressed from memory to unpack into memory... and sometimes that might be an issue, probably does not run on ReactOS.

Joking a bit, app probably have some issue with a window if HUD does not work for you... BTW, you can use Fr-025, Fr-043, etc... demos, these are both D3D9 and have benchmark built in.
avatar

Chaekyung

17 months ago
Score 0++
Fr-043 doesn't work at all with Wine 6.8, not with or without Nine or DXVK. Fr-025 works fine in all of them so I've added a graph for that one.
avatar

Anonymous (8fdd2843)

17 months ago
Score 0
Fr-043 is working here, but forgot to mention it is one of these with trouble with pulse - works only under plain alsa... Try to kill pulseaudio completelly, reboot. Switch let say via winetricks winealsa instead of winepulse.
avatar

Anonymous (8fdd2843)

17 months ago
Score 0
I mean WINE have a lot trouble with audio/video also, not just with graphics.
avatar

Anonymous (8fdd2843)

17 months ago
Score 0

Also for Fr-043 try overriding d3dx9_42.dll and d3dcompiler_42.dll to native... as many WINE dlls are many time broken/unfinised/etc... 🤣

Copy original dlls in a Fr-043 folder and override with WINEDLLOVERRIDES="d3dx9_42=n;d3dcompiler_42=n" wine fr-043.exe
avatar

Chaekyung

17 months ago
Score 0++
Screw you and your "helpful" Fr-043: Rove hints!!!
avatar

Anonymous (8fdd2843)

17 months ago
Score 0

I have it Fr-043 working all fine, also with about 5% performance above Windows. Steps are like:

1. killing pulse 2. forcing native dlls

3. use mesa driver where AMD didnt yet killed SDMA 🤣
avatar

Anonymous (8fdd2843)

17 months ago
Score 0
4. and that perf only on Gallium Nine
avatar

Anonymous (84c06c8a)

17 months ago
Score 0

"Screw you and your "helpful" Fr-043: Rove hints!!!'"

Well, i told you you have to kill pulseaudio too, not just overrides 🤣 I really mean that, entire pulseudio server, Rove does not start if that is active.
avatar

Chaekyung

17 months ago
Score 0++

Thanks!! I got Fr-043: Rove working by eradicating my systems PulseAudio infection. I guess it's better to be able to run it without sound than not at all, but it's not exactly how it was meant to be enjoyed, now is it?

I'm also a bit puzzled as to what, if anything, makes it say "Ran out of memory" if PulseAudio is enabled.
avatar

Anonymous (84c06c8a)

17 months ago
Score 0

Screw Mr. Lenart first, then screw WINE dlls, then screw AMD current driver... and then perf will be there.

Probably that sounds like a joke to you, but it is true. 🤣
avatar

Anonymous (9f35f7802a)

16 months ago
Score 0
Something this article is missing is the CPU utilization between DXVK and d3d9-nine. I find DXVK is often CPU limited on my hardware: old AMD Piledriver CPU and Radeon RX470 GPU. CPU overhead isn't an issue with d3d9-nine.
avatar

Anonymous (fb60b43b32)

9 months ago
Score 0
Interesting comparison, thanks! Is there any difference in VRAM usage between DXVK and Gallium Nine?
avatar

Anonymous (fb60b43b32)

9 months ago
Score 0
Also, I think it might be worth it to compare the smoothness of frame times of DXVK and Gallium Nine.
avatar

Anonymous (f06c65e716)

6 months ago
Score 0

Some of the stuff in this is flat out incorrect, for example the stuff about GALLIUM_HUD not working in DX9 programs ran under wine as I was using it in Sims Medieval just before without problems.

On top of that, the "While Gallium Nine is the faster option for Direct3D 9, it isn't as hugely faster than DXVK as you'd might expect" part is misleading - You've just tested old benchmarks where the FPS is >1000 (ie. You're probably drawcall bottlenecked there, a performance consideration that means nothing for most games because you're usually at ridiculous framerates well beyond your refresh rate to get drawcall limited...) and some graphics demos: There's nothing showing real world game performance here which in my experience can show a significant difference between DXVK and Gallium Nine especially for frametimes where Gallium Nine easily pulls ahead. (No shader recompilation stutter for one thing, something that effects DXVK on almost every game)

Finally, there's something that is being missed about DXVK in the compatibility part: DXVK balloons memory usage which is absolutely a huge issue for 32bit games that need to use the entirety of their 32bit address space.

One way to recreate it is by playing The Sims 3 with *all* of the expansions and store content using the "Legacy Island III" neighbourhood from the exchange, for me that'll crash within half an hour under DXVK due to "DxvkMemoryAllocator: Memory allocation failed" errors but runs flawlessly under Gallium Nine for >8 hour marathon sessions. Another game that doesn't like DXVK for this reason is Sins of a Solar Empire Rebellion although you need to play a large map and get to the mid-to-late game to see it start getting crashy from memory problems.
avatar

Anonymous (40770a3ead)

9 hours 58 minutes ago
Score 0

Gallium nine seems to be broken for Intel Haswell GT1 gallium driver (crocus) which is default driver now with Mesa 22.1.7.

Games will either crash or will have severe graphical glitch.

Intel Haswell GT1 does not have a proper vulkan driver so dxvk is not a good option to run old DX9 games.

Tested on Wine 6.17
Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.