From 67a8147c0907562df64b0b5d148f5f950ab9ddba Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 23 May 2023 10:13:34 +0100 Subject: [PATCH] d/dai: Try to set realtime priority on IMU thread --- src/xrt/drivers/depthai/depthai_driver.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/xrt/drivers/depthai/depthai_driver.cpp b/src/xrt/drivers/depthai/depthai_driver.cpp index 7fa85cdae..59ca73447 100644 --- a/src/xrt/drivers/depthai/depthai_driver.cpp +++ b/src/xrt/drivers/depthai/depthai_driver.cpp @@ -25,6 +25,10 @@ #include "util/u_logging.h" #include "util/u_trace_marker.h" +#ifdef XRT_OS_LINUX +#include "util/u_linux.h" +#endif + #include "tracking/t_tracking.h" #include "depthai_interface.h" @@ -616,6 +620,11 @@ depthai_imu_mainloop(void *ptr) U_TRACE_SET_THREAD_NAME("DepthAI: IMU"); os_thread_helper_name(&depthai->imu_thread, "DepthAI: IMU"); +#ifdef XRT_OS_LINUX + // Try to raise priority of this thread. + u_linux_try_to_set_realtime_priority_on_thread(depthai->log_level, "DepthAI: IMU"); +#endif + DEPTHAI_DEBUG(depthai, "DepthAI: IMU thread called"); os_thread_helper_lock(&depthai->imu_thread);