r/linux_gaming • u/kimjongundotcom • Jun 14 '19
Linux input lag analysis(7DEs tested + Windows)
Hi there, i recently tested myself the input GNUlag that Linux and Windows might have and i thought sharing those would be appreciated here considering the complete lack of tangible proof that X or Y DE is better than the other on a technical standpoint.
For the test method, i recorded at 240FPS my mouse(Logitech G603 1ms 1000hz) button being pressed in front of the screen(Samsung C24FG70, 1ms 144hz), i did this once on the desktop with a web browser's(Opera) close button by measuring the number of frames since the button was pressed and the moment the close button changed color or the "close" tooltip started disappearing, whichever was faster.
I then did the same thing but with Xonotic(xonotic.org, the SDL fullscreen executable) by measuring the amount of frames since the button press until the muzzle flash finally appeared. Frame count always started from 1 instead of 0 and this method should yield about 1 to 2 frames of inaccuracy camera-wise(4.166*2), the total latency is calculated with (1000 / 240) * number_of_frames_camera. Ubuntu 19.04 and proprietary NVIDIA drivers with default DE compositing settings were used for all tests, the Xorg version was used everytime i could. Vsync was disabled in Xonotic's settings of course.
And now the podium, sorted by worst to best in gaming performance(cf means camera frames measured from the output video) :
8th - MATE (83.3ms/20cf desktop, 120.8ms/29cf gaming)
7th - Xfce (41.6ms/10cf desktop, 95.8ms/23cf gaming) HOWEVER it is "hardcoded" at 60fps and had horrible diagonal glitches, very bad if you ask me. https://i.imgur.com/N6OHiTC.png
6th - KDE Plasma Kwin (41~45ms/10~11cf desktop, 83.3ms/20cf gaming) i've had to do this test twice to confirm it was indeed 20 and not 19 with bad timing in the recording.
5th - Windows 10 build 1809 (79.1ms/19cf both on the desktop and in game)
4th - Gnome 3/Mutter (33.3ms/8cf desktop, 79.1ms/19cf gaming) Crazy how they went from having an infuriating 59.940hz hardcoded lock to having this kind of performance, though Phoronix says this version of Ubuntu doesn't have the recent latency improvements for Mutter, anyone can comfirm this? https://gitlab.gnome.org/GNOME/mutter/commit/4faeb12731b81ce617042973155cc4b5737e1133
3rd - Ubuntu Unity 7 (33.3ms/8cf desktop, 62.5ms/15cf gaming)
2nd - Enlightenment (62.5ms/15cf gaming, i was unable to test the desktop because it refused to show the browser's top bar and would often be unresponsive)
1st - LXDE (37.5ms/9cframes desktop, 54.1ms/13cf gaming)Now i don't know if it can be improved from the user side, realtime kernel(maybe) and disabling the desktop composition "should" help but if a DE has suboptimal or outright bad latency problems even without composition then is it objectively a mediocre DE? It can be asked in the other direction too.(a DE considered superior for its technical performance rather than its design)
I also didn't test tiling window managers due to lack of familiarity with those, i would have liked to test Windows 7 too(both with and without composition) but couldn't due to """uncompatible""" hardware. Windows native vs. LXDE/Unity Wine in both exclusive and windowed fullscreen modes is a very good idea too. Audio latency with Pulseaudio against that of Windows could be tested with optimized buffer lenght settings too.
12
u/theawesometilmue Jun 14 '19
Did you do this for MATE?
If not i know why there is so much input lag for you
https://old.reddit.com/r/linux_gaming/comments/b62k14/gaming_on_linux/ejholjo/
10
u/some_random_guy_5345 Jun 14 '19
I'm surprised KDE Plasma did so badly at #6. KDE autodetects and disables compositing when Xonotic is running... I wonder if there is a deficiency in the way that KDE disables compositing then.
6
u/jarnolol Jun 14 '19
Cinnamon?
4
u/HikaruTilmitt Jun 14 '19
When you say you clicked the mouse in front of your screen, are you measuring when you physically pressed the mouse button and measuring that against the responses on the screen? What kernel are you using specifically? these things matter for sure. I know it might be a pain, but using something with more "vanilla" packages than Ubuntu might be a good choice, as well.
A good way to test this, at least without potential fault in measurement by eyesight of a mouse click, would be to wire a joystick PCB to be an input on a screen as well as light up an LED or something right by the screen. you can measure that with nearly anything on the screen versus the light coming on (which is instant for this type of test) to get a more accurate measure.
I only ask because going between Windows 10 and my Arch install using KDE, I actually feel _less_ latency on my Arch setup, specifically using a controller. My mouse is also super responsive, certainly not in the 2-3 frames (desktop) or 5+ frames (game) range put out on your chart.
2
u/Zeioth Jun 15 '19
What version of XFCE are we speaking about? Because the compositor is being rewritten for 4.14.
12
u/RAZR_96 Jun 14 '19
For KDE you could try kwin-lowlatency. Also i3+compton would be nice to test out.
3
u/thatcat7_ Jun 14 '19
Try changing the kernel to this one which is optimized for desktop, gaming and multimedia.
https://liquorix.net/
8
u/kazriko Jun 14 '19
I kind of wonder how the tiling window managers compare. i3/xmonad/ratpoison.
6
u/GreenFox1505 Jun 14 '19
This is really cool. I'd like to see more exploration on this. Exclusive fullscreen vs not. GSync and/or Freesync tests. Different driver versions (nvidia driver vs nouveau).
Personally, I notice some issues with games that claim to have "Fullscreen" but GSync doesn't work unless I turn off 2 of my 3 monitors.
(I understand this is a LOT to test)
6
u/ComradeOj Jun 14 '19
Nice analysis!
I find running with XFCE's compositor causes a lot of issues, so I disable it. I have a 144hz monitor, and turning on the compositor totally kills the smoothness. I wonder if XFCE would perform better in these tests with the compositor disabled.
You can go to settings > window manager tweaks > compositor to turn it on or off.
6
u/Hobscob Jun 15 '19
i3 and Openbox results would be interesting to see.
4
u/dreamer_ Jun 14 '19
I haven't used this tool myself, but you might find it helpful in the future: https://github.com/mstoeckl/latencytool
7
u/Decuke Jun 14 '19
Could you try with Sway/Weston/any wayland compositor
as a Sway user i'd like to see Wayland native and Xwayland, it would be great.
3
u/OnlineGrab Jun 14 '19
That's the kind of objective testing we need, instead of people reporting anecdotal evidence like "it works for me" or "it feels more/less snappy".
It would be interesting do do the same thing with all kind of compositing disabled. On KDE+Nvidia, the compositing backend (Xrender/OpenGL) can make a world of difference.
It's be great to compare Xorg vs Wayland, too.
3
u/Ph42oN Jun 18 '19
Interesting, first time i see any linux input lag testing.
I would be interested in seeing fluxbox and openbox.
1
u/gudvinr Jun 15 '19
Your results do not seem to be statistically correct. Did you repeat each task more than once or that was just a single test for each DE?
You should make multiple measurements and calculate average value and dispersion because it can easily fluctuate from time to time.
You said nothing about your setup and about testing process apart from describing frame counting methodology. Did you reboot the system after measuring each DE? Are DEs installed in single Linux instances or that's VM/different bare-metal installations/etc?
2
u/xpander69 Jun 15 '19
yeah MATE is terrible if the default compositor was enabled. Also theres a few ms delay coming from the stupid middle mouse emulation, which can be disabled ofc.
2
u/mirh Jun 16 '19
Would be interesting to see if lxqt still kept lxde performance.
https://github.com/zeffy/wufuc
Also, please take note that nvidia has some pretty lame ass trickery in their driver to deal with exclusive fullscreen
1
u/[deleted] Jun 15 '19
All of the software is open source, you can get much more accurate timings and an easier, automated test with a few code changes.
Also can you please state if you used X11 vs Wayland?
1
u/TFW_YT Jun 07 '22
Why is the “gaming” worse