Leap 42.1 Optimus system with nvidia-prime instead of bumblebee

I used bumblebee with my Optimus laptop (i7-3630QM, Nvidia Geforce GTX 670MX) since 13.1.
It was troublesome to install, but it worked.
Now forum member bosim made the offer in his thread ‘Nvidia Optimus without bumblebee’ https://forums.opensuse.org/showthread.php/511230-NVIDIA-Optimus-without-bumbleebee
to transpose the prime mechanism I first heard of from ubuntu to Opensuse Leap 42.1.

I gave it a try during changing from 13.2 to Leap and it is working great, that is, the GPU performance is great.
The drawback had been the lacking mechanism to switch off
the Nvidia card from power, when using the intel power saving graphics.
But with bbswitch installed, you can handle this problem with two small scripts you have to call as root
after booting and before changing to Nvidia graphics.

Though the prime implementation is still experimental, I had no problems at all with stability or suspending when using intel graphics,
but also none with nvidia graphics. The system is awakening without problems.

  1. Fresh Leap 42.1 installation with KDE and Plasma 5.43, kernel 4.1.12-1-default x86_64.

  2. Installation of the appropriate Nvidia driver from http://download.nvidia.com/opensuse/leap/42.1
    via http://opensuse-community.org/nvidia.ymp
    I chose nvidia-glG04 for my GTX 670MX, with all dependencies chosen by Yast.

  3. Next I added http://download.opensuse.org/repositories/home:/bosim:/suse-prime/openSUSE_Leap_42.1/ to my repositories
    and installed suse-prime-0.1-8.1.noarch.rpm from there.

  4. According to this instructions https://build.opensuse.org/package/show/home:bosim:suse-prime/suse-prime
    I added in the script

 /etc/X11/xdm/Xsetup

after the line “. /etc/sysconfig/displaymanager” the following:

if  -f /etc/X11/xinit/xinitrc.d/prime-offload.sh ]; 
    then 
        . /etc/X11/xinit/xinitrc.d/prime-offload.sh 
    fi
  1. I tried prime-select as described there:
    ‘Run “prime-select nvidia” log out and login again, hopefully you are using nvidia GPU.
    To switch back to intel GPU run “prime-select intel” Remember to run as root.’
    This worked just fine and stable, also after rebooting.

But the power consumption was not as low as with bumblebee when just using the intel graphics.
bosim suggested using bbswitch and I tried this way successfully.

  1. I installed bbswitch and bbswitch-kmp-default from the main Oss repository
    and changed the default settings of bbswitch with
    nano /etc/modprobe.d/50-bbswitch.conf to:
options bbswitch load_state=1 unload_state=1

so that the discrete Nvidia graphics card gets switched on by bbswitch, when booting or shutting down the system.
This is important for initializing my GTX 670MX card correctly - learned from bumblebee troubles.

  1. There is a way to switch off the Nvidia card by manually changing /proc/acpi/bbswitch
    I am using therefore two scripts I call as root after booting, in order to power off the Nvidia card,
    or if I change to Nvidia graphics:

switchoffNvidia.sh

#!/bin/sh
modprobe -r nvidia_uvm nvidia
tee /proc/acpi/bbswitch <<<OFF

selectNvidia.sh

#!/bin/sh
tee /proc/acpi/bbswitch <<<ON
modprobe nvidia_uvm nvidia
prime-select nvidia
echo "Now you have to log out -> log in!"

Now with all scripts ready, this is my modus operandi:

  • Usually I am using the intel graphics for everyday work and there I am right after booting into my system.
    To reduce power consumption under intel graphics, I have to run as root the script switchoffNvidia.sh

  • If I want to play X-Plane with the Nvidia graphics on, I run as root the script selectNvidia.sh and log out from KDE and in again.
    Performance boost for glxspheres under Nvidia graphics from 248-250 frames/sec or Mpixels/sec with bumblebee
    to 1318.988993 frames/sec - 1471.991717 Mpixels/sec under prime.

  • to switch back to intel graphics I have to run as root

prime-select intel

,
then log out from KDE, log in again and run my script switchoffNvidia.sh as root to reduce power consumption.
Power consumption after switching off the Nvidia card is as low as with bumblebee using intel graphics.

Thanks to bosim for his work!

And thanks to you Brunolab for a great guide!

I hope a moderator will make this post sticky so people will see it.

Bo

I’ll move this thread to our Unreviewed How To and FAQ forum.

Hi Bo,

2 Things:

  • Things are working fine now on the weird Optimus implementation. NVIDIA must have changed something in the latest blobs, since nothing else had changed.
  • We tend to make only general stuff sticky, or stuff to prevent users from showstoppers.

If NVIDIA as fixed their blobs to work in an optimus machine that is news and should be first investigated then broadcast. This thread shows a way to use normal NVIDIA driver in without need of full bumblebee packages. It is worth a sticky since people that don’t know have been breaking their machines with the normal driver and really need some sticky to help.

Hi gogalthorp

