Monado OpenXR Runtime

Smaller pieces of auxiliary utilities code. More...

Collaboration diagram for Utilities:

Modules

 Distortion utilities
 
 Logging functions
 
 Frame and Render timing/pacing
 
 Pretty printing functions and helpers
 This is common functionality used directly and shared by additional pretty printing functions implemented in multiple modules, such as OpenXR entrypoints.
 

Files

file  gst_internal.h
 Semi internal structs for gstreamer code.
 
file  gst_pipeline.c
 An xrt_frame_sink that does gst things.
 
file  gst_pipeline.h
 Functions for creating gstreamer_pipeline objects.
 
file  gst_sink.c
 An xrt_frame_sink that does gst things.
 
file  gst_sink.h
 xrt_frame_sink that does gst things.
 
file  m_relation_history.h
 Small utility for keeping track of the history of an xrt_space_relation, ie.
 
file  u_autoexpgain.c
 Automatically compute exposure and gain values from an image stream.
 
file  u_autoexpgain.h
 Automatically compute exposure and gain values from an image stream.
 
file  u_bitwise.c
 Functions for manipulating tightly packed data as bits.
 
file  u_bitwise.h
 Functions for manipulating tightly packed data as bits.
 
file  u_box_iou.hpp
 Code to deal with bounding boxes for camera-based hand-tracking.
 
file  u_builders.c
 Helpers for xrt_builder implementations.
 
file  u_builders.h
 Helpers for xrt_builder implementations.
 
file  u_config_json.h
 Code to manage the settings file.
 
file  u_debug.c
 Small debug helpers.
 
file  u_debug.h
 Small debug helpers.
 
file  u_deque.cpp
 Expose std::deque to C.
 
file  u_deque.h
 Expose std::deque to C.
 
file  u_device.c
 Misc helpers for device drivers.
 
file  u_device.h
 Misc helpers for device drivers.
 
file  u_documentation.h
 Header with only documentation.
 
file  u_file.c
 Very simple file opening functions.
 
file  u_file.cpp
 Very simple file opening functions, mostly using std::filesystem for portability.
 
file  u_file.h
 Very simple file opening functions.
 
file  u_format.c
 Format helpers and block code.
 
file  u_format.h
 Format helpers and block code.
 
file  u_frame.c
 xrt_frame helpers.
 
file  u_frame.h
 xrt_frame helpers.
 
file  u_frame_times_widget.h
 Shared code for visualizing frametimes.
 
file  u_generic_callbacks.hpp
 Implementation of a generic callback collection, intended to be wrapped for a specific event type.
 
file  u_git_tag.h
 Holds the git hash of Monado.
 
file  u_hand_simulation.c
 Wrapper around Mercury's parametric hand code, used by Index and OpenGloves to simulate hand tracking.
 
file  u_hand_simulation.h
 Wrapper around Mercury's parametric hand code, used by Index and OpenGloves to simulate hand tracking.
 
file  u_hand_tracking.h
 Hand Tracking API interface.
 
file  u_handles.c
 Implementations of handle functions.
 
file  u_handles.h
 Functions for dealing generically with various handle types defined in xrt_handles.h.
 
file  u_hashmap.cpp
 Hashmap for integer values header.
 
file  u_hashmap.h
 Hashmap for integer values header.
 
file  u_hashset.cpp
 Hashset struct header.
 
file  u_hashset.h
 Hashset struct header.
 
file  u_id_ringbuffer.cpp
 Wrap some ring buffer internals for somewhat generic C usage.
 
file  u_id_ringbuffer.h
 Ring buffer for things keyed on an ID but otherwise maintained externally, for C usage.
 
file  u_imu_sink_force_monotonic.c
 A xrt_imu_sink that forces the samples to be monotonically increasing.
 
file  u_imu_sink_split.c
 An xrt_imu_sink splitter.
 
file  u_index_fifo.h
 A FIFO for indices.
 
file  u_iterator_base.hpp
 A template class to serve as the base of iterator and const_iterator types for things with "random access".
 
file  u_json.c
 Tiny JSON wrapper around cJSON.
 
file  u_json.h
 Tiny JSON wrapper around cJSON header.
 
file  u_json.hpp
 C++ wrapper for cJSON.
 
file  u_limited_unique_id.cpp
 A very simple generator to create process unique ids.
 
file  u_limited_unique_id.h
 A very simple generator to create process unique ids.
 
file  u_linux.c
 Various helpers for doing Linux specific things.
 
file  u_linux.h
 Various helpers for doing Linux specific things.
 
file  u_live_stats.cpp
 Live stats tracking and printing.
 
file  u_live_stats.h
 Live stats tracking and printing.
 
file  u_logging.c
 Logging functions.
 
file  u_metrics.c
 Metrics saving functions.
 
file  u_metrics.h
 Metrics saving functions.
 
file  u_misc.c
 Very small misc utils.
 
file  u_misc.h
 Very small misc utils.
 
file  u_native_images_debug.h
 Special code for managing a variable tracked swapchain.
 
file  u_pacing.h
 Shared pacing code.
 
file  u_pacing_app.c
 Shared frame timing code.
 
file  u_pacing_compositor.c
 Shared frame timing code.
 
file  u_pacing_compositor_fake.c
 For generating a fake timing.
 
file  u_prober.c
 Helpers for prober related code.
 
file  u_prober.h
 Helpers for prober related code.
 
file  u_process.c
 Simple process handling.
 
file  u_process.h
 Simple process handling.
 
file  u_session.c
 Helper to implement xrt_session.
 
file  u_session.h
 Helper to implement xrt_session.
 
file  u_sink.h
 xrt_frame_sink converters and other helpers.
 
file  u_sink_combiner.c
 An xrt_frame_sink that combines two frames into a stereo frame.
 
file  u_sink_converter.c
 xrt_frame_sink converters and other helpers.
 
file  u_sink_deinterleaver.c
 An xrt_frame_sink that deinterleaves stereo frames.
 
file  u_sink_force_genlock.c
 An xrt_frame_sink that takes two frames, enforces gen-lock and pushes downstream in left-right order.
 
file  u_sink_queue.c
 An xrt_frame_sink queue.
 
file  u_sink_quirk.c
 An xrt_frame_sink that quirks frames.
 
file  u_sink_simple_queue.c
 An xrt_frame_sink queue.
 
file  u_sink_split.c
 An xrt_frame_sink splitter.
 
file  u_sink_stereo_sbs_to_slam_sbs.c
 An xrt_frame_sink splitter.
 
file  u_space_overseer.c
 A implementation of the xrt_space_overseer interface.
 
file  u_space_overseer.h
 A implementation of the xrt_space_overseer interface.
 
file  u_string_list.cpp
 A collection of strings, like a list of extensions to enable.
 
file  u_string_list.h
 A collection of strings, like a list of extensions to enable.
 
file  u_string_list.hpp
 A collection of strings, like a list of extensions to enable.
 
file  u_system.c
 Helper to implement xrt_system.
 
file  u_system.h
 Helper to implement xrt_system.
 
file  u_system_helpers.c
 Helpers for system objects like xrt_system_devices.
 
file  u_system_helpers.h
 Helpers for system objects like xrt_system_devices.
 
file  u_template_historybuf.hpp
 Ringbuffer implementation for keeping track of the past state of things.
 
file  u_template_historybuf_const_iterator.inl
 const_iterator details for ring buffer
 
file  u_template_historybuf_impl_helpers.hpp
 All the "element-type-independent" code (helper objects, base classes) for a ringbuffer implementation on top of a fixed size array.
 
file  u_template_historybuf_iterator.inl
 iterator details for ring buffer
 
file  u_threading.h
 Slightly higher level thread safe helpers.
 
file  u_time.cpp
 Implementation of a steady, convertible clock.
 
file  u_time.h
 Time-keeping: a clock that is steady, convertible to system time, and ideally high-resolution.
 
file  u_trace_marker.c
 Tracing support code, see Tracing support.
 
file  u_trace_marker.h
 Tracing support code, see Tracing support.
 
file  u_tracked_imu_3dof.c
 Wrapper for m_imu_3dof that can be placed inside (and freed along with!) an xrt_imu_sink pipeline.
 
file  u_tracked_imu_3dof.h
 Wrapper for m_imu_3dof that can be placed inside (and freed along with!) an xrt_imu_sink pipeline.
 
file  u_truncate_printf.h
 Truncating versions of string printing functions.
 
file  u_var.cpp
 Variable tracking code.
 
file  u_var.h
 Variable tracking code.
 
file  u_vector.cpp
 Expose std::vector to C.
 
file  u_vector.h
 Expose std::vector to C.
 
file  u_verify.h
 Tiny file to verify things.
 
file  u_visibility_mask.c
 Visibility mask utilitary.
 
file  u_visibility_mask.h
 Visibility mask utilitary header.
 
file  u_wait.h
 Tiny file to implement precise waiting functions.
 
file  u_win32_com_guard.cpp
 An object that serves to keep the reference count of COM initialization greater than 0.
 
file  u_win32_com_guard.hpp
 An object that serves to keep the reference count of COM initialization greater than 0.
 
file  u_worker.c
 Simple worker pool.
 
file  u_worker.cpp
 C++ wrappers for workers.
 
file  u_worker.h
 Worker and threading pool.
 
file  u_worker.hpp
 C++ wrappers for workers.
 

Data Structures

struct  u_builder_search_filter
 A filter to match the against. More...
 
struct  u_builder_search_results
 Results of a search of devices. More...
 
struct  u_builder_roles_helper
 This small helper struct is for u_builder_roles_helper_open_system, lets a builder focus on opening devices rather then dealing with Monado structs like xrt_system_devices and the like. More...
 
struct  u_builder
 This helper struct makes it easier to implement the builder interface, but it also comes with a set of integration that may not be what all builders want. More...
 
struct  u_hand_tracking_curl_values
 Values used for the XRT_HAND_TRACKING_MODEL_FINGERL_CURL model. More...
 
struct  u_joint_space_relation
 A space relation of a single joint. More...
 
struct  u_finger_joint_set
 A set of joints in a single finger. More...
 
struct  u_hand_joint_default_set
 The set of joints in the XR_HAND_JOINT_SET_DEFAULT_EXT. More...
 
