Mouse lag/stutter (missed frames) in Wayland sessions

Bug #1982560 reported by francesco
228
This bug affects 53 people
Affects Status Importance Assigned to Milestone
mutter (Ubuntu)
Fix Released
Undecided
Daniel van Vugt

Bug Description

Mouse lag on fresh install of ubuntu 22.04 LTS (wayland). This problem didn't occur in previous version of ubuntu based on xorg.

Specifically, frequent mouse lag when I turn on the pc, when I unlock the pc or when heavy operations are done on it.
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu82.3
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
DisplayManager: gdm3
DistroRelease: Ubuntu 22.04
InstallationDate: Installed on 2022-11-13 (50 days ago)
InstallationMedia: Ubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 (20220809.1)
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
Package: gnome-shell 42.5-0ubuntu1
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 5.15.0-56.62-generic 5.15.64
RelatedPackageVersions: mutter-common 42.5-0ubuntu1
Tags: jammy wayland-session
Uname: Linux 5.15.0-56-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
_MarkForUpload: True

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Libera.chat.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1982560/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu:
status: New → Confirmed
Revision history for this message
Andi Dhimitri (andialb) wrote :

I have to add that this bug is affecting me as well. Generally after I enter my password the mouse freezes for some seconds (10-20). I have also done a fresh install.

Revision history for this message
francesco (u-user-prop) wrote :

I have noted also that, when viewing video with VLC, the mouse is slower and not so smooth as it was before the opening of the video. When I close the video, the problem disappear

Revision history for this message
Arnaud Chéritat (a-cheritat) wrote :

I am affected too. Mouse lags as soon as it files over UI elements. I am seriously considering rolling back to 20.04.

Dell Latitude 7490, Ubuntu 22.04 up to date as of yesterday.

Revision history for this message
francesco (u-user-prop) wrote :

I also note keyboard slowness and RAM full after leaving the pc in "suspend mode" for a few days.

See https://bugs.launchpad.net/ubuntu/+bug/1983720

Revision history for this message
km (unknownerror22) wrote :

Have this bug too and it also affects the mouse scroll wheel. The conditions are the same as the other reporters. Intel i7-8k,32gb ram,nvme ssds.

Revision history for this message
Shuhao (shuhao) wrote :

This is definitely a wayland-specific issue. Xorg doesn't have this problem for me.

Revision history for this message
Adeel Hasan Akbari (adeelx) wrote :

Affects me on a fresh install of Ubuntu 22.04 LTS, mouse starts lagging randomly when browsing using Firefox or doing routine tasks.

Revision history for this message
Shraman (shraman23) wrote :

This affects me too on fresh install of Ubuntu 22.04 LTS. I do have nvidia graphics card and am using wayland.

Revision history for this message
Antony Brisson-Gironne (abgironne) wrote :

I am also affected by this issue (if it's the same issue). It started after I upgraded 20.04 to 22.04 (I was also using Wayland in 20.04).

It seems to happen when gnome has to redraw elements in the screen. For example, I had to remove the seconds from displaying in my time display on the top panel and all the extensions that were printing information also on my top panel because each top panel redraw was freezing my pointer. It's also getting worst after a while until I reboot. After two days I need to reboot my computer because it becomes so annoying I can't use my computer anymore.

I notice that by increasing the polling rate of my logitech mouse in Solaar from 1ms to 8ms it really helps to reduce the stutter (thanks to a reddit post). So this is the work around I use in the meantime and hopefully I will be able to use my computer without a reboot for a couple of work days.

Revision history for this message
Will Bradley (bradley-will) wrote (last edit ):

I also can hardly use my computer after upgrading from Ubuntu 21 to 22. I disabled indicator-multiload because not only was that the obvious problem from previous versions but also the new taskbar made it useless (and the problem far worse) but even still every 3-10 seconds I get USB mouse and USB keyboard lag to the point where clicks aren't registered, mouse movements stutter, and keypresses are ignored or repeated. (I've had to edit this message twice so far bbbbecause ottttherwise it will loooook like thisssss.)

With 7513mb of RAM total I have only 884mb free, 27% of which being used by gnome-shell. Only programs open are Firefox (5 tabs) and sublimetext (using 0% cpu and 2% memory despite 3 windows with innumerable tabs each!)

The problem still seems to exist even after unplugging all USB devices and using my laptop's builtin keyboard and trackpad. I'm unsure what the problem could be.

Dell XPS13 L322X, i7-3537U CPU @ 2.00GHz × 4, 7.4 GiB, Intel graphics

