Weird lag spike when re-focusing an application

Hey there, I’ve been using garuda linux for a little over 1 month and I’ve noticed this annoying behaviour with some applications (specially games).
I usually leave some apps like Firestorm (a second life viewer) on my second monitor while I focus on something else on my main one and occasionally refocus the app when needed.
What I noticed is that when unfocused the app runs at 100+ fps but as soon as I refocus it it drops to 20-30 fps, my PC fans starts spinning like I just launched a program and the CPU spikes at around 70-80% for 5-6 seconds before getting back to its original framerate.
It seems like re-focusing the app makes it re-render everything as if you just opened it.

My CPU has no dedicated GPU, so I excluded the possibility of the apps running on it and causing the spike in performance. I also tried to tinker with the focus settings, especially the separate screen focus, but the behaviour remained. I’ve tried both X11 and Wayland and the same behaviour happens.

A similar behaviour happens with CS2, Half life 2 and Payday 3, they get very low FPS when unfocused (even if they aren’t minimized) but they snap back to their original framerate once focused again.

Does anyone have any idea? A friend of mine running AMD also experiences the same problem as me. I also tried with the power setting and get them to performance mode but to no avail.

System:
Kernel: 6.12.1-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
clocksource: tsc avail: acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=456f37e4-3c23-4e90-a8b0-2b273d16ad90 rw rootflags=subvol=@
quiet loglevel=3 ibt=off
Desktop: KDE Plasma v: 6.2.4 tk: Qt v: N/A info: frameworks v: 6.8.0
wm: kwin_wayland vt: 1 dm: SDDM Distro: Garuda base: Arch Linux
Machine:
Type: Desktop System: ASUS product: N/A v: N/A serial: <superuser required>
Mobo: ASUSTeK model: PRIME Z690M-PLUS D4 v: Rev 1.xx
serial: <superuser required> part-nu: SKU uuid: <superuser required>
UEFI: American Megatrends v: 2014 date: 10/14/2022
CPU:
Info: model: 12th Gen Intel Core i5-12600KF bits: 64 type: MST AMCP
arch: Alder Lake gen: core 12 level: v3 note: check built: 2021+
process: Intel 7 (10nm ESF) family: 6 model-id: 0x97 (151) stepping: 2
microcode: 0x37
Topology: cpus: 1x dies: 1 clusters: 7 cores: 10 threads: 16 mt: 6 tpc: 2
st: 4 smt: enabled cache: L1: 864 KiB desc: d-4x32 KiB, 6x48 KiB; i-6x32
KiB, 4x64 KiB L2: 9.5 MiB desc: 6x1.2 MiB, 1x2 MiB L3: 20 MiB
desc: 1x20 MiB
Speed (MHz): avg: 875 min/max: 800/5000:3700 scaling: driver: intel_pstate
governor: powersave cores: 1: 875 2: 875 3: 875 4: 875 5: 875 6: 875 7: 875
8: 875 9: 875 10: 875 11: 875 12: 875 13: 875 14: 875 15: 875 16: 875
bogomips: 117964
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities: <filter>
Graphics:
Device-1: NVIDIA GA104 [GeForce RTX 3070] vendor: Gigabyte driver: nvidia
v: 565.57.01 alternate: nouveau,nvidia_drm non-free: 550.xx+ status: current
(as of 2024-09; EOL~2026-12-xx) arch: Ampere code: GAxxx
process: TSMC n7 (7nm) built: 2020-2023 pcie: gen: 4 speed: 16 GT/s
lanes: 16 ports: active: none off: DP-1,DP-2,HDMI-A-1 empty: HDMI-A-2
bus-ID: 01:00.0 chip-ID: 10de:2484 class-ID: 0300
Display: wayland server: X.org v: 1.21.1.14 with: Xwayland v: 24.1.4
compositor: kwin_wayland driver: X: loaded: nvidia unloaded: modesetting
alternate: fbdev,nouveau,nv,vesa gpu: nvidia d-rect: 5760x1080
display-ID: 0
Monitor-1: DP-1 pos: primary,left res: 1920x1080 size: N/A modes: N/A
Monitor-2: DP-2 pos: center res: 1920x1080 size: N/A modes: N/A
Monitor-3: HDMI-A-1 pos: right res: 1920x1080 size: N/A modes: N/A
API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 2
drv: swrast gbm: drv: nvidia surfaceless: drv: nvidia wayland: drv: nvidia
x11: drv: nvidia inactive: device-1
API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 565.57.01
glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 3070/PCIe/SSE2
memory: 7.81 GiB display-ID: :1.0
API: Vulkan v: 1.3.295 layers: 11 device: 0 type: discrete-gpu
name: NVIDIA GeForce RTX 3070 driver: nvidia v: 565.57.01
device-ID: 10de:2484 surfaces: xcb,xlib,wayland
Audio:
Device-1: Intel Alder Lake-S HD Audio vendor: ASUSTeK driver: snd_hda_intel
v: kernel alternate: snd_soc_avs,snd_sof_pci_intel_tgl bus-ID: 00:1f.3
chip-ID: 8086:7ad0 class-ID: 0403
Device-2: NVIDIA GA104 High Definition Audio vendor: Gigabyte
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 01:00.1 chip-ID: 10de:228b class-ID: 0403
API: ALSA v: k6.12.1-zen1-1-zen status: kernel-api with: aoss
type: oss-emulator tools: N/A
Server-1: PipeWire v: 1.2.7 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Intel Ethernet I219-V vendor: ASUSTeK driver: e1000e v: kernel
port: N/A bus-ID: 00:1f.6 chip-ID: 8086:1a1d class-ID: 0200
IF: eno1 state: up speed: 1000 Mbps duplex: full mac: <filter>
Info: services: NetworkManager,systemd-timesyncd
RAID:
Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
v: 0.6 port: N/A bus-ID: 00:0e.0 chip-ID: 8086:467f rev: class-ID: 0104
Drives:
Local Storage: total: 2.75 TiB used: 1.1 TiB (40.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:5 model: GXF1TB size: 953.87 GiB
block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4
tech: SSD serial: <filter> fw-rev: SN11590 temp: 43.9 C scheme: GPT
ID-2: /dev/nvme1n1 maj-min: 259:0 vendor: Lexar model: SSD NM710 1TB
size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: 9742 temp: 50.9 C scheme: MBR
ID-3: /dev/nvme2n1 maj-min: 259:2 vendor: Lexar model: SSD NM710 1TB
size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
lanes: 4 tech: SSD serial: <filter> fw-rev: 9742 temp: 51.9 C scheme: GPT
Partition:
ID-1: / raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 111.03 GiB (11.9%) fs: btrfs dev: /dev/nvme2n1p2 maj-min: 259:4
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 588 KiB (0.2%) fs: vfat dev: /dev/nvme2n1p1 maj-min: 259:3
ID-3: /home raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 111.03 GiB (11.9%) fs: btrfs dev: /dev/nvme2n1p2 maj-min: 259:4
ID-4: /var/log raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 111.03 GiB (11.9%) fs: btrfs dev: /dev/nvme2n1p2 maj-min: 259:4
ID-5: /var/tmp raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 111.03 GiB (11.9%) fs: btrfs dev: /dev/nvme2n1p2 maj-min: 259:4
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 31.15 GiB used: 0 KiB (0.0%) priority: 100
comp: zstd avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 max-streams: 16
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 46.0 C mobo: N/A
Fan Speeds (rpm): N/A
Info:
Memory: total: 32 GiB available: 31.15 GiB used: 13.73 GiB (44.1%)
Processes: 504 Power: uptime: 9h 56m states: freeze,mem,disk suspend: deep
avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
suspend, test_resume image: 12.41 GiB services: org_kde_powerdevil,
power-profiles-daemon, upowerd Init: systemd v: 256 default: graphical
tool: systemctl
Packages: 2096 pm: pacman pkgs: 2076 libs: 586 tools: gnome-software,
octopi, pamac, paru, trizen pm: flatpak pkgs: 20 Compilers: clang: 18.1.8
gcc: 14.2.1 Shell: garuda-inxi default: fish v: 3.7.1 running-in: konsole
inxi: 3.3.36
Garuda (2.6.26-1):
System install date:     2024-11-18
Last full system update: 2024-11-30
Is partially upgraded:   No
Relevant software:       snapper NetworkManager dracut nvidia-dkms
Windows dual boot:       Probably (Run as root to verify)
Failed units:
1 Like

So after a bit more screwing around I decided to do something stupid at first but ended up kinda fixing it. I decided to run the Windows version of Firestorm via Lutris using wine GE and the behaviour is now gone. The CPU usage still spikes after I re-focus the app but there is no lag whatsoever.
I’m guessing Lutris or Wine manage to bypass this restriction where linux native apps seem to throttle when unfocused.

It’s a workaround and I have no problem running it through wine but I’d still be interested in knowing what’s causing this, specially for any future linux native apps that might present the same behaviour

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