Problems with hybrid NVidia RTX 3070 in Linux

Hello,

I’ve got a problem using my Lenovo Legion 7 with Linux. I have to use nouveau, because I observe the following issues after switching to official drivers:

  • In “dynamic” mode my built-in display works fine, but the external monitor can’t be enabled. It is discovered by the system, but is always disabled.
  • In “discrete” mode both of the screens work fine, but my built-in screen has only one resolution (2560x1600), which is too small. I tried changing it using nvidia-settings, but all the changes reset after a reboot despite saving the x11 conf file.

I’ve described my issue in more details on Manjaro Forum (Lenovo Legion 7 - NVidia drivers not working properly with external display - Graphics & Display - Manjaro Linux Forum), but looks like this issue is not known to the community.

I’m happy to provide further information (whatever is needed and might help to sort out the problem).

Regards,
Alojzy

Please switch to hybrid mode. Please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post.

Hi,

Thanks for the quick response.
I’ve switched to hybrid mode and installed video-hybrid-amd-nvidia-prime driver.
Unlike previously, this time my external display works fine, but the built-in screen is not even discovered.

I attach the bug-report file
(deleted by the author with comment: no longer relevant)

Please delete
/etc/X11/xorg.conf.d/90-mhwd.conf
/etc/X11/xorg.conf

Wow, that’s quick. Thanks :).

I’ve followed the hints and restarted my machine.
Now I’m back to the previous state, i.e. my built-in screen works fine, but the external monitor is discovered, but can’t be enabled, so doesn’t work.
Shall I rerun the script with this configuration?

Yes.

Sure, here it is.
(deleted by the author with comment: no longer relevant)

Please set kernel parameter
nvidia-drm.modeset=1
After reboot and login, please run
xrandr --setprovideroutputsource 0 1 && xrandr --auto
If that enables the monitor, you might either add that to autostart or install some optimus manager.
https://wiki.archlinux.org/title/NVIDIA_Optimus#Display_managers

Sorry, wrong command for your setup, should be
xrandr --setprovideroutputsource1 0 && xrandr --auto

Hi,

Thanks for the hints.

To be honest, I’m told to set kernel parameters for the first time, so not sure I know how to do this.
I restarted my machine, in GRUB menu I hit “e” and appended the line you mentioned to the end, then I hit F10.

Is that correct?

If so, then running…

xrandr --setprovideroutputsource 1 0 && xrandr --auto

(I think you forgot a space between “…source” and “1”)

…executes with error:

❯ xrandr --setprovideroutputsource 1 0 && xrandr --auto
xrandr: Configure crtc 4 failed

EDIT

I’ve just edited /etc/default/grub and added the following line:

GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1"

Then I ran sudo update-grub and rebooted.
After a reboot both screens are enabled.

I’ll spend some time playing with it to see if there’s anything else that needs improvement. I’ll let you know tomorrow.

EDIT 2

I confirm that the new kernel parameter has been successfully added:

❯ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.19-x86_64 root=UUID=9efecacd-fae6-4ed8-a120-f610bbc9eb3b rw nvidia-drm.modeset=1 quiet splash apparmor=1 security=apparmor udev.log_priority=3

Actually “toromorrow” is too long. I’ve found the first glitch now.
Some of the apps (e.g. Signal App or GNOME Settings window) need about 10s to process my input (i.e. when I start typing in Signal, I need to wait about 10s before the letters show up).
This happens only when the window is shown on my external display. As soon as I drag it back to my built-in screen, it works normally.
Also, there are no delays in dragging windows. Finally, there are apps that work just fine. E.g. I’ve been typing this post with my Firefox on my external screen.

Does the input appear if you type, then move the window?

Yes, as soon as it leaves the external display.
I’ve just installed optimus-manager. After the installation and a reboot it disabled my external screen, but as soon as I executed optimus-manager --switch hybrid everything looks much nicer.

Odd. Actually, I never heard of such an effect. In hybrid mode, the desktop is rendered on the amd gpu and then the picture is just pushed to the nvidia video memory for display. Don’t even know whether this might be an xorg bug or a toolkit one.

:)
Anyway, the problem seems to go away after installation of the optimus-manager from here: GitHub - Askannz/optimus-manager: A Linux program to handle GPU switching on Optimus laptops.

The only problem is that I need to execute optimus-manager --switch hybrid manually after every reboot. Without this only my built-in screen is enabled.
Is there a way to set a default mode for optimus-manager?

I use GNOME / GDM and I’ve installed gdm-prime and followed the instructions for GDM.

https://github.com/Askannz/optimus-manager

You can also specify which GPU you want to be used by default when the system boots, by setting startup_mode in the configuration file at /etc/optimus-manager/optimus-manager.conf

Did you set any xrandr commands? Setting the wrong ones for your mode can lead to odd behaviour and delays.

You can also specify which GPU you want to be used by default when the system boots, by setting startup_mode in the configuration file at /etc/optimus-manager/optimus-manager.conf

Great, thanks. That works for me.
I’m a bit tired, I miss the crucial parts that are there right in front of me :).

Did you set any xrandr commands? Setting the wrong ones for your mode can lead to odd behaviour and delays.

Only the one that you suggested.

❯ xrandr --setprovideroutputsource 1 0 && xrandr --auto

Now everything looks good. I’ll try installed a game via Lutris to see if it works :).

Hi,

Everything looks as expected, thanks for the help.
To sum up, in my case it turned out to be needed to:

  • In BIOS switch my graphics card to “dynamic” (~hybrid) mode.
  • Remove /etc/X11/xorg.conf.d/90-mhwd.conf and /etc/X11/xorg.conf.
  • Set kernel parameter: nvidia-drm.modeset=1 (add GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1" to /etc/default/grub/ and run sudo update-grub).
  • Install optimus-manager and switch it to hybrid mode (this can be achieved either by the qt client, or manually in the app’s config file).

Some of the games I tried failed with error messages failed to initialize nouveau, but I guess that’s a matter of configuring lutris/wine correctly. I don’t have time for this right now and it goes beyond of the scope of the initial problem.

Many thanks for the help. Much appreciated!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.