Switching workspaces is laggy when windows are open


When I have some applications open, one I can name is GNOME Document Viewer (since I’ve been using it a bit to read), switching workspaces is laggy (Ctrl+Alt+Left/Right). I have a decently beefy computer and CPU and memory usage is still very low with these applications open. I should note that I have a 2 external monitors on top of the internal display, so a total of 3 monitor outputs, and I’m running a NVIDIA GPU, with the driver linux510-nvidia. Is there anything I can do to remove this lag?

Here’s my inxi -F

  Host: g15 Kernel: 5.10.53-1-MANJARO x86_64 bits: 64 Desktop: GNOME 40.3 
  Distro: Manjaro Linux 
  Type: Laptop System: ASUSTeK product: ROG Zephyrus G15 GA503QR_GA503QR 
  v: 1.0 serial: <superuser required> 
  Mobo: ASUSTeK model: GA503QR v: 1.0 serial: <superuser required> 
  UEFI: American Megatrends LLC. v: GA503QR.408 date: 05/11/2021 
  ID-1: BAT0 charge: 86.0 Wh (100.0%) condition: 86.0/90.0 Wh (95.5%) 
  volts: 15.9 min: 15.9 
  Info: 8-Core model: AMD Ryzen 9 5900HS with Radeon Graphics bits: 64 
  type: MT MCP cache: L2: 4 MiB 
  Speed: 1397 MHz min/max: 1200/3300 MHz Core speeds (MHz): 1: 1397 2: 1398 
  3: 1400 4: 1315 5: 1303 6: 1581 7: 1855 8: 1795 9: 1196 10: 1197 11: 1518 
  12: 1198 13: 1197 14: 1217 15: 1221 16: 1295 
  Device-1: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q] driver: nvidia 
  v: 470.57.02 
  Device-2: AMD Cezanne driver: amdgpu v: kernel 
  Device-3: Logitech HD Pro Webcam C920 type: USB 
  driver: snd-usb-audio,uvcvideo 
  Display: x11 server: X.org 1.20.11 driver: loaded: amdgpu,ati,nvidia 
  unloaded: modesetting,nouveau resolution: <missing: xdpyinfo> 
  OpenGL: renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2 
  v: 4.6.0 NVIDIA 470.57.02 
  Device-1: AMD driver: snd_hda_intel 
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor driver: N/A 
  Device-3: AMD Family 17h HD Audio driver: snd_hda_intel 
  Device-4: Kingston HyperX Cloud Flight S type: USB 
  driver: hid-generic,snd-usb-audio,usbhid 
  Device-5: Logitech HD Pro Webcam C920 type: USB 
  driver: snd-usb-audio,uvcvideo 
  Sound Server-1: ALSA v: k5.10.53-1-MANJARO running: yes 
  Sound Server-2: PulseAudio v: 14.2 running: yes 
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  driver: r8169 
  IF: enp3s0 state: down mac: f0:2f:74:49:73:8a 
  Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi 
  IF: wlp4s0 state: up mac: 08:5b:d6:cb:2b:18 
  Device-1: Intel AX200 Bluetooth type: USB driver: btusb 
  Report: rfkill ID: hci0 state: up address: see --recommends 
  Local Storage: total: 1.87 TiB used: 35.62 GiB (1.9%) 
  ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO 1TB size: 931.51 GiB 
  ID-2: /dev/nvme1n1 vendor: SK Hynix model: HFM001TD3JX013N 
  size: 953.87 GiB 
  ID-3: /dev/sda type: USB vendor: SanDisk model: Cruzer Glide 
  size: 29.82 GiB 
  ID-1: / size: 906.86 GiB used: 35.62 GiB (3.9%) fs: ext4 
  dev: /dev/nvme0n1p2 
  ID-2: /boot/efi size: 299.4 MiB used: 292 KiB (0.1%) fs: vfat 
  dev: /dev/nvme0n1p1 
  ID-1: swap-1 type: partition size: 8.8 GiB used: 0 KiB (0.0%) 
  dev: /dev/nvme0n1p3 
  System Temperatures: cpu: 56.0 C mobo: N/A 
  Fan Speeds (RPM): cpu: 0 
  GPU: device: nvidia screen: :1.0 temp: 53 C device: amdgpu temp: 55.0 C 
  Processes: 370 Uptime: 6m Memory: 38.66 GiB used: 2.63 GiB (6.8%) 
  Shell: Zsh inxi: 3.3.06 

