20.04 - 5900hx + 3060 (blade 14 2021), need help configuring optimus

Hello!
I’m configuring the laptop to run Deepstream, and I made it work - the samples did run fine.
However the laptop definitely ran on nvidia gpu only (battery was dying fast) + either laptop or external hdmi displays did not work, depending if I leave the hdmi cable plugged.

I’ve searched the forums and I’ve followed some guides to try and make things work.
like this one:
nvidia-xconfig doesnt do what i want it to, nor does nvidia-settings - Graphics / Linux / Linux - NVIDIA Developer Forums

but without any luck. suggestions often include modifying files called 10-nvidia.conf etc. but I don’t have those.
xorg.conf.d is empty.

I did install the driver from ‘graphics-drivers’ repository: 510.73.05 (deepstream 6.1 guide insists on 510.47.03, but this one I was only able to find .run version - which I think is not going to work in my case, as explained by @generix)

I also tried to install amdgpu driver from the official repo, just to see what happens and the machine stopped booting at all, not even letting me into the console mode. So I had to remove the amd driver from recovery console.

So I could really use some assistance with getting the laptop to work with amd gpu + perform offload to nvidia for deepstream-related stuff.

nvidia-bug-report.log.gz (302.3 KB)

According to the logs, the nvidia gpu is in offload mode and suspended, off.
Please use only prime-select to switch modes, amd/nvidia combos are well supported by ubuntu.
On some notebooks, runtime suspend doesn’t work, please use powertop to check powerdraw, nvidia-smi/nvidia-settings will wake up the gpu, to check the current state use
cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status
Please check for a bios update.

Please check if setting kernel parameter
nvidia-drm.modeset=1
helps with the external monitor.

Ok nvidia-drm.modeset=1 does not seem to change anything.

the runtime_status file does report ‘suspended’. the status becomes active for a few seconds after I run nvidia-smi, then goes back to suspended.
powertop shows amd on top, and nvidia has ~100mW only when the monitor is plugged in.

oh and the monitor works if I first wake up the gpu using nvidia-smi, and them immediately plug-in the hdmi cable. Or if I plug-in within a few seconds after os startup.
So I’m assuming the monitor only runs on nvidia gpu. Which is fine, but if we could make it wake up automatically on cable connection - it would be good.

Plugging in the hdmi cable should wake up the nvidia gpu, unless your notebook’s bios has some flaw. Please check if the runtime_status changes on plugging and only the driver doesn’t pick up the display.

runtime_status stays suspended, tried a few times.
supposed to be the latest bios, but I can try to downgrade or maybe re-flash the same version.

another super-weird thing is when I close the lid and only run external monitor I get probably 1-2 fps on it.

upd: oh, and it just occured to me to test this. But this is a dual-boot machine, and in win11 hdmi connection works perfectly fine. It probably does something completely different from linux, but I thought it was worth mentioning,

Please use acpi_listen to check whether an acpi event gets emitted by the bios on plugging the hdmi cable.
The 1 fps issue is know, I just can’t remember how to circumvent it, maybe I can refind the thread.

ok I’m getting no acpi events when nvidia is suspended,
but if I wake it up - I see jack/lineout, jack/videout

from some experimentation:
if I add Option “PrimaryGPU” “Yes” to 10-nvidia.conf
(and yes, I found these config files, sorry, my bad - didn’t realize they were in /usr/share, not /etc)
then:
1fps issue gets fixed and monitor always works.
but nvidia stops suspending - always active even with hdmi disconnected

upd: also when on external monitor I’m getting super high cpu usage for Xorg, 40-60% sometimes, when I move windows around. (immediately drops when I disconnect)

Don’t fiddle with the system’s config files. You could have achieved the same running
sudo prime-select nvidia
In that mode, the nvidia gpu is expected to not go into suspend since it then renders everything.
The 1fps issue is a bug in the amdgpu DDX, fixed just recently:
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/-/merge_requests/75
So I guess you need the latest Xorg server/ amdgpu DDX, likely only available in 22.04 currently.

Though that doesn’t explain why the nvidia gpu doesn’t get turned on on plug-in.

I see, that’s unfortunate.
But at least I know what’s going on.
This has been a lot of useful information, thank you so much for your help!

Another workaround might be using the modesetting driver instead of the amdgpu driver (by fiddling with the system config files), the downside of that would be tearing while using the nvidia gpu.

1 Like