Monado OpenXR Runtime
|
A implementation of the xrt_space_overseer interface. More...
#include "xrt/xrt_space.h"
#include "xrt/xrt_device.h"
#include "xrt/xrt_session.h"
#include "xrt/xrt_tracking.h"
#include "os/os_time.h"
#include "math/m_space.h"
#include "util/u_misc.h"
#include "util/u_hashmap.h"
#include "util/u_logging.h"
#include "util/u_space_overseer.h"
#include <assert.h>
#include <math.h>
#include <pthread.h>
Data Structures | |
struct | u_space |
Representing a single space, can be several ones. More... | |
struct | u_space_overseer |
Default implementation of the xrt_space_overseer object. More... | |
Enumerations | |
enum | u_space_type { U_SPACE_TYPE_NULL , U_SPACE_TYPE_POSE , U_SPACE_TYPE_OFFSET , U_SPACE_TYPE_ROOT } |
Keeps track of what kind of space it is. More... | |
Functions | |
static struct u_space * | u_space (struct xrt_space *xs) |
static struct u_space_overseer * | u_space_overseer (struct xrt_space_overseer *xso) |
static const char * | type_to_small_string (enum xrt_reference_space_type type) |
static struct u_space * | get_semantic_space (struct u_space_overseer *uso, enum xrt_reference_space_type type) |
static void | u_space_reference (struct u_space **dst, struct u_space *src) |
A lot of code here uses u_space directly and need to change reference count so this helper is here to make that easier. More... | |
static void | hashmap_unreference_space_items (void *item, void *priv) |
Helper function when clearing a hashmap to also unreference a space. More... | |
static struct u_space * | find_xdev_space_read_locked (struct u_space_overseer *uso, struct xrt_device *xdev) |
static struct u_space * | find_xto_space_read_locked (struct u_space_overseer *uso, struct xrt_tracking_origin *xto) |
static bool | space_is_offset_compatible (struct u_space *us) |
static void | update_offset_write_locked (struct u_space *us, const struct xrt_pose *new_offset) |
Updates the offset of a NULL or OFFSET space. More... | |
static void | get_offset_or_ident_read_locked (const struct u_space *us, struct xrt_pose *offset) |
Returns the offset for an offset space or an identity pose, it's valid to call on all spaces. More... | |
static void | notify_ref_space_usage_device (struct u_space_overseer *uso, enum xrt_reference_space_type type, bool used) |
static void | push_then_traverse (struct xrt_relation_chain *xrc, struct u_space *space, int64_t at_timestamp_ns) |
For each space, push the relation of that space and then traverse by calling push_then_traverse again with the parent space. More... | |
static void | traverse_then_push_inverse (struct xrt_relation_chain *xrc, struct u_space *space, int64_t at_timestamp_ns) |
For each space, traverse by calling traverse_then_push_inverse again with the parent space then push the inverse of the relation of that. More... | |
static void | build_relation_chain_read_locked (struct u_space_overseer *uso, struct xrt_relation_chain *xrc, struct u_space *base, struct u_space *target, int64_t at_timestamp_ns) |
static void | build_relation_chain (struct u_space_overseer *uso, struct xrt_relation_chain *xrc, struct u_space *base, struct u_space *target, int64_t at_timestamp_ns) |
static void | special_resolve (struct xrt_relation_chain *xrc, struct xrt_space_relation *out_relation) |
static void | space_destroy (struct xrt_space *xs) |
static struct u_space * | create_space (enum u_space_type type, struct u_space *parent) |
Creates a space, returns with a reference of one. More... | |
static void | create_and_set_root_space (struct u_space_overseer *uso) |
static xrt_result_t | create_offset_space (struct xrt_space_overseer *xso, struct xrt_space *parent, const struct xrt_pose *offset, struct xrt_space **out_space) |
static xrt_result_t | create_pose_space (struct xrt_space_overseer *xso, struct xrt_device *xdev, enum xrt_input_name name, struct xrt_space **out_space) |
static xrt_result_t | locate_space (struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_space *space, const struct xrt_pose *offset, struct xrt_space_relation *out_relation) |
static bool | pose_approx (const struct xrt_pose *a, const struct xrt_pose *b) |
static int32_t | find_same_space_before (struct xrt_space **spaces, const struct xrt_pose *offsets, uint32_t space_index) |
static xrt_result_t | locate_spaces (struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_space **spaces, uint32_t space_count, const struct xrt_pose *offsets, struct xrt_space_relation *out_relations) |
static xrt_result_t | locate_device (struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_device *xdev, struct xrt_space_relation *out_relation) |
static xrt_result_t | ref_space_inc (struct xrt_space_overseer *xso, enum xrt_reference_space_type type) |
static xrt_result_t | ref_space_dec (struct xrt_space_overseer *xso, enum xrt_reference_space_type type) |
static xrt_result_t | recenter_local_spaces (struct xrt_space_overseer *xso) |
static xrt_result_t | create_local_space (struct xrt_space_overseer *xso, struct xrt_space **out_local_space, struct xrt_space **out_local_floor_space) |
static xrt_result_t | get_tracking_origin_offset (struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, struct xrt_pose *out_offset) |
static xrt_result_t | set_tracking_origin_offset (struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, const struct xrt_pose *offset) |
static xrt_result_t | get_reference_space_offset (struct xrt_space_overseer *xso, enum xrt_reference_space_type type, struct xrt_pose *out_offset) |
static xrt_result_t | set_reference_space_offset (struct xrt_space_overseer *xso, enum xrt_reference_space_type type, const struct xrt_pose *offset) |
static void | destroy (struct xrt_space_overseer *xso) |
struct u_space_overseer * | u_space_overseer_create (struct xrt_session_event_sink *broadcast) |
Create a default implementation of a space overseer. More... | |
void | u_space_overseer_legacy_setup (struct u_space_overseer *uso, struct xrt_device **xdevs, uint32_t xdev_count, struct xrt_device *head, const struct xrt_pose *local_offset, bool root_is_unbounded, bool per_app_local_spaces) |
Sets up the space overseer and all semantic spaces in a way that works with the old xrt_tracking_origin information. More... | |
void | u_space_overseer_create_null_space (struct u_space_overseer *uso, struct xrt_space *parent, struct xrt_space **out_space) |
Creates a space without any offset, this is just for optimisation over a regular offset space. More... | |
void | u_space_overseer_link_space_to_device (struct u_space_overseer *uso, struct xrt_space *xs, struct xrt_device *xdev) |
The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping when creating pose spaces. More... | |
A implementation of the xrt_space_overseer interface.
enum u_space_type |
Keeps track of what kind of space it is.
|
static |
Creates a space, returns with a reference of one.
The lock doesn't need to be held as this function is not modifying any of the currently existing spaces only creating a new one that is not pointed to by any other spaces.
|
static |
Returns the offset for an offset space or an identity pose, it's valid to call on all spaces.
References u_space::type.
|
static |
Helper function when clearing a hashmap to also unreference a space.
References u_space_reference().
|
static |
For each space, push the relation of that space and then traverse by calling push_then_traverse
again with the parent space.
That means traverse goes from a leaf space to a the root space, relations are pushed in the same order.
References u_space::type.
|
static |
For each space, traverse by calling traverse_then_push_inverse
again with the parent space then push the inverse of the relation of that.
That means traverse goes from a leaf space to a the root space, relations are pushed in the reversed order.
References u_space::type.
A lot of code here uses u_space directly and need to change reference count so this helper is here to make that easier.
References xrt_space::destroy, xrt_space::reference, xrt_reference::xrt_reference_dec_and_is_zero(), and xrt_reference::xrt_reference_inc().
Referenced by hashmap_unreference_space_items().
|
static |
Updates the offset of a NULL or OFFSET space.
References u_space::type.