optimus-manager
optimus-manager copied to clipboard
Heavy stuttering on laptop LCD in Nvidia mode.
Description Everything (browser/games/video) rendered to my laptop's LCD is very sluggish and stuttery, with or without a compositor. Graphical apps reach the rated 120Hz, yet the drawing itself is problematic. When the external HDMI monitor is plugged in, the LCD's display synchs to its lower frequency as well on top of the stuttering. Using the HDMI monitor by itself, everything is nice and smooth as expected. Note: In Hybrid and Integrated mode, the Vega GPU handles everything wonderfully, but I get no HDMI output.
System info Manjaro 21 XFCE on lightdm fresh install. Asus TUF FX505DT (Ryzen 3750H, 2x8GB Kingstom DDR4 2400MHz, GTX 1650 4GB, 120Hz freesynch). optimus-manager 1.4-1 from Official Repositories. optimus-manager-qt 1.6.0-1 from AUR. Config at: https://pastebin.com/GmL5tPfi
Logs $ optimus-manager --status Optimus Manager (Client) version 1.4
Current GPU mode : nvidia GPU mode requested for next login : no change GPU at startup : nvidia Temporary config path: no
$ cat /var/log/optimus-manager/switch/switch-20210328T145849.log [7] INFO: # Xorg pre-start hook [7] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'nvidia', 'current_mode': 'nvidia'} [7] INFO: Requested mode is: nvidia [26] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf [27] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20210328T145849', 'requested_mode': 'nvidia'} [27] INFO: Xorg pre-start hook completed successfully. [7] INFO: # Xorg post-start hook [7] INFO: Running xrandr commands [271] INFO: Running /etc/optimus-manager/xsetup-nvidia.sh [284] INFO: Writing state {'type': 'done', 'switch_id': '20210328T145849', 'current_mode': 'nvidia'} [285] INFO: Xorg post-start hook completed successfully.
Hi, I'm pretty sure this is caused because optimus-manager uses the "modesetting" driver for the iGPU on nvidia mode even if you have an AMD iGPU. In order to activate PRIME Sync you need the "amdgpu" driver on the iGPU. You need to set the modeset=yes on [nvidia] section of the file /etc/optimus-manager/optimus-manager.conf and need to manually change the Driver from "modesetting" to "amdgpu" on /etc/X11/xorg.conf.d/10-optimus-manger.conf under the section integrated, then log out and log in. Unfortunately you need to change the 10-optimus-manager.conf every boot, because optimus-manager delete it every boot or whenever you switch mode.
One way to check if the iGPU have the correct driver is using inxi with the -G option. This should show you on the X11 section that the drivers loaded are amdgpu and nvidia.
The real solution should be implemented on the xorg.py, right now there's a pull request to do this #338, but it's been there since october 2020 with not much activity.
I tried your solution but the stupid optimus-manager resets my config file even at logout.
You're right, this program is deprecated and unmaintained.
EDIT: I got the configs to be immutable with chmod 555 and chattr +i I managed to boot in amdgpu mode on nvidia. There wasn't any stuttering, but instead a lot of screen tearing, even though nvidia-settings had it turned on. Thanks for your help but for the time being I quit on optimus-manager - it doesn't work on any of my or my friends' devices.
The screen tearing should go away with the option modeset=yes on the [nvidia] section on the file /etc/optimus-manager/optimus-manager.conf, or you can add nvidia-drm.modeset=1 to your kernel parameters. For me, nvidia-setting on X Server Display Configuration and having selected my PRIME Screen, shows that the synchronization is on.
Tried everything mentioned here but my screen just freezes after a couple of mins using the methods described here.
I've been having the samen problem. journalctl- f
indicates the following everytime it stutters:
May 22 12:24:31 manjaro /usr/lib/gdm-x-session[5747]: (II) event16 - SYNA2393:00 06CB:7A13 Touchpad: SYN_DROPPED event - some input events have been lost.
May 22 12:24:31 manjaro /usr/lib/gdm-x-session[5747]: (EE) event16 - SYNA2393:00 06CB:7A13 Touchpad: client bug: event processing lagging behind by 13ms, your system is too slow
Did some searches for a cause but I wasn't able to find a solution so far. It's only on nvidia mode but on hybrid and intel I have cursor glitches and a lot of glitchy things going on while scrolling.
No solution so far.
@DenisValcke have you tried another Desktop Environment? I also have had issue with gnome. Right now I use i3wm and it works flawlessly on all modes. (I use a patched version of optimus-manager with #338, this use AMDGPU instead of modesetting in nvidia mode).
Give i3 a shot and tell me how it went.
@Cherenkov11 tbh this is my work computer (company computer) so it's not a machine I use to tinker with. Setting up another desktop environment next to the existing one is something I don't feel comfortable with doing on this machine.
Going from every relared issue I can find, I think the problem is indeed related to mutter/gnome.
So I gave it a try. In i3wm:
- hybrid mode is smooth as butter
- nvidia mode does not work but I think that's because i3wm does not seem to like primaryGPU nvidia settings (at least that's what Google tells me).
Kind of weird, I use i3wm on nvidia mode basically always; I just switch to integrated mode when I use my laptop unplugged. What kind of error give you i3 when using nvidia mode?
No errors, just a black screen right after login (GDM) and no output to my external monitor. When I hit keys my keyboard lights up but that's about it.
On hybrid I logged in and saw the setup wizard no issues whatsoever.
Do you have the patched version of GDM that is needed for optimus-manager? I use LightDM, but I don't know if that makes a difference
Yes, I use the patched version of GDM.
Ok, in i3wm you need to configure the screens at the startup of the desktop, it's very likely that only the outputs that are connected to the nvidia GPU are enabled right now, but as you said this is not the case.
In my case, I have a script that executes after I start the session with lightDM, it configures the screens, it looks like this:
#!/bin/bash
xrandr --setprovideroutputsource 1 NVIDIA-0
xrandr --auto
xrandr --dpi 96
nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
xrandr --output eDP-1-0 --mode 1920x1080 --rate 144
xrandr --output HDMI-0 --mode 1920x1080 --rate 144 --right-of eDP-1-0 --primary
I think the first three lines are already executed by optimus-manager, but I put them anyway, they tell Xorg that the nvidia GPU will use the framebuffer of your iGPU as another screen, in my case I use number "1" because the name of the provider of the AMDGPU driver is very long, so I use just the number of the provider, in this case "Provider 1". If you have intel, you can use the word modesetting instead. The nvidia-settings line enables "Force Composition Pipeline" because i3wm does not have a compositor and this is needed to avoid screen tearing on the screens connected to the nvidia GPU. The nexts two lines of xrandr are the ones that configure the modes and layouts of my screens, I use the built-in screen of the laptop as secondary at the left and my external monitor at the right as my primary. If you are only using your laptop screen just use the first line with the appropriate mode and rate.
Extra note: I also use this file in /etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf
(I modified it to work with AMDGPU, but I think you have intel, so this is for it)
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
EndSection
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "/usr/lib/nvidia/xorg"
ModulePath "/usr/lib/xorg/modules"
EndSection
So after a bit of extra trail & error effort I made the following observations:
- Switched to Fedora 34 with Gnome 40 for a week and no optimus-manager or alternative, just nvidia as primaryGPU and done. No problems whatsoever. But since Fedora was giving me some issues with the VPN of a client and with Docker, I moved back. Rock solid distro btw.
- Switched back to Manjaro Gnome (clean install) and did no other things but installing with proprietary drivers and setting nvidia as my primaryGPU. Didn't install optimus-manager or anything, no modifcations or patched versions of Mutter, GDM, ...
After switching back to Gnome Manjaro and setting nvidia as primaryGPU, I noticed the weird scrolling glitches in my browser again, now together with the SYN_DROPPED event
lag and stutters. So this further validates my theory that this is an issue with Mutter + Nvidia drivers. I don't have optimus-manager installed and the issues persist.
In other words, I don't think optimus-manager has anything to do with these issues (as I mentioned before). That being said, I'm waiting for Gnome 40 to land in Manjaro to see if the issues go away like they did on Fedora. I'll get back to that when Gnome 40 hits stable.
Definitely Optimus-manager is not the culprit of this issue. I tried gnome 40 with no problem whatsoever on my Archlinux laptop. If you had the time you can try Arch, I don't know how well gnome is packaged on Manjaro but on Arch is very stable.
I'm now on the Manjaro testing branch which has Gnome 40. Going to try it out for a week.
Don't know about Arch. Seems so daunting to set up and always bleeding edge feels like a bit of a risk on a work computer. That's why I like Manjaro, rolling release but with a little "buffer".
Understandable to keep on Manjaro. In the 6 years that I've been using Arch I had only faced a couple of little issues with some updates, never a broken system, it's time consuming to set up at first when you install it, but after that is very stable. I usually update Arch ones a week and that has been working for me, but that's just my experience. Hope that gnome 40 fixs you issues.
Closing as a duplicate of:
- #498
Let's focus our efforts on cases related to "nvidia
mode is sluggish or choppy on laptop screen" concentrated on that case.
Have a nice week ahead