Revision history for this message
francesco (u-user-prop) wrote (last edit ):

Hi Will Bradley, thanks for add also your version of the problem. I think you can also look at this other bug: https://bugs.launchpad.net/ubuntu/+bug/1983720

Maybe your are affected as well.

Revision history for this message
Will Bradley (bradley-will) wrote (last edit ):

Update: logging in with "Ubuntu on Xorg" instead of the default Wayland seems to have reduced or eliminated the problem and made the GUI far more responsive overall (no lag when snapping windows to the left/right/full size, etc.)

Revision history for this message
francesco (u-user-prop) wrote (last edit ):

I also noticed huge improvements after logging in with Xorg.

I thing that based on this comments and other posts on reddit, the implementation of Wayland is the cause of this annoying bug.

Anyone know how to notify the right people in order to resolve the issue?

Revision history for this message
RichardJECooke@protonmail.com (faranta) wrote (last edit ):

My mouse also lags when a few apps are open in Ubuntu, can't figure out which one is causing it. (But I know the wallpaper app, Variety, definitely made it worse)

I can't test in XOrg because it doesn't detect my monitors correctly.

However a week ago before I had switched from Kubuntu to Ubuntu, KDE on Xorg had no mouse lag or problems at all.

Revision history for this message
Ron Belcher (rbelcher3) wrote :

It affects me too. Also the scroll wheel gets confused, can't always depend on it knowing whether to go up or go down.

Revision history for this message
francesco (u-user-prop) wrote (last edit ):

for @rbelcher3 and the other users affected, I've completely resolved the mouse lag and the overall stuttering of the system with a simple action: change the display server to Xorg.

It's a simple action to do (you can try it during the login, and if it works, disable Wayland permanently.)

Is it a easy fix? Yes

Should the ubuntu team solve this issue with Wayland since it is the default display server? ABSOLUTELY

Revision history for this message
Sergei (markovs-i-mail) wrote :

It's not an easy fix since there's not gesture support on Xorg.

Revision history for this message
RichardJECooke@protonmail.com (faranta) wrote :

@francesco. It's not an easy fix. Gnome isn't designed to work with Xorg, like KDE isn't designed to work with Wayland. If you try swap them all kinds of errors occur with apps, windows, monitors.

Until this bug is fixed Ubuntu is basically unusable for a lot of people. Switching to Kubuntu is the only option.

Revision history for this message
francesco (u-user-prop) wrote :

@faranta I meant that it was an easy fix for me! Also, I used ubuntu for a couple of years and I have never had a problem with Gnome + Xorg. Instead, with 22.04 (Wayland as default) my mouse lagged! My mouse ...

Revision history for this message
Pankit Kapadia (pankit) wrote :

Hello team,

There is some serious issue with the mouse scrolling on Ubuntu 22.04.

When I start scrolling on any page, it gets automatically scrolled up or down to random section of the file. I am already using Xorg and I confirmed the same issue from one of my colleague who is also facing the issue after upgrading to Ubuntu 22.04.

tags: added: jammy
tags: added: performance
affects: ubuntu → mutter (Ubuntu)
tags: added: latency
tags: added: wayland wayland-session
summary: - Mouse lag on fresh install of 22.04 LTS
+ Mouse lag/stutter (missed frames) in Wayland sessions
Revision history for this message
Daniel van Vugt (vanvugt) wrote (last edit ):

There's theoretically a reason that the triple buffering patch could cause the cursor to skip frames:

  https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441#note_1568056

Although that's for CURSOR-ONLY FRAME SKIPS. If your whole screen is skipping the same frame then we're waiting for a larger mutter rework (v44 or v45) in which cursor movement is able to complete separately from screen redraws. That's what Xorg does.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

francesco, please try adding this to /etc/environment and then reboot:

MUTTER_DEBUG_ENABLE_ATOMIC_KMS=0
MUTTER_DEBUG_FORCE_KMS_MODE=simple