Please let me know if I should post any additional information or outputs.

What settings are you running? Animations and what monitors change with the workspaces? Is it all animations or is it more noticeable when changing workspaces and opening overview (Super + S)?

Some people in this reddit thread had a similar issue when their CPU-frequency was too low. Do you have tlp or something similar enabled? Do you observe the same issue when power is connected and when running from battery?

Hey, thanks for the response. I have default animations, I haven’t changed anything. I don’t notice any lag when opening overview, just when switching workspaces. I’m getting the lag with cpu turbo enabled as well.

I am running tlp. I’ve been plugged while getting the lag, same thing if I’m on battery.

One thing I do notice is if I disconnect my external monitors, I don’t see any lag (it’s very smooth) on the internal display when switching workspaces with the same applications open.

I’m getting the lag with cpu turbo enabled as well.
I am running tlp. I’ve been plugged while getting the lag, same thing if I’m on battery.

That means it’s probably not the CPU frequency issue then.

One thing I do notice is if I disconnect my external monitors, I don’t see any lag (it’s very smooth) on the internal display when switching workspaces with the same applications open.

Okay, that is interesting. Could you try changing some workspace and animation settings with different amounts of monitors connected to see what changes? I remember having some laggy behaviour when using dynamic workspaces. I then switched from dynamic workspaces to static workspaces for another reason, but it stopped being laggy, so I didn’t think any more of it.

Using Tweaks -> Workspaces try changing between dynamic and static workspaces and maybe also display handling and animations to see if it makes a difference. If you have the time you could also try with different amounts of monitors connected.

The lag persists even with one external monitor connected, regardless of which monitor I’m using. Same behavior whether I use static or dynamic workspaces.

I don’t notice any lag/delay with animations turned off, but I don’t think it’d be a final solution for me because I like having animations turned on, and my computer should be capable of running with animations on.

Maybe this is a NVIDIA issue? I’ll test later tonight running with integrated/hybrid graphics, with a single external monitor. Maybe this could narrow things down.

I have same issue too, it’s not working as 60 FPS mostly. High amount of window breaks the smooth experience, specially while using multiple monitors.

Screen 0: minimum 16 x 16, current 1366 x 768, maximum 32767 x 32767
XWAYLAND0 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 340mm x 190mm
   1366x768      59.98*+
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77 
  Device-1: Intel UHD Graphics 620 driver: i915 v: kernel 
  Device-2: NVIDIA GM108M [GeForce MX130] driver: nvidia v: 470.57.02 
  Device-3: IMC Networks USB2.0 HD UVC WebCam type: USB driver: N/A 
  Display: wayland server: X.org 1.20.11 driver: loaded: modesetting,nvidia 
  resolution: <missing: xdpyinfo> 
  OpenGL: renderer: Mesa Intel UHD Graphics 620 (KBL GT2) v: 4.6 Mesa 21.1.5 

@Aard Sorry to hear you’re having the same issues, but it’s reassuring to know this isn’t an isolated issue. Thanks for mentioning that here.

@kwill I tried switching to integrated graphics and using the HDMI port for integrated graphics. The issue persists even in that case.

I’ve had that issue while I was using Pop!_OS too. Also switching to Intel was a good option to fix that mostly but not for multiple screens and it doesn’t work on Manjaro.

Hmm, I have no idea what could be causing that behaviour other than driver issues then.
I havn’t been running Nvidia on Linux in a long time, so I am not familiar with how that works. Did you find any differences trying out different drivers?