Live data from Hacker News

Linux latency measurements and compositor tuning

farnoy.dev

11–20 of 47 posts

Re: Linux latency measurements and compositor tuning

#11
The idle Zed culprit fits its GPUI renderer, which has a history of repainting continuously rather than on demand, so the compositor never reaches its idle path and other clients inherit the wakeup cost. Confirming whether the backgrounded Zed window still holds a live frame callback loop would nail it, since that alone keeps KWin out of its low power present timing.

Re: Linux latency measurements and compositor tuning

#12
post #6

> There it was, something about my desktop profile was introducing at least 3 ms of latency [as compared to creating a fresh account]! From here, I tried a bunch of things: plasma-manager to diff my existing profile against a clean one, removing all virtual desktops and disabling all KWin effects and any display scaling. While randomly closing apps, I found the culprit: the Zed editor. Apparently, an open Zed window…

Literally just had something similar (seemingly unrelated things affecting each other) happening on Windows yesterday. Was doing some 3D rendering and playing around in Ableton at the same time, the GPU process somehow crashed, even though GPU utilization was at 50% and most of the VRAM was available, and somehow that process crash also brought down the entire Windows USB subsystem, which left it in some weird state where it couldn't connect to my USB audio interface, even after reconnecting it.

It required a reboot to get USB to work again, after a completely unrelated process using mostly the GPU crashed. I let Codex spend 2-3 hours trying to get to a root cause of it, but zero luck, just "USB subsystem became unresponsive when the process crashed"...

Re: Linux latency measurements and compositor tuning

#13
> Originally, I had meant to compare with X11 sessions as well, but with KDE removing them soon, I dropped it.

Last time i checked X11 without a desktop compositor (very important) still provides the least latency of any environment, so even if KDE Plasma (not KDE as a whole AFAICT) drops support, there are other WMs/DEs that will work with it and have minimal latency on desktop.

Re: Linux latency measurements and compositor tuning

#14
No X11 because 'KDE drops it' is a rather silly argument for not including it, especially given that X11 is likely to trump Wayland-based systems on this metric. I'm using X11 and will continue to do so until something better comes along. Thus far Wayland is not better, just different and in several ways less functional. Yes, I do use X11 network transparency, sometimes through X2go, other times directly.

Re: Linux latency measurements and compositor tuning

#15
When I switched to Linux from Windows last year I noticed I had a lot of keyboard input latency only when gaming. It was like I had ~100ms of input latency and it felt exactly the same as playing old school Quake I on a dial up connection without client side prediction turned on. It's like you're skating on ice with a delay when seeing the output vs when you performed the input. This was despite having a solid 60 FPS.

Turns out it was due to a combination of things.

I was using niri (Wayland window compositor) and this input latency was present with or without v-sync turned on. It happened when I was using a 60hz 4k monitor with an NVIDIA GPU.

Then I tried playing the same game on a laptop (same distro and dotfiles) with an AMD GPU and no external monitor. The delay disappeared.

Then I played the same game on that laptop but hooked it up to the 4k monitor and I had the same keyboard input latency only when v-sync was enabled. When I turned off v-sync and capped my FPS then the input latency was reduced by an amount that I could no longer perceive the delay.

Then I put an AMD GPU in the original desktop I was testing and reproduced the same results as the laptop.

However, when I switched to using KDE Plasma with X or Wayland, the keyboard input latency disappeared. This was with the 4k monitor and both NVIDIA and AMD GPUs.

I reported it to niri but it hasn't gotten traction, I just know I can reproduce it on 2 completely different systems with different GPU vendors and hardware when the common ground is having a 4k 60hz monitor hooked up.

Re: Linux latency measurements and compositor tuning

#16
I think this is only the top of the iceberg.

I say that because I play some timing tight action games natively on elf(glibc)/linux. Let's take an example with one of the toughest: Silksong.

I was trying to beat lost lace, her timings were too tight and nearly at each try I was locked in some hardly humanly dodge-able pattern combination. I knew all of her patterns by heart after zillions of tries.

Then, I started to have strong suspicions: I closed all background apps, disconnected the network and try again... did beat her, first try, super ez, like she was transparent to me and slow, I could "read" her and react in time easily.

I am running a Zen2, 12 cores at ~4GHz... and native x11 with xorg, sooo... the main culprit seems to lie in game engine programming and then would not completely tied to wayland programming (don't worry, I am coding my own wayland compositor, so, I am going to move to wayland, well actually designing a 'binary layout' for a wayland compositor to be accurate).

I am now in a Silksong steel soul run, and you bet I'll keep this experience in mind, because when I watch video streams of other people fighting some bosses, I can cleary "read" their moves like it is "slower" and which seems much less "aggressive", but once I fight them on my system, nope, I get a much harder time at reading the boss patterns. The "closing all apps and disconnecting the network cable" did not change a thing here, because I am currently fighting "ez' bosses then I always manages to get rid of them before I get really used to their patterns again... we will see with later and harder bosses.

But this could be another [obvious] culprit: stress. I know I am very, VERY, sensitive to stress: it disrupts severely my mind and worse with very little of it. In other words, I would have "brain fog" while fighting a boss because of stress, and the time I did beat lost lace in one shot ez: I was "testing" something without the stress instead of actually trying to beat her... a abysmal difference.

Re: Linux latency measurements and compositor tuning

#17

No X11 because 'KDE drops it' is a rather silly argument for not including it, especially given that X11 is likely to trump Wayland-based systems on this metric. I'm using X11 and will continue to do so until something better comes along. Thus far Wayland is not better, just different and in several ways less functional. Yes, I do use X11 network transparency, sometimes through X2go, other times directly.

Silly author didn't take time to measure on X11, instead 'KDE drops it' author could use older version of KDE or SonicDE fork (rebranded KDE and only X11 support). And while on X11 i'm intresting how XLibre would fare in this metric, because git master of this project feels very snappy.

Re: Linux latency measurements and compositor tuning

#18
post #6

> There it was, something about my desktop profile was introducing at least 3 ms of latency [as compared to creating a fresh account]! From here, I tried a bunch of things: plasma-manager to diff my existing profile against a clean one, removing all virtual desktops and disabling all KWin effects and any display scaling. While randomly closing apps, I found the culprit: the Zed editor. Apparently, an open Zed window…

[flagged]

Re: Linux latency measurements and compositor tuning

#19

No X11 because 'KDE drops it' is a rather silly argument for not including it, especially given that X11 is likely to trump Wayland-based systems on this metric. I'm using X11 and will continue to do so until something better comes along. Thus far Wayland is not better, just different and in several ways less functional. Yes, I do use X11 network transparency, sometimes through X2go, other times directly.

Also still on X11 because of xorgxrdp and X11 forwarding.

It would be cool to see this test with a CRT connected to a VGA port (adapters make it slower) and a PS/2 input device.

Re: Linux latency measurements and compositor tuning

#20
post #6

> There it was, something about my desktop profile was introducing at least 3 ms of latency [as compared to creating a fresh account]! From here, I tried a bunch of things: plasma-manager to diff my existing profile against a clean one, removing all virtual desktops and disabling all KWin effects and any display scaling. While randomly closing apps, I found the culprit: the Zed editor. Apparently, an open Zed window…

[flagged]

Can you elaborate? I know it's a drive-by but maybe you can articulate.
Post reply on HN