mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-28 07:01:21 +01:00
xrt: adapt driver to new get_view_poses api change
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2365>
This commit is contained in:
1 parent
ad8cfaa90a
commit
bb9bcee2a3
17 files changed
+140
-156
No files matched your search
@@ -451,7 +451,7 @@ u_device_get_view_pose(const struct xrt_vec3 *eye_relation, uint32_t view_index,
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
xrt_result_t
|
||||
u_device_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -460,7 +460,11 @@ u_device_get_view_poses(struct xrt_device *xdev,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
xrt_device_get_tracked_pose(xdev, XRT_INPUT_GENERIC_HEAD_POSE, at_timestamp_ns, out_head_relation);
|
||||
xrt_result_t xret =
|
||||
xrt_device_get_tracked_pose(xdev, XRT_INPUT_GENERIC_HEAD_POSE, at_timestamp_ns, out_head_relation);
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < view_count && i < ARRAY_SIZE(xdev->hmd->views); i++) {
|
||||
out_fovs[i] = xdev->hmd->distortion.fov[i];
|
||||
@@ -469,6 +473,8 @@ u_device_get_view_poses(struct xrt_device *xdev,
|
||||
for (uint32_t i = 0; i < view_count; i++) {
|
||||
u_device_get_view_pose(default_eye_relation, i, &out_poses[i]);
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
xrt_result_t
|
||||
@@ -521,7 +527,7 @@ u_device_ni_set_output(struct xrt_device *xdev, enum xrt_output_name name, const
|
||||
E(get_hand_tracking);
|
||||
}
|
||||
|
||||
void
|
||||
xrt_result_t
|
||||
u_device_ni_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -530,7 +536,8 @@ u_device_ni_get_view_poses(struct xrt_device *xdev,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
E(get_hand_tracking);
|
||||
E(get_view_poses);
|
||||
return XRT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -166,7 +166,7 @@ u_device_get_view_pose(const struct xrt_vec3 *eye_relation, uint32_t view_index,
|
||||
*
|
||||
* The field @ref xrt_device::hmd needs to be set and valid.
|
||||
*/
|
||||
void
|
||||
xrt_result_t
|
||||
u_device_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -233,7 +233,7 @@ u_device_ni_set_output(struct xrt_device *xdev, enum xrt_output_name name, const
|
||||
*
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
void
|
||||
xrt_result_t
|
||||
u_device_ni_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
|
||||
@@ -193,7 +193,7 @@ set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_
|
||||
xrt_device_set_output(target, name, value);
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -204,14 +204,17 @@ get_view_poses(struct xrt_device *xdev,
|
||||
{
|
||||
struct multi_device *d = (struct multi_device *)xdev;
|
||||
struct xrt_device *target = d->tracking_override.target;
|
||||
xrt_device_get_view_poses(target, default_eye_relation, at_timestamp_ns, view_count, out_head_relation,
|
||||
out_fovs, out_poses);
|
||||
xrt_result_t xret = xrt_device_get_view_poses(target, default_eye_relation, at_timestamp_ns, view_count,
|
||||
out_head_relation, out_fovs, out_poses);
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use xrt_device_ function to be sure it is exactly
|
||||
* like if the state-tracker called this function.
|
||||
*/
|
||||
xrt_device_get_tracked_pose(xdev, XRT_INPUT_GENERIC_HEAD_POSE, at_timestamp_ns, out_head_relation);
|
||||
return xrt_device_get_tracked_pose(xdev, XRT_INPUT_GENERIC_HEAD_POSE, at_timestamp_ns, out_head_relation);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
@@ -385,7 +385,7 @@ ns_hmd_get_tracked_pose(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
ns_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -398,19 +398,24 @@ ns_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
NS_DEBUG(ns, "Called!");
|
||||
|
||||
// Use this to take care of most stuff, then fix up below.
|
||||
u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
xrt_result_t xret = u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
// Fix fix.
|
||||
for (uint32_t i = 0; i < view_count && i < ARRAY_SIZE(ns->config.head_pose_to_eye); i++) {
|
||||
out_poses[i] = ns->config.head_pose_to_eye[i];
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -405,18 +405,6 @@ rs_ddev_get_tracked_pose(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
rs_ddev_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
struct xrt_space_relation *out_head_relation,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
static void
|
||||
rs_ddev_destroy(struct xrt_device *xdev)
|
||||
{
|
||||
@@ -462,7 +450,7 @@ rs_ddev_create(int device_idx)
|
||||
rs->enable_relocalization, rs->enable_pose_prediction, rs->enable_pose_filtering);
|
||||
rs->base.update_inputs = u_device_noop_update_inputs;
|
||||
rs->base.get_tracked_pose = rs_ddev_get_tracked_pose;
|
||||
rs->base.get_view_poses = rs_ddev_get_view_poses;
|
||||
rs->base.get_view_poses = u_device_ni_get_view_poses;
|
||||
rs->base.destroy = rs_ddev_destroy;
|
||||
rs->base.name = XRT_DEVICE_REALSENSE;
|
||||
rs->base.tracking_origin->type = XRT_TRACKING_TYPE_EXTERNAL_SLAM;
|
||||
|
||||
@@ -179,18 +179,6 @@ r_device_get_hand_tracking(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
r_device_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
struct xrt_space_relation *out_head_relation,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
static void
|
||||
r_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
|
||||
{
|
||||
@@ -215,7 +203,7 @@ r_device_create(struct r_hub *r, bool is_left)
|
||||
rd->base.update_inputs = r_device_update_inputs;
|
||||
rd->base.get_tracked_pose = r_device_get_tracked_pose;
|
||||
rd->base.get_hand_tracking = r_device_get_hand_tracking;
|
||||
rd->base.get_view_poses = r_device_get_view_poses;
|
||||
rd->base.get_view_poses = u_device_ni_get_view_poses;
|
||||
rd->base.set_output = r_device_set_output;
|
||||
rd->base.destroy = r_device_destroy;
|
||||
rd->base.tracking_origin = &r->origin;
|
||||
|
||||
@@ -74,7 +74,7 @@ r_hmd_get_tracked_pose(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
r_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -86,23 +86,17 @@ r_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
struct r_hmd *rh = r_hmd(xdev);
|
||||
|
||||
if (!rh->r->latest.head.per_view_data_valid) {
|
||||
u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
|
||||
// Done now
|
||||
return;
|
||||
return u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
}
|
||||
|
||||
if (view_count > ARRAY_SIZE(rh->r->latest.head.views)) {
|
||||
U_LOG_E("Asking for too many views!");
|
||||
return;
|
||||
}
|
||||
assert(view_count <= ARRAY_SIZE(rh->r->latest.head.views));
|
||||
|
||||
copy_head_center_to_relation(rh, out_head_relation);
|
||||
|
||||
@@ -110,6 +104,8 @@ r_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
out_poses[i] = rh->r->latest.head.views[i].pose;
|
||||
out_fovs[i] = rh->r->latest.head.views[i].fov;
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -128,7 +128,7 @@ sample_hmd_get_tracked_pose(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
sample_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -141,14 +141,14 @@ sample_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
* For HMDs you can call this function or directly set
|
||||
* the `get_view_poses` function on the device to it.
|
||||
*/
|
||||
u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
return u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
}
|
||||
|
||||
static xrt_result_t
|
||||
|
||||
@@ -99,7 +99,7 @@ svr_hmd_get_tracked_pose(struct xrt_device *xdev,
|
||||
|
||||
#define DEG_TO_RAD(DEG) (DEG * M_PI / 180.)
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
svr_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -111,14 +111,17 @@ svr_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
//!@todo: default_eye_relation inherits from the env var OXR_DEBUG_IPD_MM / oxr_session.c
|
||||
// probably needs a lot more attention
|
||||
|
||||
u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
xrt_result_t xret = u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
//!@todo you may need to invert this - I can't test locally
|
||||
float turn_vals[2] = {5.0, -5.0};
|
||||
@@ -126,6 +129,8 @@ svr_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
struct xrt_vec3 y_up = (struct xrt_vec3)XRT_VEC3_UNIT_Y;
|
||||
math_quat_from_angle_vector(DEG_TO_RAD(turn_vals[i]), &y_up, &out_poses[i].orientation);
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
//!@todo: remove hard-coding and move to u_distortion_mesh
|
||||
|
||||
@@ -166,18 +166,6 @@ simulated_device_get_tracked_pose(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
simulated_device_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
struct xrt_space_relation *out_head_relation,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
static void
|
||||
simulated_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
|
||||
{
|
||||
@@ -369,7 +357,7 @@ simulated_create_controller(enum xrt_device_name name,
|
||||
sd->base.update_inputs = simulated_device_update_inputs;
|
||||
sd->base.get_tracked_pose = simulated_device_get_tracked_pose;
|
||||
sd->base.get_hand_tracking = u_device_ni_get_hand_tracking;
|
||||
sd->base.get_view_poses = simulated_device_get_view_poses;
|
||||
sd->base.get_view_poses = u_device_ni_get_view_poses;
|
||||
sd->base.set_output = simulated_device_set_output;
|
||||
sd->base.destroy = simulated_device_destroy;
|
||||
sd->base.tracking_origin = origin;
|
||||
|
||||
@@ -174,8 +174,8 @@ HmdDevice::HmdDevice(const DeviceBuilder &builder) : Device(builder)
|
||||
this->inputs = inputs_vec.data();
|
||||
this->input_count = inputs_vec.size();
|
||||
|
||||
this->xrt_device::get_view_poses = &device_bouncer<HmdDevice, &HmdDevice::get_view_poses, xrt_result_t>;
|
||||
#define SETUP_MEMBER_FUNC(name) this->xrt_device::name = &device_bouncer<HmdDevice, &HmdDevice::name>
|
||||
SETUP_MEMBER_FUNC(get_view_poses);
|
||||
SETUP_MEMBER_FUNC(compute_distortion);
|
||||
#undef SETUP_MEMBER_FUNC
|
||||
}
|
||||
@@ -515,7 +515,7 @@ HmdDevice::SetDisplayEyeToHead(uint32_t unWhichDevice,
|
||||
this->eye[1].position = rightEye_postquat.position;
|
||||
}
|
||||
|
||||
void
|
||||
xrt_result_t
|
||||
HmdDevice::get_view_poses(const xrt_vec3 *default_eye_relation,
|
||||
uint64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
@@ -526,14 +526,17 @@ HmdDevice::get_view_poses(const xrt_vec3 *default_eye_relation,
|
||||
struct xrt_vec3 eye_relation = *default_eye_relation;
|
||||
eye_relation.x = ipd;
|
||||
|
||||
u_device_get_view_poses( //
|
||||
this, //
|
||||
&eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
xrt_result_t xret = u_device_get_view_poses( //
|
||||
this, //
|
||||
&eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
out_poses[0].orientation = this->eye[0].orientation;
|
||||
out_poses[0].position.z = this->eye[0].position.z;
|
||||
@@ -541,6 +544,8 @@ HmdDevice::get_view_poses(const xrt_vec3 *default_eye_relation,
|
||||
out_poses[1].orientation = this->eye[1].orientation;
|
||||
out_poses[1].position.z = this->eye[1].position.z;
|
||||
out_poses[1].position.y = this->eye[1].position.y;
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
const vr::HmdMatrix34_t &eyeToHeadLeft,
|
||||
const vr::HmdMatrix34_t &eyeToHeadRight);
|
||||
|
||||
void
|
||||
xrt_result_t
|
||||
get_view_poses(const xrt_vec3 *default_eye_relation,
|
||||
uint64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
|
||||
@@ -523,7 +523,7 @@ survive_controller_get_hand_tracking(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
survive_device_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -547,19 +547,24 @@ survive_device_get_view_poses(struct xrt_device *xdev,
|
||||
eye_relation.x = survive->hmd.ipd;
|
||||
}
|
||||
|
||||
u_device_get_view_poses( //
|
||||
xdev, //
|
||||
&eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
xrt_result_t xret = u_device_get_view_poses( //
|
||||
xdev, //
|
||||
&eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
// This is for the Index' canted displays, on the Vive [Pro] they are identity.
|
||||
for (uint32_t i = 0; i < view_count && i < ARRAY_SIZE(survive->hmd.config.display.rot); i++) {
|
||||
out_poses[i].orientation = survive->hmd.config.display.rot[i];
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
enum InputComponent
|
||||
|
||||
@@ -135,18 +135,6 @@ twrap_slam_get_tracked_pose(struct xrt_device *xdev,
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
twrap_slam_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
struct xrt_space_relation *out_head_relation,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
static void
|
||||
twrap_slam_destroy(struct xrt_device *xdev)
|
||||
{
|
||||
@@ -173,7 +161,7 @@ twrap_slam_create_device(struct xrt_frame_context *xfctx,
|
||||
|
||||
dx->base.update_inputs = u_device_noop_update_inputs;
|
||||
dx->base.get_tracked_pose = twrap_slam_get_tracked_pose;
|
||||
dx->base.get_view_poses = twrap_slam_get_view_poses;
|
||||
dx->base.get_view_poses = u_device_ni_get_view_poses;
|
||||
dx->base.destroy = twrap_slam_destroy;
|
||||
dx->base.name = name;
|
||||
dx->base.tracking_origin->type = XRT_TRACKING_TYPE_OTHER;
|
||||
|
||||
@@ -208,7 +208,7 @@ vive_device_get_tracked_pose(struct xrt_device *xdev,
|
||||
return xret;
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
vive_device_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -222,20 +222,25 @@ vive_device_get_view_poses(struct xrt_device *xdev,
|
||||
// Only supports two views.
|
||||
assert(view_count <= 2);
|
||||
|
||||
u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
xrt_result_t xret = u_device_get_view_poses( //
|
||||
xdev, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
|
||||
// This is for the Index' canted displays, on the Vive [Pro] they are identity.
|
||||
struct vive_device *d = vive_device(xdev);
|
||||
for (uint32_t i = 0; i < view_count && i < ARRAY_SIZE(d->config.display.rot); i++) {
|
||||
out_poses[i].orientation = d->config.display.rot[i];
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -535,13 +535,13 @@ struct xrt_device
|
||||
* (Caution: Even if you have eye tracking, you
|
||||
* won't use eye orientation here!)
|
||||
*/
|
||||
void (*get_view_poses)(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
struct xrt_space_relation *out_head_relation,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses);
|
||||
xrt_result_t (*get_view_poses)(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
struct xrt_space_relation *out_head_relation,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses);
|
||||
|
||||
/**
|
||||
* Compute the distortion at a single point.
|
||||
@@ -823,9 +823,8 @@ xrt_device_get_view_poses(struct xrt_device *xdev,
|
||||
struct xrt_fov *out_fovs,
|
||||
struct xrt_pose *out_poses)
|
||||
{
|
||||
xdev->get_view_poses(xdev, default_eye_relation, at_timestamp_ns, view_count, out_head_relation, out_fovs,
|
||||
out_poses);
|
||||
return XRT_SUCCESS;
|
||||
return xdev->get_view_poses(xdev, default_eye_relation, at_timestamp_ns, view_count, out_head_relation,
|
||||
out_fovs, out_poses);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -62,7 +62,7 @@ ipc_client_hmd(struct xrt_device *xdev)
|
||||
return (ipc_client_hmd_t *)xdev;
|
||||
}
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
call_get_view_poses_raw(ipc_client_hmd_t *ich,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -117,6 +117,7 @@ call_get_view_poses_raw(ipc_client_hmd_t *ich,
|
||||
|
||||
out:
|
||||
ipc_client_connection_unlock(ipc_c);
|
||||
return xret;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +127,7 @@ out:
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
static xrt_result_t
|
||||
ipc_client_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
const struct xrt_vec3 *default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
@@ -149,7 +150,7 @@ ipc_client_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
&info); //
|
||||
IPC_CHK_ONLY_PRINT(ich->ipc_c, xret, "ipc_call_device_get_view_poses_2");
|
||||
IPC_CHK_AND_RET(ich->ipc_c, xret, "ipc_call_device_get_view_poses_2");
|
||||
|
||||
*out_head_relation = info.head_relation;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
@@ -159,20 +160,21 @@ ipc_client_hmd_get_view_poses(struct xrt_device *xdev,
|
||||
|
||||
} else if (view_count <= IPC_MAX_RAW_VIEWS) {
|
||||
// Artificial limit.
|
||||
|
||||
call_get_view_poses_raw( //
|
||||
ich, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
xret = call_get_view_poses_raw( //
|
||||
ich, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count, //
|
||||
out_head_relation, //
|
||||
out_fovs, //
|
||||
out_poses); //
|
||||
} else {
|
||||
IPC_ERROR(ich->ipc_c, "Cannot handle %u view_count, %u or less supported.", view_count,
|
||||
(uint32_t)IPC_MAX_RAW_VIEWS);
|
||||
assert(false && !"Too large view_count!");
|
||||
}
|
||||
|
||||
return xret;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
Reference in new issue
Block a user