struct  u_hand_tracking
 Main struct drivers can use to implement hand and finger tracking. More...
 
struct  u_hashset_item
 A embeddable hashset item, note that the string directly follows the u_hashset_item. More...
 
struct  u_live_stats_ns
 Struct to do live statistic tracking and printing of nano-seconds values, used by amongst other the compositor pacing code. More...
 
struct  u_native_images_debug
 A struct for debugging one or more native images. More...
 
struct  u_swapchain_debug
 Allows to debug image that is in GPU memory. More...
 
struct  u_session_event
 Struct used by u_session to queue up events. More...
 
struct  u_session
 This is a helper struct that fully implements xrt_session object. More...
 
struct  u_system_session_pair
 A pair of xrt_session and xrt_session_event_sink that has been registered to this system, used to multiplex events to all sessions. More...
 
struct  u_system
 A helper to implement a xrt_system, takes care of multiplexing events to sessions. More...
 
struct  u_system_devices
 Helper struct to manage devices by implementing the xrt_system_devices. More...
 
struct  u_system_devices_static
 Helper struct to manage devices by implementing the xrt_system_devices, this has only static device roles. More...
 
struct  u_var_f32_arr
 Used to plot an array for values. More...
 
struct  u_var_timing
 Used to plot a graph of timing information. More...
 
struct  u_var_button
 Simple pushable button. More...
 
struct  u_var_combo
 Combo box information. More...
 
struct  u_var_draggable_f32
 Draggable single precision float information. More...
 
struct  u_var_draggable_u16
 Draggable usingned 16-bit integer information. More...
 
struct  u_var_histogram_f32
 Histogram based on single precision bars. More...
 
struct  u_var_curve_point
 A point on the curve, uses doubles like ImPlotPoint. More...
 
struct  u_var_curve
 A single curve on a plot. More...
 
struct  u_var_curves
 A collection of curves to be plotted. More...
 
struct  u_var_info
 Struct that keeps all of the information about the variable, some of the UI state is kept on it. More...
 
struct  u_var_root_info
 Struct containing the information about a root object. More...
 
struct  u_worker_thread_pool
 A worker pool, can shared between multiple groups worker pool. More...
 
struct  u_worker_group
 A worker group where you submit tasks to. More...
 
class  xrt::auxiliary::util::SharedThreadPool
 Wrapper around u_worker_thread_pool. More...
 
class  xrt::auxiliary::util::SharedThreadGroup
 Wrapper around u_worker_group, use TaskCollection to dispatch work. More...
 
class  xrt::auxiliary::util::TaskCollection
 Class to let users fall into a pit of success by being designed as a one shot dispatcher instance. More...
 
struct  u_hashmap_int
 A simple uint64_t key to a void pointer hashmap. More...
 
struct  u_hashset
 Kind of bespoke hashset implementation, where the user is responsible for allocating and freeing the items themselves. More...
 
struct  time_state
 Time-keeping state structure. More...
 

Macros

#define U_BUILDER_SEARCH_MAX   (16)
 Max return of the number xrt_prober_device. More...
 
#define U_LIVE_STATS_NAME_COUNT   (16)
 Number of chars for the name of the live stats. More...
 
#define U_LIVE_STATS_VALUE_COUNT   (1024)
 Max number of values that can be put into the trackers. More...
 
#define U_CALLOC_WITH_CAST(TYPE, SIZE)   ((TYPE *)calloc(1, SIZE))
 Allocate and zero the give size and casts the memory into a pointer of the given type. More...
 
#define U_TYPED_CALLOC(TYPE)   ((TYPE *)calloc(1, sizeof(TYPE)))
 Allocate and zero the space required for some type, and cast the return type appropriately. More...
 
#define U_TYPED_ARRAY_CALLOC(TYPE, COUNT)   ((TYPE *)calloc((COUNT), sizeof(TYPE)))
 Allocate and zero the space required for some type, and cast the return type appropriately. More...
 
#define U_ZERO(PTR)   memset((PTR), 0, sizeof(*(PTR)))
 Zeroes the correct amount of memory based on the type pointed-to by the argument. More...
 
#define U_ZERO_ARRAY(ARRAY)   memset((ARRAY), 0, sizeof(ARRAY))
 Zeroes the correct amount of memory based on the type and size of the static array named in the argument. More...
 
#define U_ARRAY_REALLOC_OR_FREE(VAR, TYPE, COUNT)   (VAR) = ((TYPE *)u_realloc_or_free((VAR), sizeof(TYPE) * (COUNT)))
 Re-allocate the space required for some type, and update the pointer - freeing the allocation instead if it can't be resized. More...
 
#define U_TRACE_TARGET_SETUP(WHICH)
 Add to target c file to enable tracing, see Tracing support. More...
 
#define U_VAR_NAME_STRING_SIZE   256
 Maximum string length for a tracked variable. More...
 
#define U_WAIT_MEASURED_SCHEDULER_LATENCY_NS   (uint64_t)(0)
 OS specific tweak to wait time. More...
 

Typedefs

typedef xrt_result_t(* u_builder_open_system_fn) (struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_tracking_origin *origin, struct xrt_system_devices *xsysd, struct xrt_frame_context *xfctx, struct u_builder_roles_helper *ubrh)
 Argument to u_builder_roles_helper_open_system and implemented by u_builder::open_system_static_roles function. More...
 
typedef int64_t timepoint_ns
 Integer timestamp type. More...
 
typedef int64_t time_duration_ns
 Integer duration type in nanoseconds. More...
 
typedef void(* u_var_button_cb) (void *)
 Callback for a button action. More...
 
typedef struct u_var_curve_point(* u_var_curve_getter) (void *data, int i)
 Callback for getting points on a curve. More...
 
typedef void(* u_var_root_cb) (struct u_var_root_info *info, void *)
 Callback for entering and leaving root nodes. More...
 
typedef void(* u_var_elm_cb) (struct u_var_info *info, void *)
 Callback on each variable a root node has. More...
 
typedef void(* u_worker_group_func_t) (void *)
 Function typedef for tasks. More...
 

Enumerations

enum  u_trace_which { U_TRACE_WHICH_SERVICE , U_TRACE_WHICH_OPENXR }
 Should the extra tracks be enabled, see Tracing support. More...
 
enum  u_var_kind {
  U_VAR_KIND_BOOL , U_VAR_KIND_RGB_U8 , U_VAR_KIND_RGB_F32 , U_VAR_KIND_U8 ,
  U_VAR_KIND_U16 , U_VAR_KIND_U64 , U_VAR_KIND_I32 , U_VAR_KIND_I64 ,
  U_VAR_KIND_F32 , U_VAR_KIND_DRAGGABLE_F32 , U_VAR_KIND_F64 , U_VAR_KIND_F32_ARR ,
  U_VAR_KIND_TIMING , U_VAR_KIND_VEC3_I32 , U_VAR_KIND_VEC3_F32 , U_VAR_KIND_POSE ,
  U_VAR_KIND_SINK_DEBUG , U_VAR_KIND_NATIVE_IMAGES_DEBUG , U_VAR_KIND_LOG_LEVEL , U_VAR_KIND_RO_TEXT ,
  U_VAR_KIND_RO_FTEXT , U_VAR_KIND_RO_I32 , U_VAR_KIND_RO_U32 , U_VAR_KIND_RO_F32 ,
  U_VAR_KIND_RO_I64 , U_VAR_KIND_RO_U64 , U_VAR_KIND_RO_F64 , U_VAR_KIND_RO_VEC3_I32 ,
  U_VAR_KIND_RO_VEC3_F32 , U_VAR_KIND_RO_QUAT_F32 , U_VAR_KIND_RO_FF_F64 , U_VAR_KIND_RO_FF_VEC3_F32 ,
  U_VAR_KIND_GUI_HEADER , U_VAR_KIND_GUI_HEADER_BEGIN , U_VAR_KIND_GUI_HEADER_END , U_VAR_KIND_BUTTON ,
  U_VAR_KIND_COMBO , U_VAR_KIND_HISTOGRAM_F32 , U_VAR_KIND_DRAGGABLE_U16 , U_VAR_KIND_CURVE ,
  U_VAR_KIND_CURVES
}
 What kind of variable is this tracking. More...
 

Functions

struct xrt_prober_deviceu_builder_find_prober_device (struct xrt_prober_device *const *xpdevs, size_t xpdev_count, uint16_t vendor_id, uint16_t product_id, enum xrt_bus_type bus_type)
 Find the first xrt_prober_device in the prober list. More...
 
void u_builder_search (struct xrt_prober *xp, struct xrt_prober_device *const *xpdevs, size_t xpdev_count, const struct u_builder_search_filter *filters, size_t filter_count, struct u_builder_search_results *results)
 Find all of the xrt_prober_device that matches any in the given list of u_builder_search_filter filters. More...
 
void u_builder_setup_tracking_origins (struct xrt_device *head, struct xrt_device *left, struct xrt_device *right, struct xrt_vec3 *global_tracking_origin_offset)
 Helper function for setting up tracking origins. More...
 
void u_builder_create_space_overseer_legacy (struct xrt_session_event_sink *broadcast, struct xrt_device *head, struct xrt_device *left, struct xrt_device *right, struct xrt_device **xdevs, uint32_t xdev_count, bool root_is_unbounded, struct xrt_space_overseer **out_xso)
 Create a legacy space overseer, most builders probably want to have a more advanced setup then this, especially stand alone ones. More...
 
xrt_result_t u_builder_roles_helper_open_system (struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso, u_builder_open_system_fn fn)
 Helper to create a system devices that has static roles and a appropriate space overseer. More...
 
xrt_result_t u_builder_open_system_static_roles (struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso)
 Implementation for xrt_builder::open_system to be used with u_builder. More...
 
void u_config_json_open_or_create_main_file (struct u_config_json *json)
 Load the JSON config file. More...
 
void u_config_json_save_calibration (struct u_config_json *json, struct xrt_settings_tracking *settings)
 Writes back calibration settings to the main config file. More...
 
void u_config_json_save_overrides (struct u_config_json *json, struct xrt_tracking_override *overrides, size_t override_count)
 Writes back tracking override settings to the main config file. More...
 
