Daemon for toggling discrete NVIDIA GPU power on Optimus laptops.
Internally uses bbswitch kernel module to switch video adapter power state.
Useful for pre-Turing GPU generations without dynamic power management features, allows to fully benefit from NVIDIA PRIME Render Offload technology without need to keep graphics adapter turned on all the time.
For Turing generation cards with Intel Coffee Lake or above CPUs as well as some Ryzen CPUs like the 5800H, it is possible to fully power down the GPU when not in use automatically without user interaction: see NVIDIA documentation.
The most simple way to install is to use prebuilt packages from copr for Fedora or PPA for Ubuntu.
For Fedora:
$ sudo dnf copr enable polter/bumblebee
$ sudo dnf install bbswitchd
For Ubuntu:
$ sudo add-apt-repository ppa:polter-rnd/bbswitch-gui
$ sudo apt update
$ sudo apt install bbswitchd
After package installation please check that your user have been added to bbswitchd
group using groups
command, and then re-login or reboot the machine to apply it.
That simple.
First you have to install kmod
library and meson
build system.
If you need SELinux module, selinux-policy
developent package has to be installed as well.
For Fedora:
$ sudo dnf install kmod-devel meson # selinux-policy-devel
For Ubuntu:
$ sudo apt-get install gcc libkmod-dev pkg-config meson # selinux-policy-dev
Then build the daemon (in build
subdirectory). If you need SELinux module
(which is usually required for RHEL-based distributions such as Fedora),
add -Dselinux=enabled
option to meson build
command:
$ meson build # -Dselinux=enabled
$ meson compile -C build
To install a daemon on your system:
$ meson install -C build
If you have built SELinux module, you need to load it after installation:
$ sudo semodule -n -i /usr/share/selinux/packages/bbswitchd.pp
$ sudo /usr/sbin/load_policy
$ sudo restorecon -R /usr/sbin/bbswitchd
This step is not needed if you install prebuilt package from repository since it's done automatically by package manager.
After manual installation you need to create bbswitchd
group and add yourself to it:
$ sudo groupadd -r bbswitchd
$ sudo gpasswd -a $(whoami) bbswitchd
Then enable and start the socket:
$ sudo systemctl enable bbswitchd.socket
$ sudo systemctl start bbswitchd.socket
After re-login you should be able to use bbswitch
utility from your regular user.
$ bbswitch
bbswitch
Usage: bbswitch on | off | status
$ bbswitch on # Turn discrete GPU on
$ bbswitch status # Request current status
ON
$ bbswitch off # Turn discrete GPU off
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
This software is distributed under GNU GPL v3. See LICENSE file for more information.