Repository navigation
Conversation
Wine's input thread takes the DirectInput device lock and keeps it for as long as reports are queued for the device: hid_joystick_read loops on ReadFile inside the lock. Poll and GetDeviceState take the same lock, so a game that polls the wheel from its physics thread stalls behind it. A capture from the reporter of #121 shows Assetto Corsa EVO's physics thread waiting there in 13 of 40 samples while the input thread sat in ReadFile in 29. The proxy now refreshes the state on a thread of its own, once a millisecond, and answers the game's Poll and GetDeviceState from the last successful copy. Failures and everything that changes what the state means (Acquire, Unacquire, SetDataFormat, SetProperty, SetCooperativeLevel) still go to the real device. Logitech game controllers only. LOGI_POLL_CACHE=0 switches it off. Bench, a virtual wheel at 1 kHz with a 4 s flood of 64 kHz and a program polling 1000 times a second: the longest poll was 5.9 s without the cache and 0.13 ms with it. Not yet tried in a game.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Refs #121.
Wine's input thread keeps the DirectInput device lock for as long as reports are queued for the device (
hid_joystick_readloops onReadFileinside the lock).PollandGetDeviceStatetake the same lock, so a game that polls the wheel from its physics thread stalls behind it. The reporter's capture shows Assetto Corsa EVO's physics thread waiting there in 13 of 40 samples.The escape proxy now refreshes the state on its own thread once a millisecond and answers the game's
PollandGetDeviceStatefrom the last successful copy.Acquire,Unacquire,SetDataFormat,SetPropertyandSetCooperativeLeveldrop the copy, so the next read goes to the real device.LOGI_POLL_CACHE=0switches it off.Tested
Bench only (virtual wheel at 1 kHz with a 4 s flood of 64 kHz, a program polling 1000 times a second, Proton Experimental):
check-committed-dlls.sh --verify-bytespasses for the rebuilt DLL.Not tested
Draft until it has run in Assetto Corsa EVO on a real wheel. Known limit: the first read after a format change or an acquire still goes to Wine.