void u_config_json_get_active (struct u_config_json *json, enum u_config_json_active_config *out_active)
 Read from the JSON loaded json config file and returns the active config, can be overridden by P_OVERRIDE_ACTIVE_CONFIG envirmental variable. More...
 
bool u_config_json_get_tracking_settings (struct u_config_json *json, struct xrt_settings_tracking *s)
 Extract tracking settings from the JSON. More...
 
bool u_config_json_get_tracking_overrides (struct u_config_json *json, struct xrt_tracking_override *out_overrides, size_t *out_override_count)
 Extract tracking override settings from the JSON. More...
 
bool u_config_json_get_remote_settings (struct u_config_json *json, int *out_port, uint32_t *out_view_count)
 Extract remote settings from the JSON. More...
 
bool u_device_setup_one_eye (struct xrt_device *xdev, const struct u_device_simple_info *info)
 Setup the device information given a very simple info struct. More...
 
bool u_device_setup_split_side_by_side (struct xrt_device *xdev, const struct u_device_simple_info *info)
 Setup the device information given a very simple info struct. More...
 
bool u_extents_2d_split_side_by_side (struct xrt_device *xdev, const struct u_extents_2d *extents)
 Setup the device's display's 2D extents. More...
 
void u_device_dump_config (struct xrt_device *xdev, const char *prefix, const char *prod)
 Dump the device config to stderr. More...
 
void * u_device_allocate (enum u_device_alloc_flags flags, size_t size, size_t input_count, size_t output_count)
 Helper function to allocate a device plus inputs in the same allocation placed after the device in memory. More...
 
void u_device_free (struct xrt_device *xdev)
 Helper function to free a device and any data hanging of it. More...
 
void u_device_assign_xdev_roles (struct xrt_device **xdevs, size_t xdev_count, int *head, int *left, int *right)
 Helper function to assign head, left hand and right hand roles. More...
 
xrt_result_t u_device_noop_update_inputs (struct xrt_device *xdev)
 Noop function for xrt_device::update_inputs, should only be used from a device with any inputs. More...
 
void u_device_ni_get_hand_tracking (struct xrt_device *xdev, enum xrt_input_name name, uint64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, uint64_t *out_timestamp_ns)
 Not implemented function for xrt_device::get_hand_tracking. More...
 
void u_device_ni_set_output (struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
 Not implemented function for xrt_device::set_output. More...
 
void u_device_ni_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)
 Not implemented function for xrt_device::get_view_poses. More...
 
