update monado
This commit is contained in:
@@ -30,6 +30,7 @@ set(XRT_FEATURE_SLAM OFF)
|
||||
set(XRT_FEATURE_STEAMVR_PLUGIN OFF)
|
||||
set(XRT_FEATURE_WINDOW_PEEK OFF)
|
||||
set(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB ON)
|
||||
set(XRT_FEATURE_OPENXR_HAND_TRACKING_EXT ON)
|
||||
|
||||
set(XRT_HAVE_BLUETOOTH OFF)
|
||||
set(XRT_HAVE_GST OFF)
|
||||
|
||||
@@ -46,7 +46,7 @@ xrt_hand_joint_set hand_joints_list::interpolate(const xrt_hand_joint_set & a, c
|
||||
return j;
|
||||
}
|
||||
|
||||
xrt_hand_joint_set hand_joints_list::extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, uint64_t ta, uint64_t tb, uint64_t t)
|
||||
xrt_hand_joint_set hand_joints_list::extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, int64_t ta, int64_t tb, int64_t t)
|
||||
{
|
||||
xrt_hand_joint_set j = t <= ta ? a : b;
|
||||
// Only extrapolate the hand pose, individual joints are too noisy
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
const int hand_id;
|
||||
|
||||
static xrt_hand_joint_set interpolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, float t);
|
||||
static xrt_hand_joint_set extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, uint64_t ta, uint64_t tb, uint64_t t);
|
||||
static xrt_hand_joint_set extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, int64_t ta, int64_t tb, int64_t t);
|
||||
|
||||
hand_joints_list(int hand_id) :
|
||||
hand_id(hand_id) {}
|
||||
|
||||
@@ -86,7 +86,7 @@ protected:
|
||||
}
|
||||
|
||||
// Insert the new sample
|
||||
auto it = std::lower_bound(data.begin(), data.end(), t, [](TimedData & sample, uint64_t t) { return sample.at_timestamp_ns < t; });
|
||||
auto it = std::lower_bound(data.begin(), data.end(), t, [](TimedData & sample, int64_t t) { return sample.at_timestamp_ns < t; });
|
||||
if (it == data.end())
|
||||
data.emplace_back(sample, produced, t);
|
||||
else if (it->at_timestamp_ns == t)
|
||||
|
||||
@@ -35,7 +35,7 @@ xrt_space_relation pose_list::interpolate(const xrt_space_relation & a, const xr
|
||||
return result;
|
||||
}
|
||||
|
||||
xrt_space_relation pose_list::extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, uint64_t ta, uint64_t tb, uint64_t t)
|
||||
xrt_space_relation pose_list::extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, int64_t ta, int64_t tb, int64_t t)
|
||||
{
|
||||
float h = (tb - ta) / 1.e9;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
const xrt::drivers::wivrn::device_id device;
|
||||
|
||||
static xrt_space_relation interpolate(const xrt_space_relation & a, const xrt_space_relation & b, float t);
|
||||
static xrt_space_relation extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, uint64_t ta, uint64_t tb, uint64_t t);
|
||||
static xrt_space_relation extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, int64_t ta, int64_t tb, int64_t t);
|
||||
|
||||
pose_list(xrt::drivers::wivrn::device_id id) :
|
||||
device(id) {}
|
||||
|
||||
@@ -28,7 +28,7 @@ tracked_views view_list::interpolate(const tracked_views & a, const tracked_view
|
||||
return result;
|
||||
}
|
||||
|
||||
tracked_views view_list::extrapolate(const tracked_views & a, const tracked_views & b, uint64_t ta, uint64_t tb, uint64_t t)
|
||||
tracked_views view_list::extrapolate(const tracked_views & a, const tracked_views & b, int64_t ta, int64_t tb, int64_t t)
|
||||
{
|
||||
tracked_views result = t < ta ? a : b;
|
||||
result.relation = pose_list::extrapolate(a.relation, b.relation, ta, tb, t);
|
||||
|
||||
@@ -34,7 +34,7 @@ class view_list : public history<view_list, tracked_views>
|
||||
{
|
||||
public:
|
||||
static tracked_views interpolate(const tracked_views & a, const tracked_views & b, float t);
|
||||
static tracked_views extrapolate(const tracked_views & a, const tracked_views & b, uint64_t ta, uint64_t tb, uint64_t t);
|
||||
static tracked_views extrapolate(const tracked_views & a, const tracked_views & b, int64_t ta, int64_t tb, int64_t t);
|
||||
|
||||
bool update_tracking(const from_headset::tracking & tracking, const clock_offset & offset);
|
||||
};
|
||||
|
||||
@@ -262,9 +262,9 @@ static bool comp_wivrn_check_ready(struct comp_target * ct)
|
||||
cn->c->debug.atw_off = true;
|
||||
for (int eye = 0; eye < 2; ++eye)
|
||||
{
|
||||
const auto & slot = cn->c->base.slot;
|
||||
if (slot.layer_count > 1 or
|
||||
slot.layers[0].data.type != XRT_LAYER_PROJECTION)
|
||||
const auto & layer_accum = cn->c->base.layer_accum;
|
||||
if (layer_accum.layer_count > 1 or
|
||||
layer_accum.layers[0].data.type != XRT_LAYER_PROJECTION)
|
||||
{
|
||||
// We are not in the trivial single stereo projection layer
|
||||
// reprojection must be done
|
||||
@@ -320,8 +320,6 @@ static void comp_wivrn_create_images(struct comp_target * ct, const struct comp_
|
||||
{
|
||||
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
// Free old images.
|
||||
destroy_images(cn);
|
||||
|
||||
@@ -433,8 +431,8 @@ static VkResult comp_wivrn_present(struct comp_target * ct,
|
||||
VkQueue queue_,
|
||||
uint32_t index,
|
||||
uint64_t timeline_semaphore_value,
|
||||
uint64_t desired_present_time_ns,
|
||||
uint64_t present_slop_ns)
|
||||
int64_t desired_present_time_ns,
|
||||
int64_t present_slop_ns)
|
||||
{
|
||||
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
|
||||
|
||||
@@ -452,7 +450,7 @@ static VkResult comp_wivrn_present(struct comp_target * ct,
|
||||
.pWaitDstStageMask = &wait_stage,
|
||||
};
|
||||
|
||||
if (cn->c->base.slot.layer_count == 0 or not cn->cnx->get_offset())
|
||||
if (cn->c->base.layer_accum.layer_count == 0 or not cn->cnx->get_offset())
|
||||
{
|
||||
scoped_lock lock(vk->queue_mutex);
|
||||
cn->wivrn_bundle->queue.submit(submit_info);
|
||||
@@ -489,19 +487,19 @@ static VkResult comp_wivrn_present(struct comp_target * ct,
|
||||
view_info.display_time = cn->cnx->get_offset().to_headset(info.predicted_display_time);
|
||||
for (int eye = 0; eye < 2; ++eye)
|
||||
{
|
||||
const auto & slot = cn->c->base.slot;
|
||||
view_info.fov[eye] = xrt_cast(slot.fovs[eye]);
|
||||
view_info.pose[eye] = xrt_cast(slot.poses[eye]);
|
||||
const auto & frame_params = cn->c->base.frame_params;
|
||||
view_info.fov[eye] = xrt_cast(frame_params.fovs[eye]);
|
||||
view_info.pose[eye] = xrt_cast(frame_params.poses[eye]);
|
||||
if (cn->c->debug.atw_off)
|
||||
{
|
||||
const auto & proj = slot.layers[0].data.proj;
|
||||
const auto & proj = cn->c->base.layer_accum.layers[0].data.proj;
|
||||
view_info.pose[eye] = xrt_cast(proj.v[eye].pose);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrt_relation_chain xrc{};
|
||||
xrt_space_relation result{};
|
||||
m_relation_chain_push_pose_if_not_identity(&xrc, &slot.poses[eye]);
|
||||
m_relation_chain_push_pose_if_not_identity(&xrc, &frame_params.poses[eye]);
|
||||
m_relation_chain_resolve(&xrc, &result);
|
||||
view_info.pose[eye] = xrt_cast(result.pose);
|
||||
}
|
||||
@@ -540,10 +538,10 @@ static void comp_wivrn_flush(struct comp_target * ct)
|
||||
|
||||
static void comp_wivrn_calc_frame_pacing(struct comp_target * ct,
|
||||
int64_t * out_frame_id,
|
||||
uint64_t * out_wake_up_time_ns,
|
||||
uint64_t * out_desired_present_time_ns,
|
||||
uint64_t * out_present_slop_ns,
|
||||
uint64_t * out_predicted_display_time_ns)
|
||||
int64_t * out_wake_up_time_ns,
|
||||
int64_t * out_desired_present_time_ns,
|
||||
int64_t * out_present_slop_ns,
|
||||
int64_t * out_predicted_display_time_ns)
|
||||
{
|
||||
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
|
||||
|
||||
@@ -558,7 +556,7 @@ static void comp_wivrn_calc_frame_pacing(struct comp_target * ct,
|
||||
static void comp_wivrn_mark_timing_point(struct comp_target * ct,
|
||||
enum comp_target_timing_point point,
|
||||
int64_t frame_id,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
|
||||
|
||||
@@ -603,7 +601,7 @@ static void comp_wivrn_destroy(struct comp_target * ct)
|
||||
delete (struct wivrn_comp_target *)ct;
|
||||
}
|
||||
|
||||
static void comp_wivrn_info_gpu(struct comp_target * ct, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns)
|
||||
static void comp_wivrn_info_gpu(struct comp_target * ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
}
|
||||
|
||||
@@ -135,14 +135,14 @@ static void wivrn_controller_destroy(xrt_device * xdev);
|
||||
|
||||
static void wivrn_controller_get_tracked_pose(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
xrt_space_relation * out_relation);
|
||||
|
||||
static void wivrn_controller_get_hand_tracking(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t desired_timestamp_ns,
|
||||
int64_t desired_timestamp_ns,
|
||||
xrt_hand_joint_set * out_value,
|
||||
uint64_t * out_timestamp_ns);
|
||||
int64_t * out_timestamp_ns);
|
||||
|
||||
static void wivrn_controller_set_output(struct xrt_device * xdev, enum xrt_output_name name, const union xrt_output_value * value);
|
||||
|
||||
@@ -261,7 +261,7 @@ void wivrn_controller::set_inputs(const from_headset::inputs & inputs, const clo
|
||||
}
|
||||
}
|
||||
|
||||
void wivrn_controller::set_inputs(device_id input_id, float value, uint64_t last_change_time)
|
||||
void wivrn_controller::set_inputs(device_id input_id, float value, int64_t last_change_time)
|
||||
{
|
||||
const struct wivrn_to_wivrn_controller_input * bindings;
|
||||
size_t bindings_count;
|
||||
@@ -307,7 +307,7 @@ void wivrn_controller::set_inputs(device_id input_id, float value, uint64_t last
|
||||
}
|
||||
}
|
||||
|
||||
xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns)
|
||||
xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns)
|
||||
{
|
||||
std::chrono::nanoseconds extrapolation_time;
|
||||
xrt_space_relation res;
|
||||
@@ -329,7 +329,7 @@ xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, uint6
|
||||
return res;
|
||||
}
|
||||
|
||||
std::pair<xrt_hand_joint_set, uint64_t> wivrn_controller::get_hand_tracking(xrt_input_name name, uint64_t desired_timestamp_ns)
|
||||
std::pair<xrt_hand_joint_set, int64_t> wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
@@ -398,7 +398,7 @@ static void wivrn_controller_update_inputs(xrt_device * xdev)
|
||||
|
||||
static void wivrn_controller_get_tracked_pose(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
xrt_space_relation * out_relation)
|
||||
{
|
||||
*out_relation = static_cast<wivrn_controller *>(xdev)->get_tracked_pose(name, at_timestamp_ns);
|
||||
@@ -406,9 +406,9 @@ static void wivrn_controller_get_tracked_pose(xrt_device * xdev,
|
||||
|
||||
static void wivrn_controller_get_hand_tracking(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t desired_timestamp_ns,
|
||||
int64_t desired_timestamp_ns,
|
||||
xrt_hand_joint_set * out_value,
|
||||
uint64_t * out_timestamp_ns)
|
||||
int64_t * out_timestamp_ns)
|
||||
{
|
||||
std::tie(*out_value, *out_timestamp_ns) = static_cast<wivrn_controller *>(xdev)->get_hand_tracking(name, desired_timestamp_ns);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
}
|
||||
void update_inputs();
|
||||
|
||||
xrt_space_relation get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns);
|
||||
std::pair<xrt_hand_joint_set, uint64_t> get_hand_tracking(xrt_input_name name, uint64_t desired_timestamp_ns);
|
||||
xrt_space_relation get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns);
|
||||
std::pair<xrt_hand_joint_set, int64_t> get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns);
|
||||
|
||||
void set_output(xrt_output_name name, const xrt_output_value * value);
|
||||
|
||||
@@ -63,5 +63,5 @@ public:
|
||||
void update_hand_tracking(const from_headset::hand_tracking &, const clock_offset &);
|
||||
|
||||
private:
|
||||
void set_inputs(device_id input_id, float value, uint64_t last_change_time);
|
||||
void set_inputs(device_id input_id, float value, int64_t last_change_time);
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ static void wivrn_eye_tracker_update_inputs(xrt_device * xdev);
|
||||
|
||||
static void wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
xrt_space_relation * out_relation);
|
||||
|
||||
wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd,
|
||||
@@ -70,7 +70,7 @@ void wivrn_eye_tracker::update_inputs()
|
||||
// Empty
|
||||
}
|
||||
|
||||
xrt_space_relation wivrn_eye_tracker::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns)
|
||||
xrt_space_relation wivrn_eye_tracker::get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns)
|
||||
{
|
||||
if (name == XRT_INPUT_GENERIC_EYE_GAZE_POSE)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ static void wivrn_eye_tracker_update_inputs(xrt_device * xdev)
|
||||
|
||||
static void wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
xrt_space_relation * out_relation)
|
||||
{
|
||||
*out_relation = static_cast<wivrn_eye_tracker *>(xdev)->get_tracked_pose(name, at_timestamp_ns);
|
||||
|
||||
@@ -49,5 +49,5 @@ public:
|
||||
|
||||
void update_inputs();
|
||||
void update_tracking(const from_headset::tracking &, const clock_offset &);
|
||||
xrt_space_relation get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns);
|
||||
xrt_space_relation get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns);
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "xrt/xrt_results.h"
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -37,6 +38,7 @@ static void wivrn_fb_face2_tracker_update_inputs(xrt_device * xdev);
|
||||
|
||||
static xrt_result_t wivrn_fb_face2_tracker_get_face_tracking(struct xrt_device * xdev,
|
||||
enum xrt_input_name facial_expression_type,
|
||||
int64_t at_timestamp_ns,
|
||||
struct xrt_facial_expression_set * out_value);
|
||||
|
||||
wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd,
|
||||
@@ -83,12 +85,12 @@ void wivrn_fb_face2_tracker::update_tracking(const from_headset::fb_face2 & face
|
||||
cnx->set_enabled(to_headset::tracking_control::id::face, false);
|
||||
}
|
||||
|
||||
xrt_result_t wivrn_fb_face2_tracker::get_face_tracking(enum xrt_input_name facial_expression_type, struct xrt_facial_expression_set * inout_value)
|
||||
xrt_result_t wivrn_fb_face2_tracker::get_face_tracking(enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set * inout_value)
|
||||
{
|
||||
if (facial_expression_type == XRT_INPUT_FB_FACE_TRACKING2_VISUAL)
|
||||
{
|
||||
cnx->set_enabled(to_headset::tracking_control::id::face, true);
|
||||
auto [_, data] = face_list.get_at(inout_value->face_expression_set2_fb.sample_time_ns);
|
||||
auto [_, data] = face_list.get_at(at_timestamp_ns);
|
||||
|
||||
inout_value->face_expression_set2_fb.is_valid = data.is_valid;
|
||||
|
||||
@@ -126,7 +128,8 @@ static void wivrn_fb_face2_tracker_update_inputs(xrt_device * xdev)
|
||||
|
||||
static xrt_result_t wivrn_fb_face2_tracker_get_face_tracking(struct xrt_device * xdev,
|
||||
enum xrt_input_name facial_expression_type,
|
||||
int64_t at_timestamp_ns,
|
||||
struct xrt_facial_expression_set * inout_value)
|
||||
{
|
||||
return static_cast<wivrn_fb_face2_tracker *>(xdev)->get_face_tracking(facial_expression_type, inout_value);
|
||||
return static_cast<wivrn_fb_face2_tracker *>(xdev)->get_face_tracking(facial_expression_type, at_timestamp_ns, inout_value);
|
||||
}
|
||||
|
||||
@@ -97,5 +97,5 @@ public:
|
||||
|
||||
void update_inputs();
|
||||
void update_tracking(const from_headset::fb_face2 &, const clock_offset &);
|
||||
xrt_result_t get_face_tracking(enum xrt_input_name facial_expression_type, struct xrt_facial_expression_set * out_value);
|
||||
xrt_result_t get_face_tracking(enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set * out_value);
|
||||
};
|
||||
|
||||
@@ -58,12 +58,12 @@ static void wivrn_hmd_update_inputs(xrt_device * xdev);
|
||||
|
||||
static void wivrn_hmd_get_tracked_pose(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
xrt_space_relation * out_relation);
|
||||
|
||||
static void wivrn_hmd_get_view_poses(xrt_device * xdev,
|
||||
const xrt_vec3 * default_eye_relation,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
@@ -264,7 +264,7 @@ void wivrn_hmd::update_inputs()
|
||||
// Empty
|
||||
}
|
||||
|
||||
xrt_space_relation wivrn_hmd::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns)
|
||||
xrt_space_relation wivrn_hmd::get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns)
|
||||
{
|
||||
if (name != XRT_INPUT_GENERIC_HEAD_POSE)
|
||||
{
|
||||
@@ -291,7 +291,7 @@ void wivrn_hmd::update_battery(const from_headset::battery & new_battery)
|
||||
}
|
||||
|
||||
void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
@@ -431,7 +431,7 @@ static void wivrn_hmd_update_inputs(xrt_device * xdev)
|
||||
|
||||
static void wivrn_hmd_get_tracked_pose(xrt_device * xdev,
|
||||
xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
xrt_space_relation * out_relation)
|
||||
{
|
||||
*out_relation = static_cast<wivrn_hmd *>(xdev)->get_tracked_pose(name, at_timestamp_ns);
|
||||
@@ -439,7 +439,7 @@ static void wivrn_hmd_get_tracked_pose(xrt_device * xdev,
|
||||
|
||||
static void wivrn_hmd_get_view_poses(xrt_device * xdev,
|
||||
const xrt_vec3 * default_eye_relation,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
|
||||
@@ -63,10 +63,10 @@ public:
|
||||
}
|
||||
|
||||
void update_inputs();
|
||||
xrt_space_relation get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns);
|
||||
xrt_space_relation get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns);
|
||||
comp_target * create_compositor_target(struct comp_compositor * comp);
|
||||
void get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
uint64_t at_timestamp_ns,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
|
||||
@@ -37,16 +37,16 @@ void wivrn_pacer::set_stream_count(size_t count)
|
||||
|
||||
void wivrn_pacer::predict(
|
||||
int64_t & frame_id,
|
||||
uint64_t & out_wake_up_time_ns,
|
||||
uint64_t & out_desired_present_time_ns,
|
||||
uint64_t & out_present_slop_ns,
|
||||
uint64_t & out_predicted_display_time_ns)
|
||||
int64_t & out_wake_up_time_ns,
|
||||
int64_t & out_desired_present_time_ns,
|
||||
int64_t & out_present_slop_ns,
|
||||
int64_t & out_predicted_display_time_ns)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
frame_id = this->frame_id++;
|
||||
auto now = os_monotonic_get_ns();
|
||||
|
||||
uint64_t predicted_client_render = last_ns + frame_duration_ns;
|
||||
int64_t predicted_client_render = last_ns + frame_duration_ns;
|
||||
// snap to phase
|
||||
predicted_client_render = (predicted_client_render / frame_duration_ns) * frame_duration_ns + client_render_phase_ns;
|
||||
|
||||
@@ -89,7 +89,7 @@ void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback
|
||||
|
||||
if (feedback.stream_index == 0)
|
||||
{
|
||||
uint64_t safe_time = 0;
|
||||
int64_t safe_time = 0;
|
||||
for (const auto & stream: streams)
|
||||
{
|
||||
if (stream.times.size() >= min_wait_times)
|
||||
@@ -109,7 +109,7 @@ void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback
|
||||
time_variance /= (stream.times.size() - 1);
|
||||
double time_std_dev = std::sqrt(time_variance);
|
||||
|
||||
safe_time = std::max<uint64_t>(safe_time, mean_time + 3 * time_std_dev);
|
||||
safe_time = std::max<int64_t>(safe_time, mean_time + 3 * time_std_dev);
|
||||
}
|
||||
}
|
||||
if (safe_time > 0 and safe_time < 100'000'000)
|
||||
@@ -124,7 +124,7 @@ void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback
|
||||
void wivrn_pacer::mark_timing_point(
|
||||
comp_target_timing_point point,
|
||||
int64_t frame_id,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
switch (point)
|
||||
@@ -149,7 +149,7 @@ void wivrn_pacer::mark_timing_point(
|
||||
}
|
||||
}
|
||||
|
||||
wivrn_pacer::frame_info wivrn_pacer::present_to_info(uint64_t present)
|
||||
wivrn_pacer::frame_info wivrn_pacer::present_to_info(int64_t present)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
for (const auto & info: in_flight_frames)
|
||||
|
||||
+14
-14
@@ -35,22 +35,22 @@ public:
|
||||
struct frame_info
|
||||
{
|
||||
int64_t frame_id;
|
||||
uint64_t present_ns;
|
||||
uint64_t predicted_display_time;
|
||||
int64_t present_ns;
|
||||
int64_t predicted_display_time;
|
||||
};
|
||||
|
||||
private:
|
||||
std::mutex mutex;
|
||||
uint64_t last_ns = 0;
|
||||
int64_t last_ns = 0;
|
||||
int64_t frame_id = 0;
|
||||
|
||||
uint64_t client_render_phase_ns = 0;
|
||||
int64_t client_render_phase_ns = 0;
|
||||
|
||||
uint64_t mean_wake_up_to_present_ns = 1'000'000;
|
||||
uint64_t safe_present_to_decoded_ns = 0;
|
||||
uint64_t mean_render_to_display_ns = 0;
|
||||
int64_t mean_wake_up_to_present_ns = 1'000'000;
|
||||
int64_t safe_present_to_decoded_ns = 0;
|
||||
int64_t mean_render_to_display_ns = 0;
|
||||
|
||||
uint64_t last_wake_up_ns = 0;
|
||||
int64_t last_wake_up_ns = 0;
|
||||
|
||||
// Client wait time for each decoder
|
||||
struct stream_data
|
||||
@@ -73,19 +73,19 @@ public:
|
||||
|
||||
void predict(
|
||||
int64_t & out_frame_id,
|
||||
uint64_t & out_wake_up_time_ns,
|
||||
uint64_t & out_desired_present_time_ns,
|
||||
uint64_t & out_present_slop_ns,
|
||||
uint64_t & out_predicted_display_time_ns);
|
||||
int64_t & out_wake_up_time_ns,
|
||||
int64_t & out_desired_present_time_ns,
|
||||
int64_t & out_present_slop_ns,
|
||||
int64_t & out_predicted_display_time_ns);
|
||||
|
||||
void on_feedback(const xrt::drivers::wivrn::from_headset::feedback &, const clock_offset &);
|
||||
|
||||
void mark_timing_point(
|
||||
comp_target_timing_point point,
|
||||
int64_t frame_id,
|
||||
uint64_t when_ns);
|
||||
int64_t when_ns);
|
||||
|
||||
frame_info present_to_info(uint64_t present);
|
||||
frame_info present_to_info(int64_t present);
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
||||
@@ -457,7 +457,7 @@ std::array<to_headset::foveation_parameter, 2> wivrn_session::get_foveation_para
|
||||
return hmd->get_foveation_parameters();
|
||||
}
|
||||
|
||||
void wivrn_session::dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream, const char * extra)
|
||||
void wivrn_session::dump_time(const std::string & event, uint64_t frame, int64_t time, uint8_t stream, const char * extra)
|
||||
{
|
||||
if (feedback_csv)
|
||||
{
|
||||
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
return (bool)foveation;
|
||||
}
|
||||
|
||||
void dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream = -1, const char * extra = "");
|
||||
void dump_time(const std::string & event, uint64_t frame, int64_t time, uint8_t stream = -1, const char * extra = "");
|
||||
|
||||
private:
|
||||
static void run(std::weak_ptr<wivrn_session>);
|
||||
|
||||
Reference in New Issue
Block a user