From c6d25a9773269708c8a2d089cd9dc9721e7413f4 Mon Sep 17 00:00:00 2001 From: Christoph Haag <christoph.haag@collabora.com> Date: Thu, 25 Jun 2020 19:18:55 +0200 Subject: [PATCH] st/oxr: Convert action timestamp with time_state_monotonic_to_ts_ns Action timestamps were missing this conversion to XrTime with time_state_monotonic_to_ts_ns() which caused them to be out of sync with the predicted frame times and device "pose at" timestamps. --- src/xrt/state_trackers/oxr/oxr_input.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/xrt/state_trackers/oxr/oxr_input.c b/src/xrt/state_trackers/oxr/oxr_input.c index 579bc886e..8cb9508cd 100644 --- a/src/xrt/state_trackers/oxr/oxr_input.c +++ b/src/xrt/state_trackers/oxr/oxr_input.c @@ -1333,13 +1333,15 @@ oxr_action_sync_data(struct oxr_logger *log, #define OXR_ACTION_GET_XR_STATE_FROM_ACTION_STATE_COMMON(ACTION_STATE, DATA) \ do { \ - DATA->lastChangeTime = ACTION_STATE->timestamp; \ + DATA->lastChangeTime = time_state_monotonic_to_ts_ns( \ + inst->timekeeping, ACTION_STATE->timestamp); \ DATA->changedSinceLastSync = ACTION_STATE->changed; \ DATA->isActive = XR_TRUE; \ } while (0) static void -get_xr_state_from_action_state_bool(struct oxr_action_state *state, +get_xr_state_from_action_state_bool(struct oxr_instance *inst, + struct oxr_action_state *state, XrActionStateBoolean *data) { /* only get here if the action is active! */ @@ -1349,7 +1351,8 @@ get_xr_state_from_action_state_bool(struct oxr_action_state *state, } static void -get_xr_state_from_action_state_vec1(struct oxr_action_state *state, +get_xr_state_from_action_state_vec1(struct oxr_instance *inst, + struct oxr_action_state *state, XrActionStateFloat *data) { /* only get here if the action is active! */ @@ -1359,7 +1362,8 @@ get_xr_state_from_action_state_vec1(struct oxr_action_state *state, } static void -get_xr_state_from_action_state_vec2(struct oxr_action_state *state, +get_xr_state_from_action_state_vec2(struct oxr_instance *inst, + struct oxr_action_state *state, XrActionStateVector2f *data) { /* only get here if the action is active! */ @@ -1372,27 +1376,27 @@ get_xr_state_from_action_state_vec2(struct oxr_action_state *state, #define OXR_ACTION_GET_FILLER(TYPE) \ if (sub_paths.any && act_attached->any_state.active) { \ get_xr_state_from_action_state_##TYPE( \ - &act_attached->any_state, data); \ + sess->sys->inst, &act_attached->any_state, data); \ } \ if (sub_paths.user && act_attached->user.current.active) { \ get_xr_state_from_action_state_##TYPE( \ - &act_attached->user.current, data); \ + sess->sys->inst, &act_attached->user.current, data); \ } \ if (sub_paths.head && act_attached->head.current.active) { \ get_xr_state_from_action_state_##TYPE( \ - &act_attached->head.current, data); \ + sess->sys->inst, &act_attached->head.current, data); \ } \ if (sub_paths.left && act_attached->left.current.active) { \ get_xr_state_from_action_state_##TYPE( \ - &act_attached->left.current, data); \ + sess->sys->inst, &act_attached->left.current, data); \ } \ if (sub_paths.right && act_attached->right.current.active) { \ get_xr_state_from_action_state_##TYPE( \ - &act_attached->right.current, data); \ + sess->sys->inst, &act_attached->right.current, data); \ } \ if (sub_paths.gamepad && act_attached->gamepad.current.active) { \ get_xr_state_from_action_state_##TYPE( \ - &act_attached->gamepad.current, data); \ + sess->sys->inst, &act_attached->gamepad.current, data); \ } /*! -- GitLab