13 March, 2012

Wine gaming on Nouveau

In my previous blog, I mentioned that I was finally free of proprietary drivers. But that story wasn't completely over. While basic 3D acceleration and things like glxgears worked fine, wine did not run Windows games yet. So here's a report on the progress since then and some tips on how to get these things to work!


I'm not exactly a gamer. I play two games, each of them approximately 6-7 times a year. One is natively available for Linux and these days even Open Source: Return to Castle Wolfenstein: Enemy Territory, an online 1st person shooter. The second game I have to play through wine: Warcraft III: The Frozen Throne. And if I could, I would be playing a third game: Command & Conquer Generals: Zero Hour. Which, according to Wine's App DB should work fine. Doesn't for me, unfortunately - despite spending more hours on getting the game to work than I would play it this year...

Anyway, let's move to some (Wine) Proprietary-Gaming-on-Linux tips you'd need. Both with and without Nouveau, by the way.

RTCW and similar old, closed games

Return to Castle Wolfenstein on Linux. You want sound? And you have a modern Linux? Your game depends on an ancient sound driver system called oss... You need to install the alsa-oss layer and make sure you have the kernel stuff loaded for oss. Oh and you can forget about running both a music player and RTCW or another game which requires this compatibility, won't work. It is one or the other!

Now, the commands. Install whatever oss stuff you can find:
zypper in alsa-oss alsa-oss-32bit
then add to your /etc/rc.d/boot.local:
modprobe snd_seq_oss
modprobe snd_mixer_oss
modprobe snd_pcm_oss
That should give you all the auditory gore you need ;-)

update: I didn't know about aoss which provides an even better solution for the sound. It is simple: start et with "aoss et.x86" and that should already take care of it... It mixes now with other sound as well so you can play music while you frag away. Read more here.

Does the game work with Nouveau? Sure, but I experience occasional instability, as in - hard freezes of the system. I recommend enabling the sysrq keys and using REISUB to avoid data loss. I'll be waiting a bit until it is all more stable until I play that game more.

Gaming with Wine

I'm going to assume you managed to purge the proprietary NVidia driver from your system (yes, this can be quite hard actually) and have nouveau installed and working already. That gives you 3D effects with Compiz/GNOME Shell/KWin/etc and some other basic openGL stuff. Not enough for windows games in wine, however.

I wanted to play Warcraft III and it took me forever to get that working. Turns out error messages like "Can't load Data.dll" or Put the DVD in the drive have little to do with the actual problem. Most of the problems turned out to be related to missing openGL stuff. I had to install the experimental Mesa drivers developed & maintained by Johannes Obermayr in his home project. You should be able to download his Mesa here (although at the time of writing there was a problem with OBS and it gave an error). You will also need some other packages so I suggest to switch the systempackages to those from his repository (see screenshot).

Getting it to work

Once you've installed all new nouveau-stuff, reboot and configure wine by modifying user.reg (in ~/.wine) adding the following under the "Direct3D" header:
"OffscreenRenderingMode"="backbuffer"
like this:
[Software\\Wine\\Direct3D] 1331547889
"DirectDrawRenderer"="opengl"
"Multisampling"="enabled"
"OffscreenRenderingMode"="backbuffer"
"RenderTargetLockMode"="auto"
"StrictDrawOrdering"="enabled"
"UseGLSL"="enabled"
"VideoMemorySize"="256"
PlayOnLinux and winetricks both have this as options you can enable via their GUI's.

For sound to not block your soundcard, use pulse-audio and its alsa plugin:
zypper in alsa-plugins-pulse alsa-plugins-pulse-32bit

Conclusion

It is all rather painful but in the end it's possible to get nouveau to work with Wine (and other) games. But I don't recommend moving over to nouveau if you play games and if you're not desperate to get rid of proprietary drivers (and you usually only are if you want a newer kernel for its hardware support or greatly care about that Freedom stuff). It's not completely ready yet and will give you some issues.

On the other hand, we're getting there. I'm quite happy to see progress in the area of free drivers for both NVIDIA and AMD graphics hardware. If only NVIDIA would be helping the efforts to create open drivers...