This potentially reduces lag and makes the input device initialization faster under CPU load.
Signed-off-by: Kai Krakow kai@kaishome.de --- dlls/winebus.sys/bus_iohid.c | 1 + dlls/winebus.sys/bus_sdl.c | 2 ++ dlls/winebus.sys/bus_udev.c | 9 +++++++-- 3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 95077ac0be2..b4f7dabb153 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -410,6 +410,7 @@ NTSTATUS WINAPI iohid_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registr return STATUS_UNSUCCESSFUL; }
+ SetThreadPriority(run_loop_handle, THREAD_PRIORITY_TIME_CRITICAL); return STATUS_SUCCESS; }
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 5cf5dddaf05..41f203f6e36 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -976,6 +976,8 @@ NTSTATUS WINAPI sdl_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_ goto error; }
+ SetThreadPriority(events[1], THREAD_PRIORITY_TIME_CRITICAL); + result = WaitForMultipleObjects(2, events, FALSE, INFINITE); CloseHandle(events[0]); CloseHandle(events[1]); diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 64b245e630d..10b79dcc6b1 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -795,8 +795,9 @@ static NTSTATUS begin_report_processing(DEVICE_OBJECT *device) close(private->control_pipe[1]); return STATUS_UNSUCCESSFUL; } - else - return STATUS_SUCCESS; + + SetThreadPriority(private->report_thread, THREAD_PRIORITY_TIME_CRITICAL); + return STATUS_SUCCESS; }
static NTSTATUS hidraw_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *written) @@ -1006,6 +1007,8 @@ static NTSTATUS lnxev_begin_report_processing(DEVICE_OBJECT *device) close(private->base.control_pipe[1]); return STATUS_UNSUCCESSFUL; } + + SetThreadPriority(private->base.report_thread, THREAD_PRIORITY_TIME_CRITICAL); return STATUS_SUCCESS; }
@@ -1462,6 +1465,8 @@ NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry goto error; }
+ SetThreadPriority(events[1], THREAD_PRIORITY_TIME_CRITICAL); + result = WaitForMultipleObjects(2, events, FALSE, INFINITE); CloseHandle(events[0]); CloseHandle(events[1]);
This potentially reduces lag and makes the input device initialization faster under CPU load.
Signed-off-by: Kai Krakow kai@kaishome.de --- dlls/dinput/dinput_main.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 6ed764e7485..8b6f393cd45 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1815,6 +1815,7 @@ static BOOL check_hook_thread(void) } else if (list_empty(&direct_input_list) && hook_thread) { + SetThreadPriority(hook_thread, THREAD_PRIORITY_TIME_CRITICAL); DWORD tid = hook_thread_id;
hook_thread_id = 0;
On Fri, Dec 7, 2018 at 12:01 PM Kai Krakow kai@kaishome.de wrote:
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 6ed764e7485..8b6f393cd45 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1815,6 +1815,7 @@ static BOOL check_hook_thread(void) } else if (list_empty(&direct_input_list) && hook_thread) {
SetThreadPriority(hook_thread, THREAD_PRIORITY_TIME_CRITICAL); DWORD tid = hook_thread_id; hook_thread_id = 0;
To avoid compiler warnings, the call to SetThreadPriority needs to go after DWORD tid is declared.
-Alex
Am Mo., 10. Dez. 2018 um 19:39 Uhr schrieb Alex Henrie alexhenrie24@gmail.com:
On Fri, Dec 7, 2018 at 12:01 PM Kai Krakow kai@kaishome.de wrote:
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 6ed764e7485..8b6f393cd45 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1815,6 +1815,7 @@ static BOOL check_hook_thread(void) } else if (list_empty(&direct_input_list) && hook_thread) {
SetThreadPriority(hook_thread, THREAD_PRIORITY_TIME_CRITICAL); DWORD tid = hook_thread_id; hook_thread_id = 0;
To avoid compiler warnings, the call to SetThreadPriority needs to go after DWORD tid is declared.
Thanks for noticing. I've resent a v2 patch.
BTW: Under staging, this (and the other patch) seems to fix occasional drops of trigger axis events. At least I no longer have an issue with "stuck" gamepad triggers. Without staging, it obviously does nothing.
Regards, Kai