sudo prime-select nvidia
log out and login again, hopefully you are
using the NVIDIA card. To switch back to te Intel card run sudo prime-select intel
(modesetting driver) or
sudo prime-select intel2
(Intel Open Source driver, requires xf86-video-intel package)./usr/sbin/prime-select get-current
.Option "AllowNVIDIAGPUScreens"
is already taken care of by intel X configs. You only need to set the __NV* environment variables. Check https://download.nvidia.com/XFree86/Linux-x86_64/435.21/README/primerenderoffload.html for more details.For detailed requirements of this feature see chapter "PCI-Express Runtime D3 (RTD3) Power Management", section "SUPPORTED CONFIGURATIONS" of NVIDIA driver's README.txt.
Recreate your initrd with some special settings, which are needed to enable DynamicPowerManagement and remove NVIDIA kernel modules from initrd, so some special udev rules can be applied to disable NVIDIA Audio and NVIDIA USB and make runtime PM for NVIDIA GPU active. This is needed as workaround, since NVIDIA Audio/USB currently cannot be enabled at the same time as NVIDIA GPU DynamicPowerManagement. This is easily done with:
test -s /etc/modprobe.d/09-nvidia-modprobe-pm-G05.conf || \
cp 09-nvidia-modprobe-pm-G05.conf /etc/modprobe.d
if [ ! -s /etc/dracut.conf.d/90-nvidia-dracut-G05.conf ]; then
cp 90-nvidia-dracut-G05.conf /etc/dracut.conf.d/ && dracut -f
fi
test -s /etc/udev/rules.d/90-nvidia-udev-pm-G05.rules || \
cp 90-nvidia-udev-pm-G05.rules /etc/udev/rules.d/
Powering off the NVIDIA card when not in use is very efficient for significantly decreasing power consumption (thus increase battery life) and temperature. However, this is complicated by the fact that the card can be powered off only when the NVIDIA kernel modules are not loaded.
bbswitch is the kernel module that makes it possible to power off the NVIDIA card entirely. Install it with:
zypper in bbswitch
The NVIDIA openSUSE package adds the NVIDIA driver modules to the kernel initrd image. This will make the system always load them on boot. This is problematic for disabling the NVIDIA card with bbswitch as it can only turn off the card when the modules are not loaded. Instead of unloading the modules before making use of bbswitch, the reverse is way easier: have the NVIDIA modules always unloaded and load them only when needed. To prevent the modules from being automatically loaded on boot, we need to blacklist them in initrd. This is easily done with:
if [ ! -s /etc/modprobe.d/09-nvidia-modprobe-bbswitch-G04.conf ]; then
cp 09-nvidia-modprobe-bbswitch-G04.conf /etc/modprobe.d && dracut -f
fi
This will also blacklist the nouveau
module which can really get in the way with Optimus and causing black screens.
if [ ! -s /usr/lib/systemd/system/prime-select.service ]; then
cp prime-select.service /usr/lib/systemd/system && \
systemctl enable prime-select
fi
sudo prime-select <driver>
Where <driver>
is one of:
intel
: use the modesetting
driverintel2
: use the intel
driver (xf86-video-intel) nvidia
: use the NVIDIA proprietary driveroffload
: use PRIME Render Offload (possible with >= 435.xx driver)Full command list available at sudo prime-select
/usr/sbin/prime-select get-current
Driver configured: intel
[bbswitch] NVIDIA card is OFF
To get more details on the Xorg driver, install package inxi
if necessary and use inxi -G
:
inxi -G
Graphics: Device-1: Intel UHD Graphics 630 driver: i915 v: kernel
Device-2: NVIDIA GP107GLM [Quadro P600 Mobile] driver: N/A
Display: x11 server: X.Org 1.20.4 driver: intel resolution: 3840x2160~60Hz
OpenGL: renderer: Mesa DRI Intel UHD Graphics 630 (Coffeelake 3x8 GT2) v: 4.5 Mesa 18.3.4
Unfortunately HDMI audio support needs to be disabled in order to have DynamicPowerManagement for the NVIDIA GPU available. This is being done by default in the SUSE package. In order to reenable HDMI audio support (BUT: disable again DynamicPowerManagement at the same time!) you need to comment out all the lines in the file /usr/lib/udev/rules.d/90-nvidia-udev-pm-G05.rules
, i.e. all lines need to begin with a #
sign.
In case you disabled HDMI audio support manually (i.e. probably not using a SUSE package) by following the section "NVIDIA power off support since 435.xxx driver with Turing GPU and later (G05 driver packages)" above you need to revert this step, i.e. remove again the file /etc/udev/rules.d/90-nvidia-udev-pm-G05.rules
.
When service is enabled, the script is capable to recognize following kernel parameters:
nvidia.prime=offload | nvidia.prime=intel | nvidia.prime=intel2 | nvidia.prime=nvidia
So is possible to have custom bootloader entries with all modes.