mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00:00
aux/util: create_local_space from space overseer view space
Rather than using the head device provided in `u_space_overseer_legacy_setup`, use the semantic view space from the space overseer to create the local space. This fixes a crash that occurs when trying to create a local space without having called `u_space_overseer_legacy_setup` previously. Co-authored-by: Christoph Haag <christoph.haag@collabora.com> Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2255>
This commit is contained in:
parent
a3ebb27e34
commit
0a59c4f28e
|
@ -806,17 +806,17 @@ static xrt_result_t
|
|||
create_local_space(struct xrt_space_overseer *xso, struct xrt_space **out_space)
|
||||
{
|
||||
assert(xso->semantic.root != NULL);
|
||||
struct xrt_space *xs = NULL;
|
||||
struct xrt_space_relation xsr;
|
||||
int64_t timestamp_ns = os_monotonic_get_ns();
|
||||
xrt_device_get_tracked_pose(xso->head, XRT_INPUT_GENERIC_HEAD_POSE, timestamp_ns, &xsr);
|
||||
|
||||
struct xrt_pose identity = XRT_POSE_IDENTITY;
|
||||
struct xrt_space_relation xsr = XRT_SPACE_RELATION_ZERO;
|
||||
xrt_space_overseer_locate_space(xso, xso->semantic.root, &identity, os_monotonic_get_ns(), xso->semantic.view,
|
||||
&identity, &xsr);
|
||||
|
||||
xsr.pose.orientation.x = 0;
|
||||
xsr.pose.orientation.z = 0;
|
||||
math_quat_normalize(&xsr.pose.orientation);
|
||||
create_offset_space(xso, xso->semantic.root, &xsr.pose, &xs);
|
||||
*out_space = xs;
|
||||
U_LOG_D("u_space_overseer create_local_space!");
|
||||
return XRT_SUCCESS;
|
||||
|
||||
return create_offset_space(xso, xso->semantic.root, &xsr.pose, out_space);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -942,8 +942,6 @@ u_space_overseer_legacy_setup(struct u_space_overseer *uso,
|
|||
xrt_space_reference(&uso->base.semantic.unbounded, uso->base.semantic.root);
|
||||
}
|
||||
|
||||
uso->base.head = head;
|
||||
|
||||
// Set local to the local offset.
|
||||
u_space_overseer_create_offset_space(uso, uso->base.semantic.root, local_offset, &uso->base.semantic.local);
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@ struct xrt_space_overseer
|
|||
|
||||
//! Ptrs to the localspace
|
||||
struct xrt_space *localspace[XRT_MAX_CLIENT_SPACES];
|
||||
struct xrt_device *head;
|
||||
|
||||
/*!
|
||||
* Create a space with a fixed offset to the parent space.
|
||||
|
|
Loading…
Reference in a new issue