From cc263e257986b79444fa482bae17c4449fc71d37 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 22 May 2023 22:30:28 +0100 Subject: [PATCH] d/wmr: Try to set realtime priority on USB thread --- src/xrt/drivers/wmr/wmr_hmd.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index 26d3e93ad..d88228a58 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -38,6 +38,10 @@ #include "util/u_distortion_mesh.h" #include "util/u_sink.h" +#ifdef XRT_OS_LINUX +#include "util/u_linux.h" +#endif + #include "tracking/t_tracking.h" #include "wmr_hmd.h" @@ -646,10 +650,17 @@ control_read_packets(struct wmr_hmd *wh) static void * wmr_run_thread(void *ptr) { - U_TRACE_SET_THREAD_NAME("WMR: USB-HMD"); - struct wmr_hmd *wh = (struct wmr_hmd *)ptr; + U_TRACE_SET_THREAD_NAME("WMR: USB-HMD"); + os_thread_helper_name(&wh->oth, "WMR: USB-HMD"); + +#ifdef XRT_OS_LINUX + // Try to raise priority of this thread. + u_linux_try_to_set_realtime_priority_on_thread(wh->log_level, "WMR: USB-HMD"); +#endif + + os_thread_helper_lock(&wh->oth); while (os_thread_helper_is_running_locked(&wh->oth)) { os_thread_helper_unlock(&wh->oth);