https://bugs.winehq.org/show_bug.cgi?id=57442
Bug ID: 57442 Summary: Several applications: abnormal input delay with Wine Product: Wine Version: 9.21 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: win32u Assignee: wine-bugs@winehq.org Reporter: ksmnvsg@gmail.com Distribution: ---
I've noticed a slight input delay in one Unreal Engine sample and decided to test things with my custom application (very simple C++ program that uses SDL2 to poll mouse events and log them). I built this application on Linux with g++, and cross-compiled it for Windows with mingW. Native Linux built has around 1.05 ms input delay, while Windows build with Wine 9.21 has 9.5 ms input lag. I believe you can build any application that polls events and test it for yourself, as I observed the same input lag in Unreal Engine samples (though not so severe, it's bounded by the Game Thread time)
The way I tested things is a bit complicated, but it's necessary for my goal: I used Sunshine as a server and Moonlight as a client, and logged when Sunshine receives the input from Moonlight. We can think of it as kernel receiving events since Sunshine creates virtual device and sends input there. Then I logged when application receives the event.
I checked the source code, and I believe the new throttling mechanism introduced in 9.13 version for input is the reason why it's so slow. If you re-implement the previous mechanism based on message count, input delay is almost 0. I wonder if CPU usage would spike though in real games.