Skip to content
axeldavy edited this page Feb 27, 2019 · 13 revisions

Welcome to the Gallium Nine wiki!

Old wiki (not up to date) link: https://wiki.ixit.cz/d3d9

What is Gallium Nine?

Gallium Nine is a project to implement D3D9 closer to the graphic driver. Unlike Wine or game ports which implement D3D9 calls with OpenGL (or Vulkan), Gallium Nine uses the internal driver abstraction API Gallium, supported by many mesa drivers (AMD cards, NVidia cards and recent Intel cards). Gallium is also used to implement OpenGL, OpenCL, VDPAU, etc and thus is well maintained. The Gallium API is an adequate abstraction level to implement D3D9, as it is both low level (no error checking, you get exactly what you ask, access to specific hw abilities to implement D3D9 features) and high level (no advanced memory management to implement and a lot of driver magic to improve performance hidden). Gallium Nine has also access to a lot of helper libraries used by the other Gallium users, such as functions to convert between texture formats.

Gallium Nine only implements D3D9, which means it won't be able to interact with other D3D versions, unlike wine. A few apps will thus require wine. On the other hand, this simplifies the implementation, which helped make it efficient and low overhead.

While Wine has closed the gap over the years, Gallium Nine is often running faster than Wine's implementation, while using less CPU, and having smoother gameplay. Though some games may work only with Wine (And the opposite is true as well. The Sims2 for example works only with Gallium Nine). Some games may have glitches on one implementation and not on the other, and vice-versa. Hopefully over the years both implementation will become glitch free.

What do I need to run Nine?

  • A working Wine setup
  • A compatible graphics card and game
  • Your graphic card must use the Mesa driver, and in particular the driver must implement the Gallium API.
  • Mesa must have been build with support for Gallium Nine. Remember most D3D9 games are 32 bits, and thus you need a 32bits driver.
  • Your Wine version should include patches to enable Gallium Nine (depending on your Linux distribution, you should be able to find ready-to-use packages). Else use https://github.com/iXit/wine-nine-standalone which adds support on top of any Wine installation. For those who don't want to compile anything, the precompiled binaries work on top of most distributions: https://github.com/iXit/wine-nine-standalone/releases. Yet another alternative is to use winetricks (easiest solution if you are allergic to command line). Indeed 2019 winetricks packages some prepackaged wine-nine-standalone. Once your Wine includes Gallium Nine support, it must be actived. It can be done (depending on the setup) either with the GUI displayed by the command 'wine ninewinecfg' or in the main wine GUI 'winecfg'. If you launch your game in a terminal, a green message indicates if Gallium Nine is used.

On a complete installation, 'find /usr | grep d3dadapter' will return something similar to:

/usr/lib32/d3d/d3dadapter9.so.1.0.0
/usr/lib32/d3d/d3dadapter9.so
/usr/lib32/d3d/d3dadapter9.so.1
/usr/lib/d3d/d3dadapter9.so.1.0.0
/usr/lib/d3d/d3dadapter9.so
/usr/lib/d3d/d3dadapter9.so.1
/usr/include/d3dadapter
/usr/include/d3dadapter/drm.h
/usr/include/d3dadapter/d3dadapter9.h
/usr/include/d3dadapter/present.h

You usually need both a .so among the 32 bits libs and among the 64 bits libs. The .h files are required to compile wine-nine-standalone, but are not needed else.

Bugreports

Report bugs at: https://github.com/iXit/Mesa-3D/issues

  • Please always include the WINE version, and MESA version as well as the card you are using.
  • A game trace displaying the issue helps getting bugs fixed significantly faster. See https://github.com/iXit/wine-nine-standalone/wiki/apitrace for how to make traces.
  • Alternatively, a debug log can be useful. The game should be launched with NINE_DEBUG=all csmt_force=0. Unfortunately a debug log is only produced if mesa was build with --enable-debug (autotools) or -D b_ndebug=false (meson) which is usually not the case for prepackaged mesa.

Gallium Nine Options

Options in common with other Mesa drivers:

  • Setting the GPU to use in Multi-GPU systems. This can be done with the env var 'DRI_PRIME=1' which will force the use of a different GPU than the main one. More precise control can be done with the env var device_id which takes the ID_PATH_TAG field obtained with udevadm info /dev/dri/render* . device_id is a drirc setting and thus can be set for specific games in the ~/.drirc config file.
  • Disable vsync / Force vsync: This can be done with the env var / drirc setting vblank_mode=0 (to disable) or =3 (to force)

Specific options:

  • Overriding vendor info. Some games have different paths on different cards. For example Skyrim won't render water properly on Nvidia, since it wants to use specific Nvidia api not available on Wine. You shouldn't expect perf gains with this option, but it may help with some game issues. override_vendorid is a env var / drirc setting. override_vendorid=4318 advertises Nvidia, override_vendorid=4098 AMD and override_vendorid=32902 Intel.
  • Forcing/Disabling Internal multithreading. Gallium Nine uses a worker thread for most calls to hide overhead. This can be forced with csmt_force=1 and disabled with csmt_force=0. By default it is enabled on graphic drivers which are known to be multithreading-safe for the Gallium API.
  • Control of backbuffer behaviour and throttling. By default, Gallium mimicks the behaviour of D3D9 backbuffers, but you may want to use slightly different behaviours. throttle_value=0 will give lower fps, but lowest frame lag. thread_submit=true tearfree_discard=true will give 'triple buffering' behaviour. Framerate can be above the refresh rate, while not having any screen tearing. Some games have buggy physics with vsync, and thus this can be used as replacement. This is also known to prevent glitches on some 4K screens.
Clone this wiki locally