Attention: This guide is meant for Bumblebee users on Arch-based systems and is based on my experiments and those source articles:
Bumblebee is needed on all hybrid GPU machines (which are usually laptops) because it makes a system use Intel graphics by default, which saves battery power and allows for switching on discrete Nvidia card for chosen applications with a command: primusrun appname . So for example if we want Steam and its games to use Nvidia card, we start it with a command:
$ primusrun steam
The modified command can be incorporated into desktop files or by editing start menus so the app could start seamlessly with Nvidia. However, such awaken Nvidia card doesn’t allow us to use Vulkan! This prevents Bumblebee users, from benefiting of the new Steam Play’s Proton, which uses Dxvk module to translate DX10 and DX11 titles into Vulkan API. Also, some native Linux Vulcan games like Rise of the Tomb Raider simply won’t start that way!
The solution to this is nvidia-xrun . The major premise is simple: install nvidia-xrun, use TTY to launch it with a chosen WM, then launch Steam and play games. This, however, requires some additional steps and is not so seamless as bumblebee itself. This guide is attempting to clear doubts and help with the details of that process.
I tested it all myself with Talos Principle that for me run 40-61 FPS on Bumblebee and 40-110 FPS on Nvidia-xrun, which shows that Vulkan was used. An older Linux game like for example Outcast showed the same average 40-60 FPS count on bumblebee and nvidia-xrun (so in both cases OpenGL was used). There might be some very slight performance increase in OpenGL games with nvidia-xrun from what I saw, but I didn’t test it so thoroughly.
Here is a detailed step by step guide on how to use Vulkan on Bumblebee - a guide to nvidia-xrun.
1. Check if bumblebee is working:
$ primusrun glxgears
It should open the window with spinning cogs and give frame output in terminal like this:
307 frames in 5.0 seconds = 61.344 FPS 301 frames in 5.0 seconds = 60.024 FPS 301 frames in 5.0 seconds = 60.016 FPS 301 frames in 5.0 seconds = 60.021 FPS 301 frames in 5.0 seconds = 60.022 FPS 301 framesa in 5.0 seconds = 60.019 FP
Close the visualisation window or use ctrl+c in a terminal to stop the process.
If it doesn’t work, this is beyond scope of this article. You should get acquainted with Bumblebee and troubleshoot what is wrong in your situation:
2. Install nvidia-xrun or nvidia-xrun-git from AUR
Use a or octopi UI, or a preferred AUR helper in a terminal to install
nvidia-xrun-git. You should already know how to do that. If not, check Manjaro wiki.
3. Install some simple WM and needed packages to configure it
Here is a thing you should understand. Nvidia-xrun is designed to run programs with Nvidia card from TTY session. However, running Steam directly on it doesn’t work well. So to work around that, we start nvidia-xrun with WM (Window Manager). There is probably no way to open complex DEs like Plasma. In fact, nvidia-xrun is likely meant to use with WM because launching any DE session will make it use it’s default WM and no other DE modules and elements will work then.
Some think that nvidia-xrun saves system resources by using basic WM but the whole usual DE session is still loaded in the background. However, Nvidia and Steam using Openbox WM may be less problematic than for example using Kwin and that may add some extra performance bonuses.
The simplest choice is to use Openbox WM (or a similar one) as it provides a menu on right-click to launch programs. However, if you run Openbox with nvidia-xrun, you get only very basic, vanilla session, without all the utilities around it, so no panel, no wallpaper or any conveniences. Because of that, aside Openbox we need some tools to manage Openbox menus to have at least some basic functionality:
$ sudo pacman -S openbox obmenu obmenu-generator
4. Create and edit
~/.nvidia-xinitrc to make nvidia-xrun start with Openbox by default:
So simply create a file:
$ nano ~/.nvidia-xinitrc
put and save there:
4. Log into TTY2 and use nvidia-xrun
Use ctrl+alt+f2. Give your username and password. Then type:
input your password again.
To exit from nvidia-xrun and TTY, and go back to normal DE see point 6 of this guide.
5. Configure and use Openbox WM to start Steam.
A vanilla openbox session should start. All you will see will be almost black background and a cursor:
Right-click and choose to open xterm terminal. Inside type:
This will generate more proper Openbox menu based on the programs you have on your system.
Right click on black desktop to invoke Openbox menu and choose: Openbox->Reconfigure
Right-click again - you should have all your programs in the menu, although all in English:
You can also alternatively start programs from a terminal. Alt+tab works for switching windows. In fact, we use terminal now to open obmenu, which is a GUI program to edit
Unfortunately, Openbox’es menus, as the one generated lacks of Steam and some other elements - not sure why. So type in terminal:
Add a new menu position and name it Steam; command: steam; put it on top, just like in the picture below:
After saving it, right-click the black desktop and see menu with Steam on the top of the list. If you don’t see it, click on Reconfigure and try again. This is how you will launch Steam from now on.
6. Log off from WM and go back to default DE.
To end Openbox session, just choose Exit from the Openbox menu or Logoff.
This should make you back to TTY2 view again. Switch to your normal DE session by pressing ctrl+alt+f1.
7. Possible issues and solutions:
Games have screen tearing (a common problem of such setup):
You need to edit
/usr/bin/nvidia-xrun by changing “sudo modprobe nvidia_drm” to “sudo modprobe nvidia_drm modeset=1”. Reboot.
No way to modify sound volume on Openbox nvidia-xrun session:
alsamixer in a terminal to adjust the volume.
Launching Qt programs (like Konsole) may occasionally hang in Openbox session:
If you really need to use many Qt programs and it gives you issues, instead Openbox session start lxqt-session. Of course, you need to install first:
lxqt-admin. Then modify
~/.nvidia-xinitrc and put there
lxqt-session instead. However at the end of the session, it is not enough to exit openbox, lxqt session will be active and will prevent the Nvidia card from turning off. Use:
Then choose log-off. This should jump you to TTY2 view.
Switching back to normal DE session with ctrl+alt+f1 crashes X
This happens on openbox-session. Change to lxqt-session as described above.
Plasma pad scrolling is reverted after switching back
Log off Plasma session and log in or go to pad settings and apply them.
There may be also some nicer way to refresh some processes, I’m open to suggestions ;).