What I'm talking about here is the horrid combination Optirun/Primusrun + PlayonLinux + Steam that makes for wrappers over wrappers over wrappers (primus/optirun calls playonlinux, which calls wine through a bunch of wrapper scripts, which in turn calls steam, which finally calls your game executable)
And, no, it does not work so well.
In my case the game in question is Audiosurf (first of its name), although I'm also interested in making other games (like Skyrim) run the same way.
What I'm sure of is that the game runs. But not on the nvidia card.
I've done the following stupid test :
Check the status of the bumblebee daemon
systemctl status bumblebeed
Watch for the CGroup line :
Run glxgears on bumblebee
While still running
glxgears, check again for bumblebee
systemctl status bumblebeed
├─ 809 /usr/sbin/bumblebeed
└─3707 Xorg :8 -config /etc/bumblebee/xorg.conf.nvidia -configdir ...
As to be expected there is now an instance of the X server, spawned by bumblebee, which is running
glxgearson the nvidia card
glxgearsand check again : The X.org instance is gone
Now launch the steam game through
primusrun /usr/share/playonlinux/playonlinux --run "Steam" -applaunch 12900
And check the status of Bumblebee : Back at step 1, no Xorg child. (Be sure to be in-game when you do that, not just in the menu)
I used primusrun because if the program doesn't use the graphics card then no Xorg instance is spawned, whereas optirun somehow forces the instantiation of Worg
I even went so far as to stop the bumblebee daemon to make sure the game was still running (DON'T DO THAT! If the program is really running on the nvidia card that would not only freeze the window on your side, but also stall the GPU)
So, right, the game doesn't run on Bumblebee ; But where's the problem?
It has to be because, somewhere, one of the wrappers spawns a new process and returns. Making the target process unreachable to primusrun. But who's to blame?
Is it one of the multiple wrappers used by playonlinux? Or is it just steam?
Or maybe it's even deeper than that : What if Audiosurf simply doesn't use opengl? Of course it doesn't natively, but doesn't wine translate DirectX calls to opengl calls?
Leaving that gloomy hypothesis aside, I figured I should get as close as I could to the executable before calling primusrun. The ideal being something like
primusrun wine game.exe.
So how do I do that?
You can use this box to prefix commands to the shortcut. Handy in, say, the case of laptops with Nvidia and Intel graphics, and you need to use prefix primusrun or optirun before starting a particular game.
But it turns out this is complete BOLLOCKS
After a little poking around the sources of PlayonLinux, I found the bastard :
if [ -e "$HOME/.PlayOnLinux/configurations/pre_shortcut/$NAME" ]; then source "$HOME/.PlayOnLinux/configurations/pre_shortcut/$NAME" fi exec ./playonlinux-bash "$HOME/.PlayOnLinux/shortcuts/$NAME" "$@"
$HOME/.PlayOnLinux/configurations/pre_shortcut/$NAME file is where the "Command to exec before running the program" field is saved. As you can see, this file is
sourced which means you can do a bunch of stuff before running the program (that would be the last line with the
exec command), but not as you're running it.
So calling any wrapper like
primusrun in this box would be like beating the air.
Nevertheless, following that lead further, I also found that
$HOME/.PlayOnLinux/shortcuts/$NAME contains a call to the
POL_Wine function followed by the actual .exe file, and that's about as far as I've gotten into the chain of wrappers used by POL.
I realise I have greatly diverged from the topic by going into details but I truly mean for this question to include any steam game not yet available natively on Linux that might have the same issues, so I'll try and reformulate the questions here (please don't just answer them with "You could do this hack to make it work with Audiosurf") :
- Why is my game not running on the discrete nvidia card when I used
- What can I do to work around this?