bool u_device_ni_compute_distortion (struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
 Not implemented function for xrt_device::compute_distortion. More...
 
xrt_result_t u_device_ni_get_visibility_mask (struct xrt_device *xdev, enum xrt_visibility_mask_type type, uint32_t view_index, struct xrt_visibility_mask **out_mask)
 Not implemented function for xrt_device::get_visibility_mask. More...
 
bool u_device_ni_is_form_factor_available (struct xrt_device *xdev, enum xrt_form_factor form_factor)
 Not implemented function for xrt_device::is_form_factor_available. More...
 
xrt_result_t u_device_ni_get_battery_status (struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
 Not implemented function for xrt_device::get_battery_status. More...
 
const char * u_format_str (enum xrt_format f)
 Return string for this format. More...
 
bool u_format_is_blocks (enum xrt_format f)
 Is this format block based, also returns true for formats that 1x1 blocks. More...
 
uint32_t u_format_block_width (enum xrt_format f)
 Returns the width of the block for the given format. More...
 
uint32_t u_format_block_height (enum xrt_format f)
 Returns the height of the block for the given format. More...
 
size_t u_format_block_size (enum xrt_format f)
 Returns the size of the block for the given format. More...
 
void u_format_size_for_dimensions (enum xrt_format f, uint32_t width, uint32_t height, size_t *out_stride, size_t *out_size)
 Calculate stride and size for the format and given width and height. More...
 
void u_hand_joints_apply_joint_width (struct xrt_hand_joint_set *set)
 Applies joint width to set. More...
 
bool u_hand_joint_is_tip (enum xrt_hand_joint joint)
 
bool u_hand_joint_is_metacarpal (enum xrt_hand_joint joint)
 
bool u_hand_joint_is_proximal (enum xrt_hand_joint joint)
 
bool u_hand_joint_is_intermediate (enum xrt_hand_joint joint)
 
bool u_hand_joint_is_distal (enum xrt_hand_joint joint)
 
bool u_hand_joint_is_thumb (enum xrt_hand_joint joint)
 
void u_hashmap_int_for_each (const struct u_hashmap_int *hmi, u_hashmap_int_foreach_callback cb, void *priv_ctx)
 iterators through each [key,item] pairs of hash map More...
 
void u_hashmap_int_clear_and_call_for_each (struct u_hashmap_int *hmi, u_hashmap_int_callback cb, void *priv)
 First clear the hashmap and then call the given callback with each item that was in the hashmap. More...
 
void u_hashset_clear_and_call_for_each (struct u_hashset *hs, u_hashset_callback cb, void *priv)
 First clear the hashset and then call the given callback with each item that was in the hashset. More...
 
xrt_limited_unique_id_t u_limited_unique_id_get (void)
 This function returns a unsigned 64 bit value that is guaranteed to be unique within the current running process, and not zero. More...
 
void u_linux_try_to_set_realtime_priority_on_thread (enum u_logging_level log_level, const char *name)
 Try to set realtime priority on this thread. More...
 
static void * u_realloc_or_free (void *ptr, size_t new_size)
 Reallocates or frees dynamically-allocated memory. More...
 
static void u_native_images_debug_init (struct u_native_images_debug *unid)
 Must be called before variable is tracked. More...
 
static void u_native_images_debug_destroy (struct u_native_images_debug *unid)
 Must not be called while variable longer tracked, after u_var_remove_root. More...
 
static void u_native_images_debug_lock (struct u_native_images_debug *unid)
 Simple lock helper. More...
 
static void u_native_images_debug_unlock (struct u_native_images_debug *unid)
 Simple lock helper. More...
 
static void u_native_images_debug_set_locked (struct u_native_images_debug *unid, xrt_limited_unique_id_t limited_unique_id, struct xrt_image_native *native_images, uint32_t native_image_count, const struct xrt_swapchain_create_info *xscci, uint32_t active_index, bool flip_y)
 Helper function to update all variables, must be called with the lock held. More...
 
static void u_native_images_debug_set (struct u_native_images_debug *unid, xrt_limited_unique_id_t limited_unique_id, struct xrt_image_native *native_images, uint32_t native_image_count, const struct xrt_swapchain_create_info *xscci, uint32_t active_index, bool flip_y)
 Updates all variables atomically by holding the lock. More...
 
static void u_native_images_debug_clear_locked (struct u_native_images_debug *unid)
 Clear all variables, must be called with the lock held. More...
 
static void u_native_images_debug_clear (struct u_native_images_debug *unid)
 Clear all variables atomically by holding the lock, still valid to use. More...
 
static void u_swapchain_debug_init (struct u_swapchain_debug *uscd)
 Must be called before variable is tracked. More...
 
static void u_swapchain_debug_set (struct u_swapchain_debug *uscd, struct xrt_swapchain_native *xscn, const struct xrt_swapchain_create_info *xscci, uint32_t active_index, bool flip_y)
 Updates all variables atomically by holding the lock. More...
 
static void u_swapchain_debug_clear (struct u_swapchain_debug *uscd)
 Clear all variables atomically by holding the lock, still valid to use. More...
 
static void u_swapchain_debug_destroy (struct u_swapchain_debug *uscd)
 Must not be called while variable longer tracked, after u_var_remove_root. More...
 
static void u_swapchain_debug_lock (struct u_swapchain_debug *uscd)
 Simple lock helper. More...
 
static void u_swapchain_debug_unlock (struct u_swapchain_debug *uscd)
 Simple lock helper. More...
 
struct u_processu_process_create_if_not_running (void)
 Creates a handle for this process that is unique to the operating system user. More...
 
void u_process_destroy (struct u_process *proc)
 Releases the unique handle of the operating system user. More...
 
struct u_space_overseeru_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)
 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...
 
static struct u_system_devicesu_system_devices (struct xrt_system_devices *xsysd)
 Small inline helper to cast from xrt_system_devices. More...
 
struct u_system_devicesu_system_devices_allocate (void)
 Allocates a empty u_system_devices to be filled in by the caller, only the destroy function is filled in. More...
 
void u_system_devices_close (struct xrt_system_devices *xsysd)
 Destroys all devices and clears out the frame context, doesn't free the struct itself, useful for code embedding the system devices struct into other objects where it's not the first member or C++ classes. More...
 
static struct u_system_devices_staticu_system_devices_static (struct xrt_system_devices *xsysd)
 Small inline helper to cast from xrt_system_devices. More...
 
struct u_system_devices_staticu_system_devices_static_allocate (void)
 Allocates a empty u_system_devices to be filled in by the caller, only the destroy function is filled in. More...
 
void u_system_devices_static_finalize (struct u_system_devices_static *usysds, struct xrt_device *left, struct xrt_device *right)
 Finalizes the static struct with the given input devices, the system devices will always return these devices for the left and right role. More...
 
xrt_result_t u_system_devices_create_from_prober (struct xrt_instance *xinst, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso)
 Takes a xrt_instance, gets the prober from it and then uses the prober to allocate a filled in u_system_devices. More...
 
struct xrt_deviceu_system_devices_get_ht_device (struct xrt_system_devices *xsysd, enum xrt_input_name name)
 Helper function. More...
 
static struct xrt_deviceu_system_devices_get_ht_device_left (struct xrt_system_devices *xsysd)
 Helper to get the first left hand-tracking device, uses u_system_devices_get_ht_device. More...
 
static struct xrt_deviceu_system_devices_get_ht_device_right (struct xrt_system_devices *xsysd)
 Helper to get the first right hand-tracking device, uses u_system_devices_get_ht_device. More...
 
static double time_ns_to_s (time_duration_ns ns)
 Convert nanoseconds duration to double seconds. More...
 
static time_duration_ns time_s_to_ns (double duration)
 Convert float seconds to nanoseconds. More...
 
static double time_ns_to_ms_f (time_duration_ns ns)
 Convert nanoseconds to double float milliseconds, useful for printing. More...
 
static timepoint_ns time_ms_f_to_ns (double ms_f)
 Convert double float milliseconds to nanoseconds, human comprehensible config inputs. More...
 
static bool time_is_within_range_of_each_other (timepoint_ns a, timepoint_ns b, int64_t range)
 Checks if two timepoints are with a certain range of each other. More...
 
static bool time_is_within_half_ms (timepoint_ns a, timepoint_ns b)
 Checks if two timepoints are with half a millisecond of each other. More...
 
static bool time_is_less_then_or_within_range (timepoint_ns a, timepoint_ns b, int64_t range)
 Fuzzy comparisons. More...
 
static bool time_is_less_then_or_within_half_ms (timepoint_ns a, timepoint_ns b)
 Fuzzy comparisons. More...
 
static bool time_is_greater_then_or_within_range (timepoint_ns a, timepoint_ns b, int64_t range)
 Fuzzy comparisons. More...
 
static bool time_is_greater_then_or_within_half_ms (timepoint_ns a, timepoint_ns b)
 Fuzzy comparisons. More...
 
void u_trace_marker_setup (enum u_trace_which which)
 Internal setup function, use U_TRACE_TARGET_SETUP, see Tracing support. More...
 
void u_trace_marker_init (void)
 Must be called from a non-static/global constructor context. More...
 
static int u_truncate_vsnprintf (char *chars, size_t char_count, const char *fmt, va_list args)
 We want to truncate the value, not get the possible written. More...
 
static int u_truncate_snprintf (char *chars, size_t char_count, const char *fmt,...)
 We want to truncate the value, not get the possible written, and error when we can not write out anything. More...
 
void u_var_add_root (void *root, const char *c_name, bool suffix_with_number)
 Add a named root object, the u_var subsystem is completely none-invasive to the object it's tracking. More...
 
void u_var_remove_root (void *root)
 Remove the root node. More...
 
void u_var_visit (u_var_root_cb enter_cb, u_var_root_cb exit_cb, u_var_elm_cb elem_cb, void *priv)
 Visit all root nodes and their variables. More...
 
void u_var_force_on (void)
 This forces the variable tracking code to on, it is disabled by default. More...
 
void u_visibility_mask_get_default (enum xrt_visibility_mask_type type, const struct xrt_fov *fov, struct xrt_visibility_mask **out_mask)
 Default visibility mask, only returns a very simple mask with four small triangles in each corner, scaled to the given FoV so it matches the OpenXR conventions. More...
 
static void u_wait_until (struct os_precise_sleeper *sleeper, uint64_t until_ns)
 Waits until the given time using the os_precise_sleeper. More...
 
struct u_worker_thread_poolu_worker_thread_pool_create (uint32_t starting_worker_count, uint32_t thread_count, const char *prefix)
 Creates a new thread pool to be used by a worker group. More...
 
void u_worker_thread_pool_destroy (struct u_worker_thread_pool *uwtp)
 Internal function, only called by reference. More...
 
static void u_worker_thread_pool_reference (struct u_worker_thread_pool **dst, struct u_worker_thread_pool *src)
 Standard Monado reference function. More...
 
struct u_worker_groupu_worker_group_create (struct u_worker_thread_pool *uwtp)
 Create a new worker group. More...
 
void u_worker_group_push (struct u_worker_group *uwg, u_worker_group_func_t f, void *data)
 Push a new task to worker group. More...
 
void u_worker_group_wait_all (struct u_worker_group *uwg)
 Wait for all pushed tasks to be completed, "donates" this thread to the shared thread pool. More...
 
void u_worker_group_destroy (struct u_worker_group *uwg)
 Destroy a worker pool. More...
 
static void u_worker_group_reference (struct u_worker_group **dst, struct u_worker_group *src)
 Standard Monado reference function. More...
 
bool u_config_json_get_tracking_settings (struct u_config_json *json, struct xrt_settings_tracking *s)
 Extract tracking settings from the JSON. More...
 
bool u_config_json_get_tracking_overrides (struct u_config_json *json, struct xrt_tracking_override *out_overrides, size_t *out_override_count)
 Extract tracking override settings from the JSON. More...
 
static bool u_live_stats_ns::u_ls_ns_add (struct u_live_stats_ns *uls, uint64_t value)
 Add a value to the live stats struct, returns true if the struct is full either before or after adding the value. More...
 
struct u_sessionu_session::u_session_create (struct u_system *usys)
 Create a session, optionally pass in a u_system. More...
 
void u_session::u_session_event_push (struct u_session *us, const union xrt_session_event *xse)
 Push an event to this session. More...
 
void u_session::u_session_event_pop (struct u_session *us, union xrt_session_event *out_xse)
 Pop a single event from this session, if no event is available then the type of the event will be XRT_SESSION_EVENT_NONE. More...
 
struct u_systemu_system::u_system_create (void)
 Create a u_system. More...
 
void u_system::u_system_add_session (struct u_system *usys, struct xrt_session *xs, struct xrt_session_event_sink *xses)
 Add a xrt_session to be tracked and to receive multiplexed events. More...
 
void u_system::u_system_remove_session (struct u_system *usys, struct xrt_session *xs, struct xrt_session_event_sink *xses)
 Remove a xrt_session from tracking, it will no longer receive events, the given xses needs to match when it was added. More...
 
void u_system::u_system_broadcast_event (struct u_system *usys, const union xrt_session_event *xse)
 Broadcast event to all sessions under this system. More...
 
void u_system::u_system_set_system_compositor (struct u_system *usys, struct xrt_system_compositor *xsysc)
 Set the system compositor, used in the xrt_system_create_session call. More...
 
void u_system::u_system_fill_properties (struct u_system *usys, const char *name)
 Fill system properties. More...
 
struct time_statetime_state::time_state_create (int64_t offset)
 Create a struct time_state. More...
 
void time_state::time_state_destroy (struct time_state **state)
 Destroy a struct time_state. More...
 
timepoint_ns time_state::time_state_get_now (struct time_state const *state)
 Get the current time as an integer timestamp. More...
 
timepoint_ns time_state::time_state_get_now_and_update (struct time_state *state)
 Get the current time as an integer timestamp and update internal state. More...
 
void time_state::time_state_to_timespec (struct time_state const *state, timepoint_ns timestamp, struct timespec *out)
 Convert an integer timestamp to a struct timespec (system time). More...
 
timepoint_ns time_state::time_state_from_timespec (struct time_state const *state, const struct timespec *timespecTime)
 Convert a struct timespec (system time) to an integer timestamp. More...
 
timepoint_ns time_state::time_state_monotonic_to_ts_ns (struct time_state const *state, int64_t monotonic_ns)
 Convert a monotonic system time (such as from Portable Timekeeping) to an adjusted integer timestamp. More...
 
int64_t time_state::time_state_ts_to_monotonic_ns (struct time_state const *state, timepoint_ns timestamp)
 Convert a adjusted integer timestamp to an monotonic system time (such as from Portable Timekeeping). More...
 
void time_state::time_state_to_win32perfcounter (struct time_state const *state, timepoint_ns timestamp, LARGE_INTEGER *out_qpc_ticks)
 Converts a timestamp to Win32 "QPC" ticks. More...
 
timepoint_ns time_state::time_state_from_win32perfcounter (struct time_state const *state, const LARGE_INTEGER *qpc_ticks)
 Converts from Win32 "QPC" ticks to timestamp. More...
 

Detailed Description

Smaller pieces of auxiliary utilities code.

Macro Definition Documentation

◆ U_ARRAY_REALLOC_OR_FREE

#define U_ARRAY_REALLOC_OR_FREE (   VAR,
  TYPE,
  COUNT 
)    (VAR) = ((TYPE *)u_realloc_or_free((VAR), sizeof(TYPE) * (COUNT)))

#include <auxiliary/util/u_misc.h>

Re-allocate the space required for some type, and update the pointer - freeing the allocation instead if it can't be resized.

Use instead of a bare realloc when allocating an array of a type. This includes reallocating C strings: pass char as the type.

Be sure not to parenthesize the type! It will cause an error like "expression expected".

On the other hand, if you get an incompatible types error in assignment, that's a type mismatch, a real bug.

◆ U_BUILDER_SEARCH_MAX

#define U_BUILDER_SEARCH_MAX   (16)

#include <auxiliary/util/u_builders.h>

Max return of the number xrt_prober_device.

◆ U_CALLOC_WITH_CAST

#define U_CALLOC_WITH_CAST (   TYPE,
  SIZE 
)    ((TYPE *)calloc(1, SIZE))

#include <auxiliary/util/u_misc.h>

Allocate and zero the give size and casts the memory into a pointer of the given type.

Use instead of a bare calloc, but only when U_TYPED_CALLOC and U_TYPED_ARRAY_CALLOC do not meet your needs.

◆ U_LIVE_STATS_NAME_COUNT

#define U_LIVE_STATS_NAME_COUNT   (16)

#include <auxiliary/util/u_live_stats.h>

Number of chars for the name of the live stats.

◆ U_LIVE_STATS_VALUE_COUNT

#define U_LIVE_STATS_VALUE_COUNT   (1024)

#include <auxiliary/util/u_live_stats.h>

Max number of values that can be put into the trackers.

◆ U_TRACE_TARGET_SETUP

#define U_TRACE_TARGET_SETUP (   WHICH)

#include <auxiliary/util/u_trace_marker.h>

Add to target c file to enable tracing, see Tracing support.

◆ U_TYPED_ARRAY_CALLOC

#define U_TYPED_ARRAY_CALLOC (   TYPE,
  COUNT 
)    ((TYPE *)calloc((COUNT), sizeof(TYPE)))

#include <auxiliary/util/u_misc.h>

Allocate and zero the space required for some type, and cast the return type appropriately.

Use instead of a bare calloc when allocating an array of a type. This includes allocating C strings: pass char as the type.

◆ U_TYPED_CALLOC

#define U_TYPED_CALLOC (   TYPE)    ((TYPE *)calloc(1, sizeof(TYPE)))

#include <auxiliary/util/u_misc.h>

Allocate and zero the space required for some type, and cast the return type appropriately.

Use instead of a bare calloc when allocating a single structure.

