Bumblebee - Run entire KDE session on NVIDIA

NB This how to requires a working Bumblebee configuration

Users of NVIDIA Optimus configurations so far have not been able to run their entire KDE session on the NVIDIA card instead of the integrated Intel. Here’s how to make that happen, big thanks to Zeronte | making Linux even simpler
NB. All is done from a user session, sudo will be used where root permissions are needed.

  1. Add an entry to the Session manager in KDM:
kwrite kde-primusrun.desktop

Paste this in the empty file


[Desktop Entry]
Encoding=UTF-8
Type=XSession
Exec=/usr/local/bin/primus-kde
TryExec=/usr/local/bin/primus-kde

Name=KDE HDMI Enabled

Comment=KDE Desktop Environment


Save the file. Now change the permissions and copy the file to it’s proper destination:


chmod a+x kde-primusrun.desktop && sudo cp kde-primusrun.desktop /usr/share/xsessions/

Enter rootpassword when prompted for.

  1. Create a file that will do the actual start of the KDE session:
kwrite primus-kde

put these lines in it


#!/bin/bash


vblank_mode=0 /usr/bin/primusrun /usr/bin/startkde


Save it, Change it’s permissions and copy it to it’s proper destination:


chmod a+x primus-kde && sudo mv primus-kde /usr/local/bin/

  1. Switching to the new session
    Logout
    In the KDE login screen (KDM), select “KDE HDMI Enabled” as your session
    Login
    A quick check in Kinfocenter now shows the NVIDIA as the graphics adapter
glxinfo2 | grep OpenGL

now should show something like

OpenGL vendor string: NVIDIA CorporationOpenGL renderer string: GeForce 610M/PCIe/SSE2

OpenGL version string: 4.3.0 NVIDIA 325.15
OpenGL shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL extensions:



Nice addition, works for xfce too. But it’s not running the desktop on the Nvidia, it’s only a kind of autostarting primus for some programs. Google-chrome for example will only kick in the nvidia card if I start it with --ignore-gpu-blacklist. So it’s nice, but far from running nvidia only on a muxed system. About HDMI I’ll have to buy a cable to test that, both for bumblebee and nvidia only.

Mmm. my techical knowledge is too average to completely understand this. My testcase was google-earth, which wouldn’t run without primus, now runs by simply invoking ‘google-earth’. Any tip on how to check whether Chrome uses the NVIDIA?

I was certainly rather confused too, but I believe the difference is this, Xfce doesn’t use OpenGL and consequently the nvidia card isn’t powered on when the desktop is loaded. In Xfce only OpenGL applications will use nvidia, this is almost better than windows now. Only drawback is the delay when an OpenGL application starts, but thats acceptable for me. I suppose LXDE would work the same way.
Check /proc/acpi/bbswitch when running only the desktop, mine is OFF until I start some OpenGL stuff.

Here’s mine:

aptop:/usr/lib/nvidia> cat /proc/acpi/bbswitch
0000:01:00.0 ON

, which is with no apps open

I’m not positive, but I thought xfwm’s compositor has opengl support now ? (I could be wrong though). In any regard, the compton wm most definitely supports opengl

what happens if you switch to XRender (System settings > DE effects > Advanced )?

This is really interesting, as far as I can see there’s a demand for OpenGL in Xfce, which suggests it’s not there yet, you might achive it with Compiz or Compton. So it would be very intersting to know if it’s possible to change the behavior of KDE. My system is really a low performance one, an Asus EeePC1015PN with an Atom processor and Nvidia ION graphics chip, so the delay I expire on launching OpenGL applications might not be very typical, it would be very helpful to get some feedback from users of more powerful systems on this issue.