|
Monado OpenXR Runtime
|
Misc helpers for device drivers. More...

Go to the source code of this file.
Data Structures | |
| struct | u_extents_2d |
| Info to describe 2D extents of a device's screen. More... | |
| struct | u_device_simple_info |
| Info to describe a very simple headset with diffractive lens optics. More... | |
Macros | |
| #define | U_DEVICE_ALLOCATE(type, flags, input_count, output_count) ((type *)u_device_allocate(flags, sizeof(type), input_count, output_count)) |
| #define | XRT_DEVICE_ROLE_UNASSIGNED (-1) |
Typedefs | |
| typedef xrt_result_t(* | u_device_get_tracked_pose_function_t) (struct xrt_device *xdev, const enum xrt_input_name name, const int64_t at_timestamp_ns, struct xrt_space_relation *const out_relation) |
| Function pointer type for the device's get_tracked_pose function. More... | |
| typedef void(* | u_device_destroy_function_t) (struct xrt_device *xdev) |
| Function pointer type for the device's destroy function. More... | |
Enumerations | |
| enum | u_device_alloc_flags { U_DEVICE_ALLOC_NO_FLAGS = 0 , U_DEVICE_ALLOC_HMD = 1u << 0u , U_DEVICE_ALLOC_TRACKING_NONE = 1u << 1u } |
Functions | |
| 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 *eyes, int *face, int *left, int *right, int *gamepad) |
| Helper function to assign head, left hand, right hand, and gamepad roles. More... | |
| void | u_device_get_view_pose (const struct xrt_vec3 *eye_relation, uint32_t view_index, struct xrt_pose *out_pose) |
Helper function for get_view_pose in an HMD driver. More... | |
| xrt_result_t | u_device_get_view_poses (struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, enum xrt_view_type view_type, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses) |
| Helper function to implement xrt_device::get_view_poses in a HMD driver. More... | |
| xrt_result_t | u_device_get_visibility_mask (struct xrt_device *xdev, enum xrt_visibility_mask_type type, uint32_t view_index, struct xrt_visibility_mask **out_mask) |
| Helper function to implement xrt_device::get_visibility_mask in a HMD driver. 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_populate_function_pointers (struct xrt_device *xdev, u_device_get_tracked_pose_function_t get_tracked_pose_fn, u_device_destroy_function_t destroy_fn) |
| Populate the device's function pointers with default implementations. More... | |
Variables | |
| const struct xrt_matrix_2x2 | u_device_rotation_right |
| const struct xrt_matrix_2x2 | u_device_rotation_left |
| const struct xrt_matrix_2x2 | u_device_rotation_ident |
| const struct xrt_matrix_2x2 | u_device_rotation_180 |
Misc helpers for device drivers.
| void u_device_get_view_pose | ( | const struct xrt_vec3 * | eye_relation, |
| uint32_t | view_index, | ||
| struct xrt_pose * | out_pose | ||
| ) |
Helper function for get_view_pose in an HMD driver.
Takes in a translation from the left to right eye, and returns a center to left or right eye transform that assumes the eye relation is symmetrical around the tracked point ("center eye"). Knowing IPD is a subset of this: If you know IPD better than the overall Monado system, copy eye_relation and put your known IPD in real_eye_relation->x
If you have rotation, apply it after calling this function.
| eye_relation | 3D translation from left eye to right eye. |
| view_index | 0 for left, 1 for right. |
| out_pose | The output pose to populate. Will receive translation, with an identity rotation. |
References xrt_pose::XRT_POSE_IDENTITY.
Referenced by u_device_get_view_poses().
| xrt_result_t u_device_get_view_poses | ( | struct xrt_device * | xdev, |
| const struct xrt_vec3 * | default_eye_relation, | ||
| int64_t | at_timestamp_ns, | ||
| enum xrt_view_type | view_type, | ||
| uint32_t | view_count, | ||
| struct xrt_space_relation * | out_head_relation, | ||
| struct xrt_fov * | out_fovs, | ||
| struct xrt_pose * | out_poses | ||
| ) |
Helper function to implement xrt_device::get_view_poses in a HMD driver.
The field xrt_device::hmd needs to be set and valid.
References ARRAY_SIZE, xrt_hmd_parts::distortion, xrt_hmd_parts::fov, xrt_device::hmd, u_device_get_view_pose(), xrt_hmd_parts::views, xrt_device::xrt_device_get_tracked_pose(), XRT_INPUT_GENERIC_HEAD_POSE, and XRT_SUCCESS.
Referenced by svr_hmd_get_view_poses().
| xrt_result_t u_device_get_visibility_mask | ( | struct xrt_device * | xdev, |
| enum xrt_visibility_mask_type | type, | ||
| uint32_t | view_index, | ||
| struct xrt_visibility_mask ** | out_mask | ||
| ) |
Helper function to implement xrt_device::get_visibility_mask in a HMD driver.
The field xrt_device::hmd needs to be set and valid.
Referenced by u_device_populate_function_pointers().