Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Moderator: Forum moderators

Post Reply
User avatar
bigpup
Moderator
Posts: 6271
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 732 times
Been thanked: 1292 times

Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by bigpup »

Ultimate guide to Nvidia Optimus on Linux
https://www.reddit.com/r/linux_gaming/c ... a_optimus/

There are laptops that have the Intel integrated graphics and also a separate Nvidia graphics card.
The idea with this setup.
For normal low demand graphics, the Intel graphics hardware is used.
For high demand graphics, it auto switches to using the Nvidia graphics hardware.

Puppy Linux is not setup to do the graphics hardware switching.
Puppy always uses the Intel integrated graphics hardware.

If you have a laptop setup this way.
Maybe this info can help you, to get it working in Puppy Linux.

Read the following posts, to get some good information on how to get it working, in Puppy Linux.

Note:
I do not have a laptop with duel Intel and Nvidia graphics hardware. So, no help from me.
If you have this type setup, on your laptop, and can get it working in Puppy.
I will help to make this a how to, for others to use.
Do you have a laptop, with this setup for graphics hardware, and want to try to get it working in Puppy????

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
nocsak
Posts: 23
Joined: Thu Mar 04, 2021 10:32 pm
Location: Hungary
Has thanked: 4 times
Been thanked: 10 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by nocsak »

Hello!

Please excuse me, if I wrote to the wrong topic, but at this moment I've found a working solution to solve Puppy Linux with Dual (Hybrid) Graphics with intel-nvidia GPUs or any if that has kernel compiled vgaswictheroo yes (enabled).

Now I'm using on a 32 bit bionic variant called NosPup32 with this kernel https://sourceforge.net/projects/lxpup/ ... 2/download. And a custom fdrv especially for 5++ kernels: https://sourceforge.net/projects/puppys ... s/download on a Hybrid Grpahics notebook.

Here is the main article as source:

https://help.ubuntu.com/community/HybridGraphics

So, if we have add nomodeset or XXX.modeset=1 in kernel line in bootloader, then vgaswictheroo will be enabled in system. In my case I have used nouveau.modeset=0 for long time but it is only let x server to run, but is not solve vgaswitcheroo!
After I replaced nouveau.modeset=0 kernel parameter to

Code: Select all

i915.modeset=1

it still let X server to start but now with vgaswictheroo enabled.

The main attraction is to mount debugfs manually (as root), because puppy isn't do it:

Code: Select all

mount -t debugfs debugfs /sys/kernel/debug

After this, we now check if vgaswitcheroo exists:

Code: Select all

cat /sys/kernel/debug/vgaswitcheroo/switch 

If it does, then we can now turn inactive discrete GPU OFF by this command:

Code: Select all

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

To make it permanent we should write this method into a shell script, and place it where it can start at boot. Currently I am testing this solution.

additional sources:

https://lwn.net/Articles/323307/

scshot.jpg
scshot.jpg (9.44 KiB) Viewed 1927 times
User avatar
Phoenix
Posts: 339
Joined: Fri Feb 12, 2021 2:03 am
Location: Canada
Has thanked: 4 times
Been thanked: 48 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by Phoenix »

You can place this script into /etc/init.d and then enable it through Boot Manager, or make it executable via chmod +x

IRC: firepup | Time to hack Puppy!

User avatar
nocsak
Posts: 23
Joined: Thu Mar 04, 2021 10:32 pm
Location: Hungary
Has thanked: 4 times
Been thanked: 10 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by nocsak »

Thanks!

I've placed the following script into /etc/init.d and after reboot it seems working:

Code: Select all

#!/bin/bash


if [[ "$(mount | grep debugfs)" != "" ]];then

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch


else



mount -t debugfs debugfs /sys/kernel/debug

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch


fi

exit 0

made it with executable permission and named to vgaswitcheroo.

But don't forget to add in this case in bootloader's kernel line as parameter if you have intel GPU:

Code: Select all

i915.modeset=1
User avatar
nocsak
Posts: 23
Joined: Thu Mar 04, 2021 10:32 pm
Location: Hungary
Has thanked: 4 times
Been thanked: 10 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by nocsak »

Hi all!

Just a completion for those, who are using modern hardwares, there is a kernel line parameter to disable this kind of kernel error reporting, because mass of error messages in dmesg:

Code: Select all

pci=nomsi,noaer

sources:

https://askubuntu.com/questions/726100/ ... y-downside

This problem especially on the machine which has Hybrid Graphics.

User avatar
nocsak
Posts: 23
Joined: Thu Mar 04, 2021 10:32 pm
Location: Hungary
Has thanked: 4 times
Been thanked: 10 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by nocsak »

Hello again!

Regarding to my last post about pci=nomsi,noaer ....
I've found the aimed solution for my specific hardware-set by this article:

https://unix.stackexchange.com/question ... er-bad-tlp

I have this kind of AER messages in dmesg which are make it full of with this:

Code: Select all

pcieport 0000:00:1d.6: AER: Corrected error received: 0000:03:00.0
alx 0000:03:00.0:   device [1969:10a1] error status/mask=00000080/00002000
alx 0000:03:00.0:    [ 7] BadDLLP 

But when I applied kernel line parameter in bootloader's kernel line:

Code: Select all

pci=nommconf

Then everything looks fine after booting puppy!

Not just fine, my iwlwifi module can drive the inbuilt intel wireless card now without causing sudden freeze. Quoting from original article:

The kernel option pci=nommconf disables Memory-Mapped PCI Configuration Space, which is available in Linux since kernel 2.6. Very roughly, all PCI devices have an area that describe this device (which you see with lspci -vv), and the originally method to access this area involves going through I/O ports, while PCIe allows this space to be mapped to memory for simpler access.

That means in this particular case, something goes wrong when the PCIe controller uses this method to access the configuraton space of a particular device. It may be a hardware bug in the device, in the PCIe root controller on the motherboard, in the specific interaction of those two, or something else.

I hope it can help on others who have special/advanced or modern hardwares depending on this error under Linux.

User avatar
nocsak
Posts: 23
Joined: Thu Mar 04, 2021 10:32 pm
Location: Hungary
Has thanked: 4 times
Been thanked: 10 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by nocsak »

Greetings to all again!

I have good news today. As the above mentioned problems was disappeared in EasyOS Dunfell version 4.2.2 and 4.2.3 then I wrote about this here in the forum: viewtopic.php?p=61587#p61587

So with this EasyOS dotconfig I recompiled that version numbered kernel (k5.15.49) with some extra features in it for puppy with Woof-CE kernel-kit and the dmesg is still has no any errors now with this.
If anyone interested in this kernel or dotconfig, here can be found those.

I hope it can help on others also and not only for me with Hybrid Graphics notebbooks!

User avatar
nocsak
Posts: 23
Joined: Thu Mar 04, 2021 10:32 pm
Location: Hungary
Has thanked: 4 times
Been thanked: 10 times

Re: Guide to Nvidia Optimus on linux (laptops with both Intel and Nvidia graphics)

Post by nocsak »

Hello!

I'm just leave this picture here. (I think it's still quite talkative.)

DRI.jpg
DRI.jpg (88.9 KiB) Viewed 1190 times

Used kernel.

Used firmware.

With this kernel no additional kernel line parameter required.

Original article.

Post Reply

Return to “Graphics/Video”