You are not logged in.

#1 2024-12-08 19:43:59

brandon.arnold
Member
Registered: 2020-07-27
Posts: 19

[SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

When some apps lose focus (such as google-chrome or kicad) for 10 seconds, it will hang for a couple of seconds upon regaining focus. While hanging, the app will queue up the inputs, and then they get applied at once after the delay.

There are two ways (in sway) I've tested this: using the mouse cursor, and using the keyboard mod+{j,k,h,l} commands, when two windows are open, to pan to the other window. I will wait 10 seconds, then use the same method to go back. If I target google-chrome with this operation, it will hang; but if I target alacritty or Gnu Emacs, it will not have any delay.

After looking into it, a lot of people seem to link this USB udev autosuspend issue Wiki. This has got to be unrelated; USB udev autospend is kernel-level and would universally affect input sleep for everything. What I'm talking about here is something that only applies to some apps. Anyway, I don't see any autosuspend settings configured in any udev files.

Edit/Update: It turns out, autosuspend is indeed the culprit, but NOT for the USB devices. Instead, the autosuspend is configured on the GPU PCI device. Read on for the solution.

- `google-chrome 131.0.6778.69-1`
- `wayland 1.23-1-1`
- `gtk3 1:3.24.43-4`
- `sway 1:1.10-1`

Last edited by brandon.arnold (2024-12-09 16:47:42)


Seattle dweller, Tetris lover, Software Engineer

Offline

#2 2024-12-08 20:59:53

seth
Member
Registered: 2012-09-03
Posts: 60,776

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

kicad is actually wxwidgets and chrome might suffer from https://wiki.archlinux.org/title/Chromi … er_Wayland (ignore the symptom mentioned there, the point is): does this more specifically affect xwayland clients?
https://wiki.archlinux.org/title/Waylan … s_visually and/or try xterm.

Offline

#3 2024-12-08 21:08:30

brandon.arnold
Member
Registered: 2020-07-27
Posts: 19

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

I think xwayland would make a lot more sense! Thanks for the idea, it would clarify things.


Seattle dweller, Tetris lover, Software Engineer

Offline

#4 2024-12-08 21:12:21

brandon.arnold
Member
Registered: 2020-07-27
Posts: 19

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

seth wrote:

try xterm.

XTerm does **not** have this behavior.


Seattle dweller, Tetris lover, Software Engineer

Offline

#5 2024-12-08 21:50:48

seth
Member
Registered: 2012-09-03
Posts: 60,776

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

Does gtk3-demo?
Does it help to "export GDK_CORE_DEVICE_EVENTS=1"?

Offline

#6 2024-12-08 22:03:41

brandon.arnold
Member
Registered: 2020-07-27
Posts: 19

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

seth wrote:

Does gtk3-demo?
Does it help to "export GDK_CORE_DEVICE_EVENTS=1"?

It does not happen in gtk3-demo! Which may rule out GTK3, and thank you for that. Setting that environment variable does not fix it in Chrome or KiCAD.


Seattle dweller, Tetris lover, Software Engineer

Offline

#7 2024-12-08 22:07:27

seth
Member
Registered: 2012-09-03
Posts: 60,776

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

GLX?
https://peter.sh/experiments/chromium-c … isable-gpu
Or (for mesa) "export LIBGL_ALWAYS_SOFTWARE=1"?

Offline

#8 2024-12-08 22:18:49

brandon.arnold
Member
Registered: 2020-07-27
Posts: 19

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

seth wrote:

GLX?
https://peter.sh/experiments/chromium-c … isable-gpu
Or (for mesa) "export LIBGL_ALWAYS_SOFTWARE=1"?

Damn, `LIBGL_ALWAYS_SOFTWARE=1` fixes it! So that helps narrow things down a lot!


Seattle dweller, Tetris lover, Software Engineer

Offline

#9 2024-12-09 05:44:47

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,719
Website

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

Check /sys/bus/pci/devices/$address/power/suspend/autosuspend_delay_ms (replace $address with the actual PCI address of your graphics card), if you have a separate discrete graphics card it may be causing the delay as it wakes up.


Para todos todo, para nosotros nada

Offline

#10 2024-12-09 07:57:27

seth
Member
Registered: 2012-09-03
Posts: 60,776

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

Is it libgl or glx/xwayland?
Does chromium behave differently using the x11 (through xwayland) or (native) wayland backend?

Offline

#11 2024-12-09 15:32:12

brandon.arnold
Member
Registered: 2020-07-27
Posts: 19

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

Head_on_a_Stick wrote:

Check /sys/bus/pci/devices/$address/power/suspend/autosuspend_delay_ms (replace $address with the actual PCI address of your graphics card), if you have a separate discrete graphics card it may be causing the delay as it wakes up.

OMG! This is it!

I changed `/sys/bus/pci/devices/0000:03:00.0/power/autosuspend_delay_ms` to a much larger number (e.g. 500000) and the problem went away. Change it to a smaller number and I can repro it without waiting as long.

Thank you so much for the ideas and helping me single the problem out, y'all! This is awesome. I need to research this situation better to see if I can turn it off completely.

Last edited by brandon.arnold (2024-12-09 16:46:25)


Seattle dweller, Tetris lover, Software Engineer

Offline

#12 2024-12-09 16:48:08

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,719
Website

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

I set the delay to six million milliseconds and used tmpfiles.d to make the change permanent: https://bbs.archlinux.org/viewtopic.php … 4#p2211304

Works well.


Para todos todo, para nosotros nada

Offline

#13 2024-12-10 11:10:09

MeganerdNL
Member
Registered: 2024-12-10
Posts: 5

Re: [SOLVED] Apps using AMD discrete GPU sleep on inputs after 5 seconds

Nevermind, misread.

Thanks.

Last edited by MeganerdNL (2024-12-10 11:33:10)

Offline

Board footer

Powered by FluxBB