niri icon indicating copy to clipboard operation
niri copied to clipboard

High cpu usage with fcitx5 when screen is turned off via `niri msg`

Open BRS5672023 opened this issue 1 year ago • 6 comments

System Information

  • niri version: niri 0.1.8 (unknown commit)
  • Distro: Arch Linux
  • GPU: Radeon 780M Graphics
  • CPU: AMD Ryzen 7 8845H

I noticed this issue when I locked the screen and wait until the screen is off, then the cpu fan ramped up after a couple of seconds, but if I then wake up the screen, the cpu usage goes down as normal.. I found something goes wrong with fcitx5 using ssh on my phone..

Screenshot_2024-08-16-21-09-59-699_com termux

This issue doesn't happen on hyprland though, and neither when I use the shortcut to turn off the screen Mod+Shift+P { power-off-monitors; }. But if I type niri msg output eDP-1 off within the terminal then the issue appears (and I don't know how to turn on the screen in this case).

One can reproduce this issue with niri msg invoked by swayidle, e.g., the following

timeout 600 'pidof swaylock || swaylock -f'
timeout 630 'niri msg output eDP-1 off' resume 'niri msg output eDP-1 on'
timeout 30 'pidof swaylock && niri msg output eDP-1 off' resume 'niri msg output eDP-1 on'
before-sleep 'pidof swaylock || swaylock -f'

BRS5672023 avatar Aug 16 '24 14:08 BRS5672023

Hm, guess something is busylooping. If you can, please build and run niri with debuginfo and then when the issue occurs, record some seconds with:

perf record -F 99 --call-graph dwarf,65528 -p $(pidof niri)

Then make and upload here a flamegraph using something like:

perf script | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg

(this uses commands from inferno)

It should look similar to this: https://github.com/YaLTeR/niri/assets/1794388/9d81ac17-50a6-4994-abd9-6d1b4debcb34

Sidenote, why are you turning off the monitor in swayidle rather than niri msg action power-off-monitors?

YaLTeR avatar Aug 16 '24 14:08 YaLTeR

Hm, this looks really weird honestly.

YaLTeR avatar Aug 16 '24 15:08 YaLTeR

This seems to be happening to me, as well.

Niri 0.1.9 Distro: NixOS GPU: AMD Radeon 780M CPU: AMD Ryzen 9 7940HS

Just tried it, using the Mod+P option to trigger the power-off-monitors action.

One additional weird thing is Niri can't seem to parse the EDID blob, as I get the following in the journal:

Sep 25 16:47:06 xxx niri[2579]: 2024-09-25T04:47:06.844301Z  WARN niri::backend::tty: error getting EDID info for eDP-1: error parsing EDID
Sep 25 16:47:06 xxx niri[2579]: Caused by:
Sep 25 16:47:06 xxx niri[2579]:     Parsing the EDID blob failed

mexisme avatar Sep 25 '24 04:09 mexisme

Actually, perhaps I am wrong.

Have just noticed that clipcatd seems like it might be the root cause of Niri having high CPU.

This seems to be happening to me, as well.

Niri 0.1.9 Distro: NixOS GPU: AMD Radeon 780M CPU: AMD Ryzen 9 7940HS

Just tried it, using the Mod+P option to trigger the power-off-monitors action.

One additional weird thing is Niri can't seem to parse the EDID blob, as I get the following in the journal:

Sep 25 16:47:06 xxx niri[2579]: 2024-09-25T04:47:06.844301Z  WARN niri::backend::tty: error getting EDID info for eDP-1: error parsing EDID
Sep 25 16:47:06 xxx niri[2579]: Caused by:
Sep 25 16:47:06 xxx niri[2579]:     Parsing the EDID blob failed

mexisme avatar Sep 25 '24 05:09 mexisme

I used to get this issue, with v25.01. But as of commit 4c98b874862c2e6df7f71bdf36df0ba527690fbb it doesn't seem to happen anymore. That or some other update fixed it. I never pinned down exactly what the cause was.

Update: I also updated niri to v25.02 (as packaged by my distro, Arch, as opposed to building it myself from git), and don't encounter this issue.

FlyingWombat avatar Mar 11 '25 14:03 FlyingWombat

Huh, interesting. Guess this can be closed then?

YaLTeR avatar Mar 11 '25 14:03 YaLTeR

can confirm same experience as FlyingWombat. The IME CPU problem no longer happens after I switched to git main build.

xbwwj avatar Mar 11 '25 15:03 xbwwj

There were some fixes to IME in Smithay which are included in niri v25.02. So maybe they also fixed this issue. Well in any case good to know

YaLTeR avatar Mar 11 '25 16:03 YaLTeR