https://bugs.winehq.org/show_bug.cgi?id=47491
Bug ID: 47491 Summary: dinput event queue is overflowing and stalling the whole game/wineserver Product: Wine Version: 4.2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-dinput Assignee: wine-bugs@winehq.org Reporter: stefan.riesenberger@gmail.com Distribution: ---
Created attachment 64873 --> https://bugs.winehq.org/attachment.cgi?id=64873 Achive with a +dinput log of 125hz and 1000hz pollrate mouse movement
The game tested was Borderlands 1 Enhanced Edition via Proton (not a Proton issue though), because it is one of the most severe examples of this issue. The game completely freezes when moving the mouse with the pollrate set to 1000Hz. It only unfreezes when the mouse isn't moving anymore. This issue occurs in multiple games resulting in huge framedrops when moving the mouse. A temporary workaround is to set the mouse pollrate to 125Hz, but it's not a real solution to the problem.
As already mentioned in the title the event queue of dinput is constantly overflowing which blocks anything else running on the wineserver. I attached 2 logs with +dinput. Both were recorded for the same amount of time, one containing the overflow with 1000Hz and one recorded at 125Hz.
My guess is that this problem occurs due to the single threaded nature of wineserver and the huge amount of input data that arrives from the mouse. The most elegant solution would probably be to move the input processing and handling as much as possible outside of wineserver (glancing at esync), but I am no expert in that regard.
kind regards, Riesi
https://bugs.winehq.org/show_bug.cgi?id=47491
--- Comment #1 from Stefan Riesenberger stefan.riesenberger@gmail.com --- Created attachment 64874 --> https://bugs.winehq.org/attachment.cgi?id=64874 Sekiro Shadows Die Twice log with +dinput on 1000Hz pollrate
Ok looks like the queue overflow is not the only thing blocking things... Here is a log of Sekiro Shadows Die Twice. The log looks quite interesting, since it seems to be doing the same thing in a loop. 75MB for approximately the same amount of mouse input as Borderlands 1 is quite hefty in my opinion.
... 002a:trace:dinput:fill_DataFormat Copying (c) to 252 default value 0 002a:trace:dinput:fill_DataFormat Copying (c) to 253 default value 0 002a:trace:dinput:fill_DataFormat Copying (c) to 254 default value 0 002a:trace:dinput:fill_DataFormat Copying (c) to 255 default value 0 002a:trace:dinput:SysMouseWImpl_GetDeviceState (0x9198750)->(20,0x9198b30) 002a:trace:dinput:_dump_mouse_state (X: 0 Y: 0 Z: 0 B0: 00 B1: 00 B2: 00 B3: 00 B4: 00) 002a:trace:dinput:SysKeyboardWImpl_GetDeviceState (0x919d9c0)->(256,0x919f570) 002a:trace:dinput:fill_DataFormat Copying (c) to 1 from 1 (value 0) 002a:trace:dinput:fill_DataFormat Copying (c) to 2 from 2 (value 0) 002a:trace:dinput:fill_DataFormat Copying (c) to 3 from 3 (value 0) ...
https://bugs.winehq.org/show_bug.cgi?id=47491
--- Comment #2 from Stefan Riesenberger stefan.riesenberger@gmail.com --- I did some measurements of the execution time of `IDirectInputDevice2WImpl_GetDeviceData()` in Borderlands with the `clock()` function of time.h and the time varies a lot between the two pollrates:
125hz pollrate: average 0.00008956s maximum 0.00363s
1000hz pollrate: average 0.000320399s maximum 0.006869s
I also measured `fill_DataFormat()` and its execution time was not really that long, so I will have to investigate this a bit further on what's causing the issue in Sekiro.
https://bugs.winehq.org/show_bug.cgi?id=47491
c6539290@urhen.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |c6539290@urhen.com
https://bugs.winehq.org/show_bug.cgi?id=47491
Rémi Bernon rbernon@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rbernon@codeweavers.com
--- Comment #3 from Rémi Bernon rbernon@codeweavers.com --- Wine 5.15 has several dinput/mouse related improvements, this should have improved. Could you try again?
https://bugs.winehq.org/show_bug.cgi?id=47491
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Gijs Vermeulen gijsvrm@gmail.com --- Stefan confirmed on Discord that this issue is gone, marking FIXED.
https://bugs.winehq.org/show_bug.cgi?id=47491
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.18.