Nvidia optimus: how can I use SUSE Prime project to turn off Nvidia GPU?

Working with another laptop with Nvidia optimus. Already installed drivers and prime stuff according to SDB:NVIDIA.

The articles suggest to follow this:
https://github.com/openSUSE/SUSEPrime
to properly power off Nvidia GPU when not in use to save power.

However I find myself unable to understand a single thing there. I have no idea how to do all the stuff described there.

Specifically:

—Install bbswitch: how exactly do I blacklist the bbswitch module?

—Blacklist the NVIDIA modules so it can be loaded only when necessary:
“Put this ‘if’ block in initrd”, how on Earth am I supposed to do that?

—Install the systemd services to set correct card during boot:
Where on Hell am I supposed to add that code block?

Oh and just additionally, regarding the PRIME Render Offload thing, in order to use it, is it a matter of just adding the __NV* environment variables before the application command in the shell?

Thanks.

P.S.: by the way, it’s funny how to be able to apply the changes with prime-select intel/nvidia one must forcibly log out and back in, and rebooting/powering off does not actually work…

Hi
I don’t use it, offload via switcherooctl or the env variable should work, what is the output from;


xrandr --listproviders

echo blacklist bbswitch > /etc/modprobe.d/blacklist-bbswitch.conf
mkinitrd

“Put this ‘if’ block in initrd”

README does not say it anywhere.

Where on Hell am I supposed to add that code block?

You execute these commands in interactive shell session or you create shell script with these commands and execute this script.

Ok, I’m sorry if I sounded rude; there was no need for sarcasm…

Of course README at that Github page says nothing at all.
Do you actually mean another README somewhere else? If not, could someone else here perhaps help with this, or should I try emailing the authors mentioned in the Github page?

That code block is meant to be automatically executed by some other “thing”, probably at boot… The page somewhat implies “modifying the initrd”, so perhaps that code would need to be added there… But how? The /boot/initrd-* is a binary, not plain text.

user2@localhost:~> xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x47; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 3; outputs: 5; associated providers: 0; name: modesetting
    output eDP-1
    output DP-1
    output HDMI-1
    output DP-2
    output HDMI-2
Provider 1: id: 0x1fb; cap: 0x0 (); crtcs: 0; outputs: 0; associated providers: 0; name: modesetting
user2@localhost:~>

If you already know all the answers why are you asking at all?

This code block is meant to be executed exactly once by you to place configuration files in the right location and to include them in initrd.

Hi
Are you booting with nomodeset in the kernel options?

Not by me, but initrd! That’s why I find it ridiculous that they explain nothing! Seriously, I’m already feeling a bit of slight hostility, perhaps due to already having “history” here…

user2@localhost:~> cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.14.21-150400.24.21-default root=/dev/mapper/system-root splash=silent resume=/dev/system/swap preempt=full mitigations=auto quiet security=apparmor
user2@localhost:~>

I don’t think so…