◆ U_VAR_NAME_STRING_SIZE

#define U_VAR_NAME_STRING_SIZE   256

#include <auxiliary/util/u_var.h>

Maximum string length for a tracked variable.

◆ U_WAIT_MEASURED_SCHEDULER_LATENCY_NS

#define U_WAIT_MEASURED_SCHEDULER_LATENCY_NS   (uint64_t)(0)

#include <auxiliary/util/u_wait.h>

OS specific tweak to wait time.

Todo:
Measure on Windows.

◆ U_ZERO

#define U_ZERO (   PTR)    memset((PTR), 0, sizeof(*(PTR)))

#include <auxiliary/util/u_misc.h>

Zeroes the correct amount of memory based on the type pointed-to by the argument.

Use instead of memset(..., 0, ...) on a structure or pointer to structure.

◆ U_ZERO_ARRAY

#define U_ZERO_ARRAY (   ARRAY)    memset((ARRAY), 0, sizeof(ARRAY))

#include <auxiliary/util/u_misc.h>

Zeroes the correct amount of memory based on the type and size of the static array named in the argument.

Use instead of memset(..., 0, ...) on an array.

Typedef Documentation

◆ time_duration_ns

typedef int64_t time_duration_ns

#include <auxiliary/util/u_time.h>

Integer duration type in nanoseconds.

Logical type of timepoint differences.

See also
time_state
timepoint_ns

◆ timepoint_ns

typedef int64_t timepoint_ns

#include <auxiliary/util/u_time.h>

Integer timestamp type.

See also
time_state
time_duration_ns

◆ u_builder_open_system_fn

typedef xrt_result_t(* u_builder_open_system_fn) (struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_tracking_origin *origin, struct xrt_system_devices *xsysd, struct xrt_frame_context *xfctx, struct u_builder_roles_helper *ubrh)

#include <auxiliary/util/u_builders.h>

Argument to u_builder_roles_helper_open_system and implemented by u_builder::open_system_static_roles function.

A builder implement this function is free to focus on only creating the devices and assigning them initial roles. With this implementation details of the xrt_system_devices and xrt_space_overseer is taken care of by the caller of this function.

◆ u_var_button_cb

typedef void(* u_var_button_cb) (void *)

#include <auxiliary/util/u_var.h>

Callback for a button action.

◆ u_var_curve_getter

typedef struct u_var_curve_point(* u_var_curve_getter) (void *data, int i)

#include <auxiliary/util/u_var.h>

Callback for getting points on a curve.

◆ u_var_elm_cb

typedef void(* u_var_elm_cb) (struct u_var_info *info, void *)

#include <auxiliary/util/u_var.h>

Callback on each variable a root node has.

◆ u_var_root_cb

typedef void(* u_var_root_cb) (struct u_var_root_info *info, void *)

#include <auxiliary/util/u_var.h>

Callback for entering and leaving root nodes.

◆ u_worker_group_func_t

typedef void(* u_worker_group_func_t) (void *)

#include <auxiliary/util/u_worker.h>

Function typedef for tasks.

Enumeration Type Documentation

◆ u_trace_which

#include <auxiliary/util/u_trace_marker.h>

Should the extra tracks be enabled, see Tracing support.

◆ u_var_kind

enum u_var_kind

#include <auxiliary/util/u_var.h>

What kind of variable is this tracking.

Function Documentation

◆ time_is_greater_then_or_within_half_ms()

static bool time_is_greater_then_or_within_half_ms ( timepoint_ns  a,
timepoint_ns  b 
)
inlinestatic

◆ time_is_greater_then_or_within_range()

static bool time_is_greater_then_or_within_range ( timepoint_ns  a,
timepoint_ns  b,
int64_t  range 
)
inlinestatic

◆ time_is_less_then_or_within_half_ms()

static bool time_is_less_then_or_within_half_ms ( timepoint_ns  a,
timepoint_ns  b 
)
inlinestatic

#include <auxiliary/util/u_time.h>

Fuzzy comparisons.

See also
timepoint_ns

References time_is_less_then_or_within_range(), and U_TIME_HALF_MS_IN_NS.

◆ time_is_less_then_or_within_range()

static bool time_is_less_then_or_within_range ( timepoint_ns  a,
timepoint_ns  b,
int64_t  range 
)
inlinestatic

◆ time_is_within_half_ms()

static bool time_is_within_half_ms ( timepoint_ns  a,
timepoint_ns  b 
)
inlinestatic

#include <auxiliary/util/u_time.h>

Checks if two timepoints are with half a millisecond of each other.

See also
timepoint_ns

References time_is_within_range_of_each_other(), and U_TIME_HALF_MS_IN_NS.

◆ time_is_within_range_of_each_other()

static bool time_is_within_range_of_each_other ( timepoint_ns  a,
timepoint_ns  b,
int64_t  range 
)
inlinestatic

#include <auxiliary/util/u_time.h>

Checks if two timepoints are with a certain range of each other.

See also
timepoint_ns

Referenced by time_is_greater_then_or_within_range(), time_is_less_then_or_within_range(), and time_is_within_half_ms().

◆ time_ms_f_to_ns()

static timepoint_ns time_ms_f_to_ns ( double  ms_f)
inlinestatic

#include <auxiliary/util/u_time.h>

Convert double float milliseconds to nanoseconds, human comprehensible config inputs.

Recommended to keep the absolute value of the input relitively small.

See also
timepoint_ns

References U_TIME_1MS_IN_NS.

◆ time_ns_to_ms_f()

static double time_ns_to_ms_f ( time_duration_ns  ns)
inlinestatic

#include <auxiliary/util/u_time.h>

Convert nanoseconds to double float milliseconds, useful for printing.

See also
timepoint_ns

References U_TIME_1MS_IN_NS.

Referenced by comp_mirror_to_debug_gui::comp_mirror_fixup_ui_state().

◆ time_ns_to_s()

static double time_ns_to_s ( time_duration_ns  ns)
inlinestatic

#include <auxiliary/util/u_time.h>

Convert nanoseconds duration to double seconds.

See also
timepoint_ns

References U_TIME_1S_IN_NS.

◆ time_s_to_ns()

static time_duration_ns time_s_to_ns ( double  duration)
inlinestatic

#include <auxiliary/util/u_time.h>

Convert float seconds to nanoseconds.

See also
timepoint_ns

Referenced by get_info().

◆ time_state_create()

struct time_state * time_state_create ( int64_t  offset)

Create a struct time_state.

◆ time_state_destroy()

void time_state_destroy ( struct time_state **  state)

Destroy a struct time_state.

Should not be called simultaneously with any other time_state function.

◆ time_state_from_timespec()

timepoint_ns time_state_from_timespec ( struct time_state const *  state,
const struct timespec *  timespecTime 
)

Convert a struct timespec (system time) to an integer timestamp.

Should not be called simultaneously with time_state_get_now_and_update.

References time_state::time_state_monotonic_to_ts_ns(), and U_1_000_000_000.

◆ time_state_from_win32perfcounter()

timepoint_ns time_state_from_win32perfcounter ( struct time_state const *  state,
const LARGE_INTEGER *  qpc_ticks 
)

Converts from Win32 "QPC" ticks to timestamp.

Should not be called simultaneously with time_state_get_now_and_update.

◆ time_state_get_now()

timepoint_ns time_state_get_now ( struct time_state const *  state)

Get the current time as an integer timestamp.

Does not update internal state for timekeeping. Should not be called simultaneously with time_state_get_now_and_update.

References os_monotonic_get_ns(), and time_state::time_state_monotonic_to_ts_ns().

Referenced by time_state::time_state_get_now_and_update().

◆ time_state_get_now_and_update()

timepoint_ns time_state_get_now_and_update ( struct time_state state)

Get the current time as an integer timestamp and update internal state.

This should be called regularly, but only from one thread. It updates the association between the timing sources.

Should not be called simultaneously with any other time_state function.

References time_state::time_state_get_now().

◆ time_state_monotonic_to_ts_ns()

timepoint_ns time_state_monotonic_to_ts_ns ( struct time_state const *  state,
int64_t  monotonic_ns 
)

Convert a monotonic system time (such as from Portable Timekeeping) to an adjusted integer timestamp.

Adjustments may need to be applied to achieve the other guarantees that e.g. CLOCK_MONOTONIC does not provide: this function performs those adjustments.

Should not be called simultaneously with time_state_get_now_and_update.

Referenced by time_state::time_state_from_timespec(), and time_state::time_state_get_now().

◆ time_state_to_timespec()

void time_state_to_timespec ( struct time_state const *  state,
timepoint_ns  timestamp,
struct timespec *  out 
)

Convert an integer timestamp to a struct timespec (system time).

Should not be called simultaneously with time_state_get_now_and_update.

◆ time_state_to_win32perfcounter()

void time_state_to_win32perfcounter ( struct time_state const *  state,
timepoint_ns  timestamp,
LARGE_INTEGER *  out_qpc_ticks 
)

Converts a timestamp to Win32 "QPC" ticks.

Should not be called simultaneously with time_state_get_now_and_update.

◆ time_state_ts_to_monotonic_ns()

int64_t time_state_ts_to_monotonic_ns ( struct time_state const *  state,
timepoint_ns  timestamp 
)

Convert a adjusted integer timestamp to an monotonic system time (such as from Portable Timekeeping).

Should not be called simultaneously with time_state_get_now_and_update.

Referenced by oxr_session_frame_end(), and oxr_xdev_get_hand_tracking_at().

◆ u_builder_create_space_overseer_legacy()

void u_builder_create_space_overseer_legacy ( struct xrt_session_event_sink broadcast,
struct xrt_device head,
struct xrt_device left,
struct xrt_device right,
struct xrt_device **  xdevs,
uint32_t  xdev_count,
bool  root_is_unbounded,
struct xrt_space_overseer **  out_xso 
)

#include <auxiliary/util/u_builders.h>

Create a legacy space overseer, most builders probably want to have a more advanced setup then this, especially stand alone ones.

Uses u_builder_setup_tracking_origins internally and u_space_overseer_legacy_setup.

References u_space_overseer::broadcast, u_builder_setup_tracking_origins(), u_space_overseer_create(), u_space_overseer_legacy_setup(), and xrt_pose::XRT_POSE_IDENTITY.

