Extra frame of input latency on idle due to IBus panel appearing before DMA-BUF completes
Affected version
Fedora 39, Wayland, both 45.3 and current main.
Bug summary
I get an extra frame of key press to screen lightness change latency in alacritty when idling, compared to raw Mutter. Both windowed and fullscreen (with scanout).
Steps to reproduce
- Open alacritty,
cat
- Press Space
What happened
When pressing space, the white block cursor will move right. The delay between the key press and measured change with a light sensor is one frame bigger than in raw Mutter.
What did you expect to happen
Same or slightly higher as raw Mutter, but not one frame exactly.
Relevant logs, screenshots, screencasts etc.
Plot of measured latency on fullscreen, compared to raw Mutter and another compositor:
The spread is one frame, since key presses arrive at a random point within the frame. Shell is exactly one frame behind.
Inspecting this in Tracy reveals that there's something odd going on. Whereas Mutter reacts to the key press with a single KMS frame, Shell always reacts with two consecutive frames. Oddly enough, the alacritty surface commit happens before the first frame (as it should), and there isn't really anything happening between the two frames.
Judging by the measured extra frame of latency, the screen updates with the new alacritty buffer on the second KMS frame and not on the first one. Is there some extra buffer latching going on perhaps?