This has merit IMHO. I’ve passed this suggestion on to mod team for evaluation.

The nvidia blobs has been reported to work fine on most machines. I only heard about one problem in the forum.

I agree, if I were a newbie installing LEAP i would be quite confused reading about this method after spending hours messing around with Bumblebee… This thing works in 2-3 steps however bumblebee requires more (from what I read).

I hope somebody is going to change the documentation on Optimus machines. I hope to have Tumbleweed support very soon.

Bo.

NB. I am happy people like it, openSUSE membership found my contributions too little to recognize it with a membership, I assume it means this has no value to them.

FWIW, I found the same when I tried to become a member a few years ago. They have quite a high benchmark it would seem. Anyway, your contributions here are most welcome and appreciated.

I probably should add to my guide of installing prime instead of bumblebee, that rebooting is not wise before completing step 5), that is after testing the prime-select procedure and before installing bbswitch in step 6). In fact I did reboot after step 5) and before continuing with step 6), installing bbswitch The installation of bbswitch and dependencies as described from step 6) on is only necessary for reducing the power consumption, it is not necessary to get prime-select running. If you don’t care about energy efficiency and you plan to always use the Nvidia graphics, you can stop after step 5).

Without knowing what else you do in the community, they tend to look at a longer period of time.

Now that I see this thread again, wouldn’t it be better if the package would add the (extra) lines to the Xsetup file? To get a situation where a user just installs the package, all changes related done by the package, f.e. even have ‘prime-select intel’ executed post-install etc etc.

I would like to avoid changing files provided by openSUSE packages. Instead some openSUSE maintainer should add Xsetup.d, this would be the right solution I guess.

Bo

Thank a lot you and bosim! This is what I was looking for! I am going to try it in my optimus laptop (ThinkPad 420).

But I do have question; my laptop has a mux, that is vai BIOS I could choose 3 regimesL:

  1. use discrete card only
  2. use intel graphics only
  3. optimus

So in dependence on my inotial choice the first step suggested by you:

  1. Fresh Leap 42.1 installation with KDE and Plasma 5.43, kernel 4.1.12-1-default x86_64.

will lead to a somewhat different installations… Should I choose 3. optimus or 1 or 2 ?

Sorry for troubling, yours chet

Prime, as bumblebee, are ways to make use of the Optimus architecture, which intention is power saving when
the Nvidia graphics card is not needed.

For having no graphics mux, I started with my pure Optimus architecture when installing prime.
This is your choice 3) in BIOS: Optimus.

Since installing prime, I got kernel, Nvidia driver, x-server and prime updated and had no problems at all.
Performance is much better than with bumblebee.

Changes with Nvidia driver 361.42:
Now apparently together with the nvidia module not only the nvidia_uvm module, but also the module nvidia_modeset are getting loaded.
Therefore the nvidia_modeset must also be unloaded before being able to unload the nvidia module and switching off the nvidia card altogether.
So the script **switchoffNvidia.sh **now should look like this:

switchoffNvidia.sh

#!/bin/sh
modprobe -r nvidia_modeset nvidia_uvm nvidia
tee /proc/acpi/bbswitch <<<OFF

With updated nvidia driver to version 367.27 the modules nvidia, nvidia_uvm, nvidia_modeset and nvidia_drm must get loaded to make prime-select work.
To switch off the Nvidia graphics it is necessary to first unload all these nvidia modules.
So the scripts selectNvidia.sh and switchoffNvidia.sh have to change:

selectNvidia.sh

#!/bin/sh
tee /proc/acpi/bbswitch <<<ON
modprobe nvidia nvidia_uvm nvidia_modeset 
modprobe nvidia_drm
prime-select nvidia
echo "Now you have to log out -> log in!"

switchoffNvidia.sh

#!/bin/sh
modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia
tee /proc/acpi/bbswitch <<<OFF

Works very well on my MSI GE72 2QC! Thank you Bo & Bruno!

Switching from Gnome to KDE made me re-think the way I use my optimus laptop. It’s always connected to the mains, so why not try Suse-prime to benefit from nvidia in the whole session.
So I started using Suse-prime last week and loving it. KDE is smooth and responsive. My son is loves the improvement over Bublebee when playing Minecraft. Thanks all for this alternative. Good first post also!.

Greetings,

Martin

Finally got my laptop working thanks to this guide… The main idea for my install is for work,not for gaming (I’ve got windows for that) so I want my nvidia card off all the time… Should I start the nvidiaoff script at boot? or after login? I currently have my script located at ~/bin/ is this correct? also how do I check if the nvidia card is really switched off? cause atm I don’t see much change in my battery life…

Either way - I’m quite happy this actually worked… It’s been a real pain to get any kind of linux working on this laptop… Clevo hardware with a GTX970m…

If you only want to use the intel grapchics you don’t have to do anything. Since kernel 3.12 the nvidia card is powered off on boot. To check you could power on the card with bbswitch and check the jump powerconsumpion.