Referenced by u_builder_roles_helper_open_system().

◆ u_builder_find_prober_device()

struct xrt_prober_device * u_builder_find_prober_device ( struct xrt_prober_device *const *  xpdevs,
size_t  xpdev_count,
uint16_t  vendor_id,
uint16_t  product_id,
enum xrt_bus_type  bus_type 
)

◆ u_builder_open_system_static_roles()

xrt_result_t u_builder_open_system_static_roles ( struct xrt_builder xb,
cJSON *  config,
struct xrt_prober xp,
struct xrt_session_event_sink broadcast,
struct xrt_system_devices **  out_xsysd,
struct xrt_space_overseer **  out_xso 
)

#include <auxiliary/util/u_builders.h>

Implementation for xrt_builder::open_system to be used with u_builder.

Uses u_builder_roles_helper_open_system internally, a builder that uses the u_builder should use this function for xrt_builder::open_system.

When using this function the builder must have u_builder and implement the u_builder::open_system_static_roles function, see documentation for u_builder_open_system_fn about requirements.

References u_builder::open_system_static_roles, and u_builder_roles_helper_open_system().

◆ u_builder_roles_helper_open_system()

◆ u_builder_search()

void u_builder_search ( struct xrt_prober xp,
struct xrt_prober_device *const *  xpdevs,
size_t  xpdev_count,
const struct u_builder_search_filter filters,
size_t  filter_count,
struct u_builder_search_results results 
)

◆ u_builder_setup_tracking_origins()

void u_builder_setup_tracking_origins ( struct xrt_device head,
struct xrt_device left,
struct xrt_device right,
struct xrt_vec3 global_tracking_origin_offset 
)

#include <auxiliary/util/u_builders.h>

Helper function for setting up tracking origins.

Applies 3dof offsets for devices with XRT_TRACKING_TYPE_NONE.

References xrt_device::tracking_origin, and xrt_tracking_origin::type.

Referenced by u_builder_create_space_overseer_legacy().

◆ u_config_json_get_active()

void u_config_json_get_active ( struct u_config_json json,
enum u_config_json_active_config out_active 
)

#include <auxiliary/util/u_config_json.h>

Read from the JSON loaded json config file and returns the active config, can be overridden by P_OVERRIDE_ACTIVE_CONFIG envirmental variable.

◆ u_config_json_get_remote_settings()

bool u_config_json_get_remote_settings ( struct u_config_json json,
int *  out_port,
uint32_t *  out_view_count 
)

#include <auxiliary/util/u_config_json.h>

Extract remote settings from the JSON.

References U_LOG_E.

◆ u_config_json_get_tracking_overrides() [1/2]

bool u_config_json_get_tracking_overrides ( struct u_config_json json,
struct xrt_tracking_override out_overrides,
size_t out_override_count 
)

#include <auxiliary/util/u_config_json.h>

Extract tracking override settings from the JSON.

Caller allocates an array of XRT_MAX_TRACKING_OVERRIDES tracking_override.

◆ u_config_json_get_tracking_overrides() [2/2]

bool u_config_json_get_tracking_overrides ( struct u_config_json json,
struct xrt_tracking_override out_overrides,
size_t out_override_count 
)
related

Extract tracking override settings from the JSON.

Caller allocates an array of XRT_MAX_TRACKING_OVERRIDES tracking_override.

◆ u_config_json_get_tracking_settings() [1/2]

bool u_config_json_get_tracking_settings ( struct u_config_json json,
struct xrt_settings_tracking s 
)

#include <auxiliary/util/u_config_json.h>

Extract tracking settings from the JSON.

◆ u_config_json_get_tracking_settings() [2/2]

bool u_config_json_get_tracking_settings ( struct u_config_json json,
struct xrt_settings_tracking s 
)
related

Extract tracking settings from the JSON.

◆ u_config_json_open_or_create_main_file()

void u_config_json_open_or_create_main_file ( struct u_config_json json)

#include <auxiliary/util/u_config_json.h>

Load the JSON config file.

◆ u_config_json_save_calibration()

void u_config_json_save_calibration ( struct u_config_json json,
struct xrt_settings_tracking settings 
)

#include <auxiliary/util/u_config_json.h>

Writes back calibration settings to the main config file.

References u_config_json::file_loaded.

◆ u_config_json_save_overrides()

void u_config_json_save_overrides ( struct u_config_json json,
struct xrt_tracking_override overrides,
size_t  override_count 
)

#include <auxiliary/util/u_config_json.h>

Writes back tracking override settings to the main config file.

References u_config_json::file_loaded.

◆ u_device_allocate()

void * u_device_allocate ( enum u_device_alloc_flags  flags,
size_t  size,
size_t  input_count,
size_t  output_count 
)

#include <auxiliary/util/u_device.h>

Helper function to allocate a device plus inputs in the same allocation placed after the device in memory.

Will setup any pointers and num values.

◆ u_device_assign_xdev_roles()

void u_device_assign_xdev_roles ( struct xrt_device **  xdevs,
size_t  xdev_count,
int *  head,
int *  left,
int *  right 
)

#include <auxiliary/util/u_device.h>

Helper function to assign head, left hand and right hand roles.

Todo:
: do something with unassigned devices?

◆ u_device_dump_config()

void u_device_dump_config ( struct xrt_device xdev,
const char *  prefix,
const char *  prod 
)

#include <auxiliary/util/u_device.h>

Dump the device config to stderr.

References U_LOG_RAW.

◆ u_device_free()

void u_device_free ( struct xrt_device xdev)

#include <auxiliary/util/u_device.h>

Helper function to free a device and any data hanging of it.

References xrt_hmd_parts::distortion, xrt_device::hmd, xrt_hmd_parts::indices, and xrt_hmd_parts::vertices.

◆ u_device_ni_compute_distortion()

