28 ms·
I have posted this in the recent latency thread too, but let me repeat it here: I have measured 44 ms on Linux WITH compositing, from mechanical input to screen
by ahartmetz 9y ago
I have posted this in the recent latency thread too, but let me repeat it here: I have measured 44 ms on Linux WITH compositing, from mechanical input to screen output. I have a PS/2 keyboard but that doesn't actually matter too much - the keyboard model might matter.
Hardware and software info: Measurement at 90 fps (Moto G 5 slow motion camera) so it could have been up to 55 fps due to granularity. Filmed keyboard and screen together. Ubuntu 16.10 with self compiled KDE stack on master branch. Fujitsu KBPC-PX keyboard with PS/2 connection (it can also do USB). AMD R9 280x GPU with AMDGPU kernel driver and mesa master / llvm trunk. kwin (X11) window manager with compositing enabled. Editor kwrite (kate should be the same, it's a more featureful UI around the same internals). AMD Ryzen 7 1800X CPU. 16 GB RAM.
Possibly one of the reasons why I like fat Linux desktop machines with AMD graphics so much is the great latency results.
- floatboth 9y agoAnother interesting sorta-related thing I've noticed is that good applications only refresh the necessary part of the screen. The Weston compositor has a debug mode that shows colorful rectangles over repainted areas. When typing in gnome-terminal, the repaints only happen on affected characters.
- ahartmetz 9y agoAFAIU this doesn't do a whole lot in practice: OpenGL does not support partial repaints - or maybe it does with obscure extensions. What it may do is avoid updating the screen at all when a window updates only a part that is hidden behind something else. A quite valuable and IME underused Wayland feature is clients sending an opaque region and the compositor using it to draw windows ("surfaces") without alpha blending where it isn't necessary. Alpha blending uses significantly more fill rate than plain overdrawing. Opaque regions can also be used to determine that a whole window or a region of it doesn't need to be drawn at all. I had implemented that as an experimental optimization in a customer project once. In the end it didn't work out because the 2D acceleration in Vivante GC2000 is broken garbage - they even pulled the documentation of it, but still advertise the feature in marketing material.
- Filligree 9y agoIt isn't an obscure feature. You can implement partial redraws in OpenGL in the obvious manner, by selecting a single-buffered visual. This of course has all the expected downsides, like tearing, and modern GPUs are fast enough that there's rarely any point--but it's certainly possible.
- ahartmetz 9y agoI had this one in mind: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_buffer_age.txt https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_... Note that Kristian Høgsberg, for years the main developer of Wayland, is among the authors. So I guess it is actually not so obscure in the Wayland context. It tells you how many frames old the current back buffer is, so you can repaint as necessary to take it from the state n frames ago to the state now.
- planteen 9y agoOne could render content into a FBO and simply redraw the FBO texture to screen when necessary. If only a partial update is needed, the scissor box can be set. No extensions are used in this case.
- z3t4 9y agotip: Use the same amount of decimals as your measuring precision!
- katastic 9y agoI've heard PS/2 was faster (because it's a direct ISA/PCI device / hardware interrupt?), whereas USB can introduce more latency because it has no real-time guarantee and it's packet-based. https://superuser.com/questions/16893/do-usb-or-ps-2-keyboards-respond-faster https://superuser.com/questions/16893/do-usb-or-ps-2-keyboar... >There are a number of interesting results, but the point relevant to this question is that there was a fairly significant variance between keyboards, and all the USB keyboards tested had a longer effective scan interval (18.77 ms - 32.75 ms) than the PS/2 keyboards (2.83 ms - 10.88 ms).
- ahartmetz 9y agoCorrection: the distribution is actually Ubuntu 17.10