Changed in mutter (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
francesco (u-user-prop) wrote :

Hi Daniel, thanks! Currently testing these options. It would be helpful if others would do the same.

Revision history for this message
Andreas Hoornstra (andreas-2002) wrote :

Hi Daniel and Francesco, neither of the two options given seem to work in my case. Hardware: Dell XPS Plus 9320 (i7 1260P, 32GB RAM, 1TB SSD, 4K+ 60Hz 500 nit LCD). Software: Ubuntu 22.04 LTS. If more information is needed, feel free to ask. I think I'll switch back to X11 and maybe try Touchégg to still get gesture support, as X11 works a lot smoother.

Revision history for this message
francesco (u-user-prop) wrote :

Hi Daniel, after few days of testing I can say that with these options the problem is much less evident, but still present.

Indeed, I have fewer lag and stutter (the system now is usable also with wayland session, before that option it was not) but it is not as fluid as Xorg. When I unlock the pc, a few frame missed are always present. Overall this is a progress, but in my opinion not a general solution.

francesco (u-user-prop)
Changed in mutter (Ubuntu):
status: Incomplete → Confirmed
status: Confirmed → New
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

francesco,

Please provide some details about your system by running:

  apport-collect 1982560

affects: mutter (Ubuntu) → gnome-shell (Ubuntu)
Changed in gnome-shell (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
francesco (u-user-prop) wrote : Dependencies.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
francesco (u-user-prop) wrote : GsettingsChanges.txt

apport information

Revision history for this message
francesco (u-user-prop) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
francesco (u-user-prop) wrote : ProcEnviron.txt

apport information

Revision history for this message
francesco (u-user-prop) wrote : ShellJournal.txt

apport information

Revision history for this message
francesco (u-user-prop) wrote : monitors.xml.txt

apport information

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

francesco,

I think the reason you find Xorg is more fluid might be because you're using two GPUs (Intel + AMD) and mutter's Wayland handling of secondary GPUs is sometimes inefficient. To prove that is the issue, you can try unplugging the external monitor(s) and just compare the laptop screen performance in Wayland vs Xorg.

Changed in gnome-shell (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Mike (delgonna) wrote :

I have same bug with clean install of Ubuntu 22.04.01 LTS. I did a reinstall as I assumed a couple of bugs were caused by kernel updates and other non-standard settings, seems not. Problems were the same on 22.10. This one with pointer becoming laggy after maybe a couple hours and maximized windows appearing behind the dock after coming out of suspend.

Using X11 seems to solve both issues but there's some stuff I like about Wayland.

HP Laptop - 15s-fq1xxx
Intel® Core™ i5-1035G4 CPU
Mesa Intel® Iris(R) Plus Graphics (ICL GT1.5)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Comment #36 reminds me this bug might be a red herring for some. If the OP is using dual GPUs then that alone might be the cause of their problem. Mutter Wayland sessions don't handle dual-GPU-dual-monitor setups efficiently...

francesco: Please try a single monitor setup and tell us if the problem persists.

Everyone else: Please always start by reporting your own separate bugs.

Changed in gnome-shell (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Scott Carey (sputnik78) wrote :

I tried the lines:

MUTTER_DEBUG_ENABLE_ATOMIC_KMS=0
MUTTER_DEBUG_FORCE_KMS_MODE=simple

in /etc/environment as suggested.

It does not help. Or it did not help much. I think the keyboard lag might be less prevalent, but the mouse is still problematic.

My symptoms remain the same:

1. everything is fine right after the window manager starts
2. After between 1 and 4 days (depending on usage), the mouse starts to skip and lag and stutter. During this condition, moving the mouse in small circles is enough to send 'gnome-shell' CPU use to 100% and cause updates to the display to stall or pause for long intervals, sometimes many seconds, until I take a break with the mouse movement -- for example Gnome System Monitor won't update its contents or rarely will, until I pause the mouse movement. I am using the integrated GPU on my laptop in this case (no discrete GPU, Ryzen 4750U processor). 'radontop' indicates about half of the 2GB memory reserved for the GPU is used, and GPU usage drops to 0% during the stalls.
3. If I log out of my user and log back in, everything is back to normal, for a few days.

Switching to xorg fixes it (but causes other problems).

I recently updated to 22.10 to see if that helped, it does not.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Scott,

Please open a new bug by running:

  ubuntu-bug gnome-shell

so that we can investigate your system separately.

Revision history for this message
Ciprian Pascu (ciprianpascu) wrote :

I have the same issue with ubuntu 22.10 on Acer swift 5 when the resolution is 1920x1200. The jitter/shutter happens on the lower end of the screen. If I lower the resolution, everything gets back to normal. Also, this behavior takes place no matter what tool I use to move the mouse -> touch pad or Microsoft mouse.

Kind regards,
Ciprian

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Everyone please open your own bugs by running:

  ubuntu-bug gnome-shell

or if that fails go to https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+filebug

I'm moving this bug to private to avoid further potentially unrelated comments.

information type: Public → Private
Revision history for this message
francesco (u-user-prop) wrote :

Hi Daniel! It's been a bit since I have switched to wayland with the options in /etc/environment you listed before.

One thing that I notice is the overall drop in system robustness: frequent app crash, system freeze (especially when in zoom call with multi screen, etc.

I did not have this crash before.

Trying to isolate the problem, I revert to X11 for a while. I will get in touch.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

No problem. The bug won't close unless there are no comments for two months straight.

The /etc/environment options previously mentioned will not cause app crashes, you need to report those separately. Full system freezes might be related but the options I recommended usually fix a lot more problems than they cause. And I know of no confirmed problems that they cause.

For app crash and each system freeze you encounter please open new bugs so they can be investigated separately.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gnome-shell (Ubuntu) because there has been no activity for 60 days.]

Changed in gnome-shell (Ubuntu):
status: Incomplete → Expired
Revision history for this message
francesco (u-user-prop) wrote :

re-opened due to some recent activity

Changed in gnome-shell (Ubuntu):
status: Expired → Confirmed
information type: Private → Private Security
information type: Private Security → Public
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If you're still experiencing problems here then please try:

  CLUTTER_PAINT=disable-dynamic-max-render-time

in /etc/environment

Revision history for this message
Eimis (eimantas-es) wrote (last edit ):

I think this issue affected me too, on Ubuntu 23.04 (Wayland). And it seems that adding:

MUTTER_DEBUG_ENABLE_ATOMIC_KMS=0
MUTTER_DEBUG_FORCE_KMS_MODE=simple

to /etc/environment

improved the behavior and responsiveness of mouse cursor.

Revision history for this message
Tomas Mrozek (u-mail-j) wrote :

I tried the latest suggestions of "CLUTTER_PAINT=disable-dynamic-max-render-time" as well as "MUTTER_DEBUG_ENABLE_ATOMIC_KMS=0..." but neither of it helped. I had to go back to using Xorg.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If your cursor is skipping frames then I think the main fix for that is coming in mutter 45:
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679

Although I hope we can figure out a simpler patch to backport to 44. The issue is described in:
https://gitlab.gnome.org/GNOME/mutter/-/issues/2459

Frame skips in Wayland sessions on non-Intel GPUs might also need mutter 44.1 (like with bug 2017097).

If your cursor is smooth but just one frame higher latency then I am working on bug 2023363 for that.

Revision history for this message
jnygaard (jens-olav-nygaard) wrote :

Probably nothing... but...
I got here searching for a solution to my problem, which sounds very much like what is described here, except that I don't use Wayland. Freshly installed Ubuntu 22.04, running Xorg and Fvwm2. I notice some 2-10 sec. freezes, both for mouse and keyboard (at the same time.) Cannot say that I have seen a definitive pattern yet, but I somehow get the feeling that it has to do with USB, don't know why. (Logitech mouse and keyboard combo sharing a dongle.)

Revision history for this message
jnygaard (jens-olav-nygaard) wrote :

Must correct myself. Now the keyboard locked up for about 10 seconds while the mouse was ok. Sigh. Happened just when I opened an image file (png format) with 'feh'. No idea if there is a connection.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

That shouldn't be discussed here because this bug is about gnome-shell and Wayland only.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Most of the fixes for this bug are in mutter 45, but there are also some regressions in there too. So the issue will be fully resolved after bug 2033719. But only in GNOME 45 and later.

Changed in gnome-shell (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
status: Confirmed → In Progress
affects: gnome-shell (Ubuntu) → mutter (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Finally fixed in full in Ubuntu 23.10. If you encounter any similar issues in Ubuntu 23.10 or later then please open a new bug.

Changed in mutter (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Kerem B (kbasaran) wrote :

I have this issue also. Hereby some info over my case:
- This only happens with the device "ID 1b1c:1bac Corsair CORSAIR KATAR PRO XT Gaming Mouse". I also have a Logitech M330 and I never have the issue using that one. I don't think the Corsair mouse is defect though, because I use it also with a Windows PC and it works perfectly there.
- The freeze is for the complete screen, not just the cursor. Sometimes it is several seconds long, sometimes a short stutter.
- I don't find anything in systemd journal when this happens.
- My network device also stops during the freezes. If I am streaming radio with Rhythmbox I get a seek error.
- It never happened when I am in a game. Only during desktop use.

OS: Ubuntu 22.04.3 LTS x86_64
Kernel: 6.2.0-36-generic
GPU: AMD ATI Radeon RX 6600/6600 XT/6600M
DE: GNOME 42.9
MESA: 23.0.4

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

That's not related to this bug. Please open a new bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.