bool u_device_ni_compute_distortion ( struct xrt_device xdev,
uint32_t  view,
float  u,
float  v,
struct xrt_uv_triplet out_result 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::compute_distortion.

◆ u_device_ni_get_battery_status()

xrt_result_t u_device_ni_get_battery_status ( struct xrt_device xdev,
bool out_present,
bool out_charging,
float *  out_charge 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::get_battery_status.

◆ u_device_ni_get_hand_tracking()

void u_device_ni_get_hand_tracking ( struct xrt_device xdev,
enum xrt_input_name  name,
uint64_t  desired_timestamp_ns,
struct xrt_hand_joint_set out_value,
uint64_t *  out_timestamp_ns 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::get_hand_tracking.

◆ u_device_ni_get_view_poses()

void u_device_ni_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 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::get_view_poses.

◆ u_device_ni_get_visibility_mask()

xrt_result_t u_device_ni_get_visibility_mask ( struct xrt_device xdev,
enum xrt_visibility_mask_type  type,
uint32_t  view_index,
struct xrt_visibility_mask **  out_mask 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::get_visibility_mask.

◆ u_device_ni_is_form_factor_available()

bool u_device_ni_is_form_factor_available ( struct xrt_device xdev,
enum xrt_form_factor  form_factor 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::is_form_factor_available.

◆ u_device_ni_set_output()

void u_device_ni_set_output ( struct xrt_device xdev,
enum xrt_output_name  name,
const union xrt_output_value value 
)

#include <auxiliary/util/u_device.h>

Not implemented function for xrt_device::set_output.

◆ u_device_noop_update_inputs()

xrt_result_t u_device_noop_update_inputs ( struct xrt_device xdev)

#include <auxiliary/util/u_device.h>

Noop function for xrt_device::update_inputs, should only be used from a device with any inputs.

References XRT_SUCCESS.

◆ u_device_setup_one_eye()

bool u_device_setup_one_eye ( struct xrt_device xdev,
const struct u_device_simple_info info 
)

#include <auxiliary/util/u_device.h>

Setup the device information given a very simple info struct.

Returns
true on success.

References xrt_hmd_parts::blend_modes, and xrt_device::hmd.

◆ u_device_setup_split_side_by_side()

bool u_device_setup_split_side_by_side ( struct xrt_device xdev,
const struct u_device_simple_info info 
)

#include <auxiliary/util/u_device.h>

Setup the device information given a very simple info struct.

Returns
true on success.

References xrt_hmd_parts::blend_modes, and xrt_device::hmd.

◆ u_extents_2d_split_side_by_side()

bool u_extents_2d_split_side_by_side ( struct xrt_device xdev,
const struct u_extents_2d extents 
)

#include <auxiliary/util/u_device.h>

Setup the device's display's 2D extents.

Good for headsets without traditional VR optics.

Returns
true on success.

References xrt_view::display, xrt_device::hmd, xrt_view::rot, xrt_hmd_parts::screens, xrt_view::viewport, and xrt_hmd_parts::views.

◆ u_format_block_height()

uint32_t u_format_block_height ( enum xrt_format  f)

#include <auxiliary/util/u_format.h>

Returns the height of the block for the given format.

Referenced by u_format_size_for_dimensions(), and u_frame_create_roi().

◆ u_format_block_size()

size_t u_format_block_size ( enum xrt_format  f)

#include <auxiliary/util/u_format.h>

Returns the size of the block for the given format.

Referenced by get_score(), u_format_size_for_dimensions(), and u_frame_create_roi().

◆ u_format_block_width()

uint32_t u_format_block_width ( enum xrt_format  f)

#include <auxiliary/util/u_format.h>

Returns the width of the block for the given format.

Referenced by u_format_size_for_dimensions(), and u_frame_create_roi().

◆ u_format_is_blocks()

bool u_format_is_blocks ( enum xrt_format  f)

#include <auxiliary/util/u_format.h>

Is this format block based, also returns true for formats that 1x1 blocks.

Referenced by u_frame_create_one_off().

◆ u_format_size_for_dimensions()

void u_format_size_for_dimensions ( enum xrt_format  f,
uint32_t  width,
uint32_t  height,
size_t out_stride,
size_t out_size 
)

#include <auxiliary/util/u_format.h>

Calculate stride and size for the format and given width and height.

References u_format_block_height(), u_format_block_size(), and u_format_block_width().

◆ u_format_str()

const char * u_format_str ( enum xrt_format  f)

#include <auxiliary/util/u_format.h>

Return string for this format.

◆ u_hand_joints_apply_joint_width()

void u_hand_joints_apply_joint_width ( struct xrt_hand_joint_set set)

#include <auxiliary/util/u_hand_tracking.h>

Applies joint width to set.

◆ u_hashmap_int_clear_and_call_for_each()

void u_hashmap_int_clear_and_call_for_each ( struct u_hashmap_int hmi,
u_hashmap_int_callback  cb,
void *  priv 
)

#include <auxiliary/util/u_hashmap.h>

First clear the hashmap and then call the given callback with each item that was in the hashmap.

◆ u_hashmap_int_for_each()

void u_hashmap_int_for_each ( const struct u_hashmap_int hmi,
u_hashmap_int_foreach_callback  cb,
void *  priv_ctx 
)

#include <auxiliary/util/u_hashmap.h>

iterators through each [key,item] pairs of hash map

Parameters
hmihash map to iterate
cbcallback invoked for each [key,item] pair + a user context.
priv_ctxuser provided context, passed into cb

◆ u_hashset_clear_and_call_for_each()

void u_hashset_clear_and_call_for_each ( struct u_hashset hs,
u_hashset_callback  cb,
void *  priv 
)

#include <auxiliary/util/u_hashset.h>

First clear the hashset and then call the given callback with each item that was in the hashset.

◆ u_limited_unique_id_get()

xrt_limited_unique_id_t u_limited_unique_id_get ( void  )

#include <auxiliary/util/u_limited_unique_id.h>

This function returns a unsigned 64 bit value that is guaranteed to be unique within the current running process, and not zero.

There is of course the limit of running out of those ID once all values has been returned, but the value is 64 bit so that should not be a practical limit. The value is useful when needing to implement caching of a complex object, this lets us not use memory addresses as keys which may be reused by underlying alloc implementation and could lead to false hits.

The current implementation is naive and is a simple monotonic counter.

◆ u_linux_try_to_set_realtime_priority_on_thread()

void u_linux_try_to_set_realtime_priority_on_thread ( enum u_logging_level  log_level,
const char *  name 
)

#include <auxiliary/util/u_linux.h>

Try to set realtime priority on this thread.

Passing in log_level to control how chatty this function is, the name is to make the logging pretty, can be NULL and the code will try to figure out the name itself.

Parameters
nameThread name to be used in logging.
log_levelLogging level to control chattiness.

◆ u_ls_ns_add()

static bool u_ls_ns_add ( struct u_live_stats_ns uls,
uint64_t  value 
)
inlinestatic

Add a value to the live stats struct, returns true if the struct is full either before or after adding the value.

References ARRAY_SIZE, u_live_stats_ns::value_count, and u_live_stats_ns::values.

◆ u_native_images_debug_clear()

static void u_native_images_debug_clear ( struct u_native_images_debug unid)
inlinestatic

◆ u_native_images_debug_clear_locked()

static void u_native_images_debug_clear_locked ( struct u_native_images_debug unid)
inlinestatic

◆ u_native_images_debug_destroy()

◆ u_native_images_debug_init()

static void u_native_images_debug_init ( struct u_native_images_debug unid)
inlinestatic

#include <auxiliary/util/u_native_images_debug.h>

Must be called before variable is tracked.

References u_native_images_debug::mutex, and os_mutex::os_mutex_init().

Referenced by u_swapchain_debug_init().

◆ u_native_images_debug_lock()

◆ u_native_images_debug_set()

static void u_native_images_debug_set ( struct u_native_images_debug unid,
xrt_limited_unique_id_t  limited_unique_id,
struct xrt_image_native native_images,
uint32_t  native_image_count,
const struct xrt_swapchain_create_info xscci,
uint32_t  active_index,
bool  flip_y 
)
inlinestatic

#include <auxiliary/util/u_native_images_debug.h>

Updates all variables atomically by holding the lock.

References u_native_images_debug_lock(), u_native_images_debug_set_locked(), and u_native_images_debug_unlock().

◆ u_native_images_debug_set_locked()

static void u_native_images_debug_set_locked ( struct u_native_images_debug unid,
xrt_limited_unique_id_t  limited_unique_id,
struct xrt_image_native native_images,
uint32_t  native_image_count,
const struct xrt_swapchain_create_info xscci,
uint32_t  active_index,
bool  flip_y 
)
inlinestatic

◆ u_native_images_debug_unlock()

◆ u_process_create_if_not_running()

struct u_process * u_process_create_if_not_running ( void  )

#include <auxiliary/util/u_process.h>

Creates a handle for this process that is unique to the operating system user.

Returns NULL if another process holding a handle is already running.

Todo:
If built without libbsd support, a placeholder value is returned that needs to be handled by the caller.
Returns
a new u_process handle if no monado instance is running, NULL if another instance is already running.
Todo:
alternative implementation

◆ u_process_destroy()

void u_process_destroy ( struct u_process proc)

#include <auxiliary/util/u_process.h>

Releases the unique handle of the operating system user.

◆ u_realloc_or_free()

static void * u_realloc_or_free ( void *  ptr,
size_t  new_size 
)
inlinestatic

#include <auxiliary/util/u_misc.h>

Reallocates or frees dynamically-allocated memory.

Wraps realloc with a return value check, freeing the provided memory if it is NULL, to avoid leaks. Use U_ARRAY_REALLOC_OR_FREE() instead.

◆ u_session_create()

struct u_session * u_session_create ( struct u_system usys)

Create a session, optionally pass in a u_system.

If usys is not NULL the call register this session on that system. This function is exposed so that code can reuse u_session as a base class.

References xrt_session::poll_events, and U_TYPED_CALLOC.

◆ u_session_event_pop()

void u_session_event_pop ( struct u_session us,
union xrt_session_event out_xse 
)

Pop a single event from this session, if no event is available then the type of the event will be XRT_SESSION_EVENT_NONE.

References os_mutex::os_mutex_lock(), os_mutex::os_mutex_unlock(), U_ZERO, and XRT_SESSION_EVENT_NONE.

◆ u_session_event_push()

void u_session_event_push ( struct u_session us,
const union xrt_session_event xse 
)

Push an event to this session.

This function is exposed so that code can reuse u_session as a base class.

References os_mutex::os_mutex_lock(), os_mutex::os_mutex_unlock(), and U_TYPED_CALLOC.

◆ u_space_overseer_create()

struct u_space_overseer * u_space_overseer_create ( struct xrt_session_event_sink broadcast)

#include <auxiliary/util/u_space_overseer.h>

Create a default implementation of a space overseer.

Parameters
[in]broadcastEvent sink that broadcasts events to all sessions.

References xrt_space_overseer::create_local_space, and U_TYPED_CALLOC.

Referenced by u_builder_create_space_overseer_legacy().

◆ u_space_overseer_create_null_space()

void u_space_overseer_create_null_space ( struct u_space_overseer uso,
struct xrt_space parent,
struct xrt_space **  out_space 
)

#include <auxiliary/util/u_space_overseer.h>

Creates a space without any offset, this is just for optimisation over a regular offset space.

◆ u_space_overseer_legacy_setup()

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 
)

#include <auxiliary/util/u_space_overseer.h>

Sets up the space overseer and all semantic spaces in a way that works with the old xrt_tracking_origin information.

Will automatically create local and stage spaces. If another setup is needed the builder should manually set the space graph up using below functions.

References xrt_space_overseer::root, and xrt_device::tracking_origin.

Referenced by u_builder_create_space_overseer_legacy().

◆ u_space_overseer_link_space_to_device()

void u_space_overseer_link_space_to_device ( struct u_space_overseer uso,
struct xrt_space xs,
struct xrt_device xdev 
)

#include <auxiliary/util/u_space_overseer.h>

The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping when creating pose spaces.

This function allows builders to create a much more bespoke setup. This function adds a reference to the space.

References u_space_overseer::lock.

◆ u_swapchain_debug_clear()

static void u_swapchain_debug_clear ( struct u_swapchain_debug uscd)
inlinestatic

◆ u_swapchain_debug_destroy()

static void u_swapchain_debug_destroy ( struct u_swapchain_debug uscd)
inlinestatic

◆ u_swapchain_debug_init()

static void u_swapchain_debug_init ( struct u_swapchain_debug uscd)
inlinestatic

#include <auxiliary/util/u_native_images_debug.h>

Must be called before variable is tracked.

References u_swapchain_debug::base, and u_native_images_debug_init().

◆ u_swapchain_debug_lock()

static void u_swapchain_debug_lock ( struct u_swapchain_debug uscd)
inlinestatic

◆ u_swapchain_debug_set()

◆ u_swapchain_debug_unlock()

static void u_swapchain_debug_unlock ( struct u_swapchain_debug uscd)
inlinestatic

◆ u_system_add_session()

void u_system_add_session ( struct u_system usys,
struct xrt_session xs,
struct xrt_session_event_sink xses 
)

Add a xrt_session to be tracked and to receive multiplexed events.

References u_system::count, os_mutex::os_mutex_lock(), os_mutex::os_mutex_unlock(), u_system::pairs, and U_ARRAY_REALLOC_OR_FREE.

◆ u_system_broadcast_event()

void u_system_broadcast_event ( struct u_system usys,
const union xrt_session_event xse 
)

◆ u_system_create()

struct u_system * u_system_create ( void  )

Create a u_system.

References xrt_system::create_session, and U_TYPED_CALLOC.

Referenced by sdl_system_init().

◆ u_system_devices()

static struct u_system_devices * u_system_devices ( struct xrt_system_devices xsysd)
inlinestatic

#include <auxiliary/util/u_system_helpers.h>

Small inline helper to cast from xrt_system_devices.

Referenced by u_system_devices_close().

◆ u_system_devices_allocate()

struct u_system_devices * u_system_devices_allocate ( void  )

#include <auxiliary/util/u_system_helpers.h>

Allocates a empty u_system_devices to be filled in by the caller, only the destroy function is filled in.

References xrt_system_devices::destroy, and U_TYPED_CALLOC.

◆ u_system_devices_close()

void u_system_devices_close ( struct xrt_system_devices xsysd)

#include <auxiliary/util/u_system_helpers.h>

Destroys all devices and clears out the frame context, doesn't free the struct itself, useful for code embedding the system devices struct into other objects where it's not the first member or C++ classes.

References ARRAY_SIZE, u_system_devices(), xrt_system_devices::xdevs, u_system_devices::xfctx, xrt_device::xrt_device_destroy(), and xrt_frame_context::xrt_frame_context_destroy_nodes().

◆ u_system_devices_create_from_prober()

xrt_result_t u_system_devices_create_from_prober ( struct xrt_instance xinst,
struct xrt_session_event_sink broadcast,
struct xrt_system_devices **  out_xsysd,
struct xrt_space_overseer **  out_xso 
)

#include <auxiliary/util/u_system_helpers.h>

Takes a xrt_instance, gets the prober from it and then uses the prober to allocate a filled in u_system_devices.

References xrt_instance::xrt_instance_get_prober(), xrt_prober::xrt_prober_create_system(), xrt_prober::xrt_prober_probe(), and XRT_SUCCESS.

◆ u_system_devices_get_ht_device()

struct xrt_device * u_system_devices_get_ht_device ( struct xrt_system_devices xsysd,
enum xrt_input_name  name 
)

#include <auxiliary/util/u_system_helpers.h>

Helper function.

Looks through xrt_system_devices's devices and returns the first device that supports hand tracking and the supplied input name.

Used by target_builder_lighthouse to find Knuckles controllers in the list of devices returned, the legacy builder to find hand tracking devices, etc.

References xrt_device::input_count, xrt_device::inputs, xrt_system_devices::xdev_count, and xrt_system_devices::xdevs.

Referenced by u_system_devices_get_ht_device_left(), and u_system_devices_get_ht_device_right().

◆ u_system_devices_get_ht_device_left()

static struct xrt_device * u_system_devices_get_ht_device_left ( struct xrt_system_devices xsysd)
inlinestatic

#include <auxiliary/util/u_system_helpers.h>

Helper to get the first left hand-tracking device, uses u_system_devices_get_ht_device.

References u_system_devices_get_ht_device().

◆ u_system_devices_get_ht_device_right()

static struct xrt_device * u_system_devices_get_ht_device_right ( struct xrt_system_devices xsysd)
inlinestatic

#include <auxiliary/util/u_system_helpers.h>

Helper to get the first right hand-tracking device, uses u_system_devices_get_ht_device.

References u_system_devices_get_ht_device().

◆ u_system_devices_static()

static struct u_system_devices_static * u_system_devices_static ( struct xrt_system_devices xsysd)
inlinestatic

#include <auxiliary/util/u_system_helpers.h>

Small inline helper to cast from xrt_system_devices.

◆ u_system_devices_static_allocate()

struct u_system_devices_static * u_system_devices_static_allocate ( void  )

#include <auxiliary/util/u_system_helpers.h>

Allocates a empty u_system_devices to be filled in by the caller, only the destroy function is filled in.

References xrt_system_devices::destroy, and U_TYPED_CALLOC.

Referenced by u_builder_roles_helper_open_system().

◆ u_system_devices_static_finalize()

void u_system_devices_static_finalize ( struct u_system_devices_static usysds,
struct xrt_device left,
struct xrt_device right 
)

#include <auxiliary/util/u_system_helpers.h>

Finalizes the static struct with the given input devices, the system devices will always return these devices for the left and right role.

This function must be called before xrt_system_devices_get_roles is called.

Referenced by u_builder_roles_helper_open_system().

◆ u_system_fill_properties()

void u_system_fill_properties ( struct u_system usys,
const char *  name 
)

Fill system properties.

◆ u_system_remove_session()

void u_system_remove_session ( struct u_system usys,
struct xrt_session xs,
struct xrt_session_event_sink xses 
)

Remove a xrt_session from tracking, it will no longer receive events, the given xses needs to match when it was added.

References u_system::count, os_mutex::os_mutex_lock(), u_system::pairs, and U_LOG_E.

◆ u_system_set_system_compositor()

void u_system_set_system_compositor ( struct u_system usys,
struct xrt_system_compositor xsysc 
)

Set the system compositor, used in the xrt_system_create_session call.

References u_system::xsysc.

◆ u_trace_marker_init()

void u_trace_marker_init ( void  )

#include <auxiliary/util/u_trace_marker.h>

Must be called from a non-static/global constructor context.

Referenced by xrt_instance::xrt_instance_create().

◆ u_trace_marker_setup()

void u_trace_marker_setup ( enum u_trace_which  which)

#include <auxiliary/util/u_trace_marker.h>

Internal setup function, use U_TRACE_TARGET_SETUP, see Tracing support.

◆ u_truncate_snprintf()

static int u_truncate_snprintf ( char *  chars,
size_t  char_count,
const char *  fmt,
  ... 
)
inlinestatic

#include <auxiliary/util/u_truncate_printf.h>

We want to truncate the value, not get the possible written, and error when we can not write out anything.

See u_truncate_vsnprintf for more info.

@

References u_truncate_vsnprintf().

◆ u_truncate_vsnprintf()

static int u_truncate_vsnprintf ( char *  chars,
size_t  char_count,
const char *  fmt,
va_list  args 
)
inlinestatic

#include <auxiliary/util/u_truncate_printf.h>

We want to truncate the value, not get the possible written.

There are no version of the many Windows versions of this functions that truncates and returns the number of bytes written (not including null). Also need to have the same behaviour on Linux.

@

Referenced by u_truncate_snprintf().

◆ u_var_add_root()

void u_var_add_root ( void *  root,
const char *  c_name,
bool  suffix_with_number 
)

#include <auxiliary/util/u_var.h>

Add a named root object, the u_var subsystem is completely none-invasive to the object it's tracking.

The root pointer is used as a entry into a hashmap of hidden objects. When not active all calls are stubs and have no side-effects.

This is intended only for debugging and is turned off by default, as this all very very unsafe. It is only pointers straight into objects, completely ignores ownership or any safe practices.

The parameter suffix_with_number makes the variable tracking code suffix the name of the object with with a number. This allows multiple objects of the same name name.

// On create
u_var_add_root((void*)psmv, "PS Move Controller", true);
u_var_add_rgb_u8((void*)psmv, &psmv->led_color, "LED");
u_var_add_log_level(psmv, &psmv->log_level, "Log level");
// On destroy, only need to destroy the root object.
u_var_remove_root((void*)psmv);
void u_var_add_root(void *root, const char *c_name, bool suffix_with_number)
Add a named root object, the u_var subsystem is completely none-invasive to the object it's tracking.
void u_var_remove_root(void *root)
Remove the root node.
Parameters
rootObject to be tracked.
c_nameName of object, null terminated "C" string.
suffix_with_numberShould name be suffixed with a number.

◆ u_var_force_on()

void u_var_force_on ( void  )

#include <auxiliary/util/u_var.h>

This forces the variable tracking code to on, it is disabled by default.

◆ u_var_remove_root()

void u_var_remove_root ( void *  root)

#include <auxiliary/util/u_var.h>

Remove the root node.

Referenced by comp_mirror_to_debug_gui::comp_mirror_fini().

◆ u_var_visit()

void u_var_visit ( u_var_root_cb  enter_cb,
u_var_root_cb  exit_cb,
u_var_elm_cb  elem_cb,
void *  priv 
)

#include <auxiliary/util/u_var.h>

Visit all root nodes and their variables.

◆ u_visibility_mask_get_default()

void u_visibility_mask_get_default ( enum xrt_visibility_mask_type  type,
const struct xrt_fov fov,
struct xrt_visibility_mask **  out_mask 
)

#include <auxiliary/util/u_visibility_mask.h>

Default visibility mask, only returns a very simple mask with four small triangles in each corner, scaled to the given FoV so it matches the OpenXR conventions.

The caller must take care of de-allocating the mask once done with it.

◆ u_wait_until()

static void u_wait_until ( struct os_precise_sleeper sleeper,
uint64_t  until_ns 
)
inlinestatic

◆ u_worker_group_create()

struct u_worker_group * u_worker_group_create ( struct u_worker_thread_pool uwtp)

#include <auxiliary/util/u_worker.h>

Create a new worker group.

◆ u_worker_group_destroy()

void u_worker_group_destroy ( struct u_worker_group uwg)

#include <auxiliary/util/u_worker.h>

Destroy a worker pool.

Referenced by u_worker_group_reference().

◆ u_worker_group_push()

void u_worker_group_push ( struct u_worker_group uwg,
u_worker_group_func_t  f,
void *  data 
)

#include <auxiliary/util/u_worker.h>

Push a new task to worker group.

Todo:
Don't wait all, wait one.

Referenced by xrt::auxiliary::util::TaskCollection::TaskCollection().

◆ u_worker_group_reference()

static void u_worker_group_reference ( struct u_worker_group **  dst,
struct u_worker_group src 
)
inlinestatic

◆ u_worker_group_wait_all()

void u_worker_group_wait_all ( struct u_worker_group uwg)

#include <auxiliary/util/u_worker.h>

Wait for all pushed tasks to be completed, "donates" this thread to the shared thread pool.

Referenced by xrt::auxiliary::util::TaskCollection::waitAll().

◆ u_worker_thread_pool_create()

struct u_worker_thread_pool * u_worker_thread_pool_create ( uint32_t  starting_worker_count,
uint32_t  thread_count,
const char *  prefix 
)

#include <auxiliary/util/u_worker.h>

Creates a new thread pool to be used by a worker group.

Parameters
starting_worker_countHow many worker threads can be active at the same time without any "donated" threads.
thread_countThe number of threads to be created in total, this is the maximum threads that can be in flight at the same time.
prefixPrefix to used when naming threads, used for tracing and debugging.

Referenced by xrt::auxiliary::util::SharedThreadPool::SharedThreadPool().

◆ u_worker_thread_pool_destroy()

void u_worker_thread_pool_destroy ( struct u_worker_thread_pool uwtp)

#include <auxiliary/util/u_worker.h>

Internal function, only called by reference.

Referenced by u_worker_thread_pool_reference().

◆ u_worker_thread_pool_reference()

static void u_worker_thread_pool_reference ( struct u_worker_thread_pool **  dst,
struct u_worker_thread_pool src 
)
inlinestatic