t/hand: Reduce relation history lock contention

Relation history was being accessed guarded by an external lock in a couple of
places. This is redundant since its implementation already defines an internal
lock.
This commit is contained in:
Mateo de Mayo 2023-09-07 11:41:15 -03:00 committed by Jakob Bornecrantz
parent c6ca7d2339
commit d486338985

View file

@ -129,7 +129,11 @@ ht_async_mainloop(void *ptr)
for (int i = 0; i < 2; i++) {
hta->present.hands[i] = hta->working.hands[i];
}
os_mutex_unlock(&hta->present.mutex);
for (int i = 0; i < 2; i++) {
struct xrt_space_relation wrist_rel =
hta->working.hands[i].values.hand_joint_set_default[XRT_HAND_JOINT_WRIST].relation;
@ -145,8 +149,6 @@ ht_async_mainloop(void *ptr)
hta->working.timestamp); //
}
os_mutex_unlock(&hta->present.mutex);
hta->hand_tracking_work_active = false;
// Have to lock it again.
@ -280,6 +282,8 @@ ht_async_get_hand(struct t_hand_tracking_async *ht_async,
return;
}
os_mutex_unlock(&hta->present.mutex);
double prediction_offset_ns = (double)hta->prediction_offset_ms.val * (double)U_TIME_1MS_IN_NS;
desired_timestamp_ns += (uint64_t)prediction_offset_ns;
@ -287,8 +291,6 @@ ht_async_get_hand(struct t_hand_tracking_async *ht_async,
struct xrt_space_relation predicted_wrist;
m_relation_history_get(hta->present.relation_hist[idx], desired_timestamp_ns, &predicted_wrist);
os_mutex_unlock(&hta->present.mutex);
struct xrt_space_relation latest_wrist =
latest_hand.values.hand_joint_set_default[XRT_HAND_JOINT_WRIST].relation;