This potentially reduces lag and makes the input device initialization
faster under CPU load.
Signed-off-by: Kai Krakow <kai(a)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]);
--
2.19.2