Monado OpenXR Runtime
Loading...
Searching...
No Matches
xrt_device.h
Go to the documentation of this file.
1// Copyright 2019-2024, Collabora, Ltd.
2// Copyright 2024-2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Header defining an xrt display or controller device.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Moshi Turner <moshiturner@protonmail.com>
9 * @author Korcan Hussein <korcan.hussein@collabora.com>
10 * @ingroup xrt_iface
11 */
12
13#pragma once
14
15#include "xrt/xrt_defines.h"
18#include "xrt/xrt_limits.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24struct xrt_tracking;
25
26#define XRT_DEVICE_NAME_LEN 256
27
28
29/*!
30 * A per-lens/display view information.
31 *
32 * @ingroup xrt_iface
33 */
35{
36 /*!
37 * @brief Viewport position on the screen.
38 *
39 * In absolute screen coordinates on an unrotated display, like the
40 * HMD presents it to the OS.
41 *
42 * This field is only used by @ref comp to setup the device rendering.
43 *
44 * If the view is being rotated by xrt_view.rot 90° right in the
45 * distortion shader then `display.w_pixels == viewport.h_pixels` and
46 * `display.h_pixels == viewport.w_pixels`.
47 */
48 struct
49 {
50 uint32_t x_pixels;
51 uint32_t y_pixels;
52 uint32_t w_pixels;
53 uint32_t h_pixels;
55
56 /*!
57 * @brief Physical properties of this display (or the part of a display
58 * that covers this view).
59 *
60 * Not in absolute screen coordinates but like the clients see them i.e.
61 * after rotation is applied by xrt_view::rot.
62 * This field is only used for the clients' swapchain setup.
63 *
64 * The xrt_view::display::w_pixels and xrt_view::display::h_pixels
65 * become the recommended image size for this view, after being scaled
66 * by the debug environment variable `XRT_COMPOSITOR_SCALE_PERCENTAGE`.
67 */
68 struct
69 {
70 uint32_t w_pixels;
71 uint32_t h_pixels;
73
74 /*!
75 * @brief Rotation 2d matrix used to rotate the position of the output
76 * of the distortion shaders onto the screen.
77 *
78 * If the distortion shader is based on a mesh, then this matrix rotates
79 * the vertex positions.
80 */
82};
83
84/*!
85 * @brief Compositor information for a device.
86 */
88{
89 //! The direction scanout on the display occurs.
91 /*!
92 * The amount of time it takes to scanout the display in nanoseconds, from the start of the scanout, to the end
93 * of the scanout.
94 *
95 * @note alignas for 32 bit client support, see @ref ipc-design
96 */
97 XRT_ALIGNAS(8) int64_t scanout_time_ns;
98};
99
100/*!
101 * @brief Compositor mode information for a device.
102 */
104{
105 //! The amount of nanoseconds between frames.
107};
108
109/*!
110 * All of the device components that deals with interfacing to a users head.
111 *
112 * HMD is probably a bad name for the future but for now will have to do.
113 *
114 * @ingroup xrt_iface
115 */
117{
118 /*!
119 * @brief The hmd screen as an unrotated display, like the HMD presents
120 * it to the OS.
121 *
122 * This field is used by @ref comp to setup the extended mode window.
123 */
124 struct
125 {
126 int w_pixels;
127 int h_pixels;
128 //! Nominal frame interval
130 } screens[1];
131
132 /*!
133 * Display information.
134 *
135 * For now hardcoded display to two.
136 */
137 struct xrt_view views[XRT_MAX_VIEWS];
138
139 size_t view_count;
140 /*!
141 * Array of supported blend modes.
142 */
143 enum xrt_blend_mode blend_modes[XRT_MAX_DEVICE_BLEND_MODES];
144 size_t blend_mode_count;
145
146 /*!
147 * Distortion information.
148 */
149 struct
150 {
151 //! Supported distortion models, a bitfield.
153 //! Preferred disortion model, single value.
155
156 struct
157 {
158 //! Data.
159 float *vertices;
160 //! Number of vertices.
161 uint32_t vertex_count;
162 //! Stride of vertices
163 uint32_t stride;
164 //! 1 or 3 for (chromatic aberration).
166
167 //! Indices, for triangle strip.
169 //! Number of indices for the triangle strips (one per view).
170 uint32_t index_counts[XRT_MAX_VIEWS];
171 //! Offsets for the indices (one offset per view).
172 uint32_t index_offsets[XRT_MAX_VIEWS];
173 //! Total number of elements in mesh::indices array.
175 } mesh;
176
177 //! distortion is subject to the field of view
178 struct xrt_fov fov[XRT_MAX_VIEWS];
179 } distortion;
180};
181
182/*!
183 * A single named input, that sits on a @ref xrt_device.
184 *
185 * @ingroup xrt_iface
186 */
188{
189 //! Is this input active.
190 bool active;
191
192 //! alignas for 32 bit client support, see @ref ipc-design
193 XRT_ALIGNAS(8) int64_t timestamp;
194
195 enum xrt_input_name name;
196
197 union xrt_input_value value;
198};
199
200/*!
201 * A single named output, that sits on a @ref xrt_device.
202 *
203 * @ingroup xrt_iface
204 */
206{
207 enum xrt_output_name name;
208};
209
210
211/*!
212 * A binding pair, going @p from a binding point to a @p device input.
213 *
214 * @ingroup xrt_iface
215 */
217{
218 enum xrt_input_name from; //!< From which name.
219 enum xrt_input_name device; //!< To input on the device.
220};
221
222/*!
223 * A binding pair, going @p from a binding point to a @p device output.
224 *
225 * @ingroup xrt_iface
226 */
228{
229 enum xrt_output_name from; //!< From which name.
230 enum xrt_output_name device; //!< To output on the device.
231};
232
233/*!
234 * A binding profile, has lists of binding pairs to goes from device in @p name
235 * to the device it hangs off on.
236 *
237 * @ingroup xrt_iface
238 */
240{
241 //! Device this binding emulates.
243
244 struct xrt_binding_input_pair *inputs;
245 size_t input_count;
246 struct xrt_binding_output_pair *outputs;
247 size_t output_count;
248};
249
250/*!
251 * Higher level features for devices.
252 */
254{
255 XRT_DEVICE_FEATURE_HAND_TRACKING_LEFT = 0,
256 XRT_DEVICE_FEATURE_HAND_TRACKING_RIGHT,
257 XRT_DEVICE_FEATURE_EYE_TRACKING,
258 XRT_DEVICE_FEATURE_FACE_TRACKING,
259 XRT_DEVICE_FEATURE_MAX_ENUM,
260};
261
262/*!
263 * Output limits of a particular device
264 */
266{
267 //! The sample rate of the device's haptic PCM support, 0 if haptic PCM is not supported.
269};
270
271/*!
272 * Static data of supported features of the @ref xrt_device this struct sits on.
273 *
274 * This struct needs to always be a piece of data as it sits inside of the
275 * shared memory area in the IPC layer, so no pointers please.
276 *
277 * @ingroup xrt_iface
278 */
280{
281 bool orientation_tracking;
282 bool position_tracking;
283 bool hand_tracking;
284 bool eye_gaze;
285 bool presence;
286 bool force_feedback;
287 bool ref_space_usage;
288 bool form_factor_check;
289 bool stage;
290 bool face_tracking;
291 bool face_tracking_calibration_state;
292 bool body_tracking;
293 bool body_tracking_calibration;
294 bool body_tracking_fidelity;
295 bool battery_status;
296 bool brightness_control;
297 bool compositor_info;
298
299 bool planes;
300 enum xrt_plane_detection_capability_flags_ext plane_capability_flags;
301
302 /*!
303 * The device itself only has 2 views but is aware of quad views, has
304 * better knowledge of which fovs to use for quad views to stereo views
305 * emulation. So it supports retrieving quad views from get_views.
306 */
308};
309
310/*!
311 * @interface xrt_device
312 *
313 * A single HMD or input device.
314 *
315 * @ingroup xrt_iface
316 */
318{
319 //! Enum identifier of the device.
321 enum xrt_device_type device_type;
322
323 //! A string describing the device.
324 char str[XRT_DEVICE_NAME_LEN];
325
326 //! A unique identifier. Persistent across configurations, if possible.
327 char serial[XRT_DEVICE_NAME_LEN];
328
329 //! Null if this device does not interface with the users head.
331
332 //! Always set, pointing to the tracking system for this device.
334
335 //! Number of bindings in xrt_device::binding_profiles
337 // Array of alternative binding profiles.
338 struct xrt_binding_profile *binding_profiles;
339
340 //! Number of inputs.
342 //! Array of input structs.
344
345 //! Number of outputs.
347 //! Array of output structs.
349
350 //! What features/functions/things does this device supports?
351 struct xrt_device_supported supported;
352
353
354 /*
355 *
356 * Functions.
357 *
358 */
359
360 /*!
361 * Update any attached inputs.
362 *
363 * @param[in] xdev The device.
364 */
365 xrt_result_t (*update_inputs)(struct xrt_device *xdev);
366
367 /*!
368 * @brief Get relationship of a tracked device to the tracking origin
369 * space as the base space.
370 *
371 * It is the responsibility of the device driver to do any prediction,
372 * there are helper functions available for this.
373 *
374 * The timestamps are system monotonic timestamps, such as returned by
375 * os_monotonic_get_ns().
376 *
377 * @param[in] xdev The device.
378 * @param[in] name Some devices may have multiple poses on
379 * them, select the one using this field. For
380 * HMDs use @p XRT_INPUT_GENERIC_HEAD_POSE.
381 * For Unbounded Reference Space you can use
382 * @p XRT_INPUT_GENERIC_UNBOUNDED_SPACE_POSE
383 * to get the origin of that space.
384 * @param[in] at_timestamp_ns If the device can predict or has a history
385 * of positions, this is when the caller
386 * wants the pose to be from.
387 * @param[out] out_relation The relation read from the device.
388 *
389 * @see xrt_input_name
390 */
391 xrt_result_t (*get_tracked_pose)(struct xrt_device *xdev,
392 enum xrt_input_name name,
393 int64_t at_timestamp_ns,
394 struct xrt_space_relation *out_relation);
395
396 /*!
397 * @brief Get relationship of hand joints to the tracking origin space as
398 * the base space.
399 *
400 * It is the responsibility of the device driver to either do prediction
401 * or return joints from a previous time and write that time out to
402 * @p out_timestamp_ns.
403 *
404 * The timestamps are system monotonic timestamps, such as returned by
405 * os_monotonic_get_ns().
406 *
407 * @param[in] xdev The device.
408 * @param[in] name Some devices may have multiple poses on
409 * them, select the one using this field. For
410 * hand tracking use @p XRT_INPUT_GENERIC_HAND_TRACKING_DEFAULT_SET.
411 * @param[in] desired_timestamp_ns If the device can predict or has a history
412 * of positions, this is when the caller
413 * wants the pose to be from.
414 * @param[out] out_value The hand joint data read from the device.
415 * @param[out] out_timestamp_ns The timestamp of the data being returned.
416 *
417 * @see xrt_input_name
418 */
419 xrt_result_t (*get_hand_tracking)(struct xrt_device *xdev,
420 enum xrt_input_name name,
421 int64_t desired_timestamp_ns,
422 struct xrt_hand_joint_set *out_value,
423 int64_t *out_timestamp_ns);
424
425 /*!
426 * @brief Get the requested blend shape properties & weights for a face tracker
427 *
428 * @param[in] xdev The device.
429 * @param[in] facial_expression_type The facial expression data type (XR_FB_face_tracking,
430 * XR_HTC_facial_tracking, etc).
431 * @param[in] at_timestamp_ns Timestamp to be optionally used for prediction/history. For OXR extensions
432 * that do not pass a timestamp, the current timestamp is used.
433 * @param[in] out_value Set of requested expression weights & blend shape properties.
434 *
435 * @see xrt_input_name
436 */
437 xrt_result_t (*get_face_tracking)(struct xrt_device *xdev,
438 enum xrt_input_name facial_expression_type,
439 int64_t at_timestamp_ns,
440 struct xrt_facial_expression_set *out_value);
441
442 /*!
443 * @brief Gets the face tracking calibration state
444 *
445 * @param[in] xdev The device.
446 * @param[in] out_face_is_calibrated Is face tracking calibrated?
447 *
448 * @see xrt_input_name
449 */
450 xrt_result_t (*get_face_calibration_state_android)(struct xrt_device *xdev, bool *out_face_is_calibrated);
451
452 /*!
453 * @brief Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc
454 *
455 * @param[in] xdev The device.
456 * @param[in] body_tracking_type The body joint set type (XR_FB_body_tracking,
457 * XR_META_body_tracking_full_body, etc).
458 * @param[in] out_value The body skeleton hierarchy/properties.
459 *
460 * @see xrt_input_name
461 */
462 xrt_result_t (*get_body_skeleton)(struct xrt_device *xdev,
463 enum xrt_input_name body_tracking_type,
464 struct xrt_body_skeleton *out_value);
465
466 /*!
467 * @brief Get the joint locations for a body tracker
468 *
469 * @param[in] xdev The device.
470 * @param[in] body_tracking_type The body joint set type (XR_FB_body_tracking,
471 * XR_META_body_tracking_full_body, etc).
472 * @param[in] desired_timestamp_ns If the device can predict or has a history
473 * of locations, this is when the caller
474 * @param[in] out_value Set of body joint locations & properties.
475 *
476 * @see xrt_input_name
477 */
478 xrt_result_t (*get_body_joints)(struct xrt_device *xdev,
479 enum xrt_input_name body_tracking_type,
480 int64_t desired_timestamp_ns,
481 struct xrt_body_joint_set *out_value);
482
483 /*!
484 * @brief XR_META_body_tracking_calibration - body tracking extension to reset the body tracking calibration
485 *
486 * @param[in] xdev The body tracking device.
487 */
488 xrt_result_t (*reset_body_tracking_calibration_meta)(struct xrt_device *xdev);
489
490 /*!
491 * @brief XR_META_body_tracking_calibration - body tracking extension to suggest a body tracking calibration
492 * override
493 *
494 * @param[in] xdev The body tracking device.
495 * @param[in] new_body_height The suggested new body height to override.
496 */
497 xrt_result_t (*set_body_tracking_calibration_override_meta)(struct xrt_device *xdev, float new_body_height);
498
499 /*!
500 * @brief XR_META_body_tracking_fidelity - body tracking extension for request changing the tracking fidelity
501 *
502 * @param[in] xdev The body tracking device.
503 * @param[in] new_fidelity The new tracking fidelity mode.
504 *
505 * @see xrt_body_tracking_fidelity_meta
506 */
507 xrt_result_t (*set_body_tracking_fidelity_meta)(struct xrt_device *xdev,
508 enum xrt_body_tracking_fidelity_meta new_fidelity);
509
510 /*!
511 * Set a output value.
512 *
513 * @param[in] xdev The device.
514 * @param[in] name The output component name to set.
515 * @param[in] value The value to set the output to.
516 * @see xrt_output_name
517 */
518 xrt_result_t (*set_output)(struct xrt_device *xdev,
519 enum xrt_output_name name,
520 const struct xrt_output_value *value);
521
522 /*!
523 * Gets limits of this devices outputs.
524 *
525 * @param[in] xdev The device.
526 * @param[out] limits The returned limits.
527 */
528 xrt_result_t (*get_output_limits)(struct xrt_device *xdev, struct xrt_output_limits *limits);
529
530 /*!
531 * @brief Get current presence status of the device.
532 *
533 * @param[in] xdev The device.
534 * @param[out] presence The returned presence status.
535 */
536 xrt_result_t (*get_presence)(struct xrt_device *xdev, bool *presence);
537
538 /*!
539 * Begin a plane detection request
540 *
541 * @param[in] xdev The device.
542 * @param[in] begin_info The query specifying what type of planes are requested.
543 * @param[in] plane_detection_id The id for a previous plane detection request to be replaced or 0.
544 * @param[out] out_plane_detection_id The id of the new plane detection request generated by the xdev.
545 * @return generally XRT_SUCCESS, except for internal runtime failures.
546 */
547 xrt_result_t (*begin_plane_detection_ext)(struct xrt_device *xdev,
548 const struct xrt_plane_detector_begin_info_ext *begin_info,
549 uint64_t plane_detection_id,
550 uint64_t *out_plane_detection_id);
551
552 /*!
553 * Destroy internal resources associated with plane_detector_id.
554 *
555 * @param[in] xdev The device.
556 * @param[in] plane_detection_id An id generated by the xdev.
557 * @return generally XRT_SUCCESS, except for internal runtime failures.
558 */
559 xrt_result_t (*destroy_plane_detection_ext)(struct xrt_device *xdev, uint64_t plane_detection_id);
560
561 /*!
562 * Get the state of a plane detection request.
563 *
564 * @param[in] xdev The device.
565 * @param[in] plane_detector_id An id generated by the xdev.
566 * @param[out] out_state The state of the plane detection.
567 * @return generally XRT_SUCCESS, except for internal runtime failures.
568 */
569 xrt_result_t (*get_plane_detection_state_ext)(struct xrt_device *xdev,
570 uint64_t plane_detection_id,
571 enum xrt_plane_detector_state_ext *out_state);
572
573 /*!
574 * Get results of a plane detection request.
575 *
576 * @param[in] xdev The device.
577 * @param[in] plane_detector_id An id generated by the xdev.
578 * @param[out] detections The detected planes, if any.
579 * @return generally XRT_SUCCESS, except for internal runtime failures.
580 */
581 xrt_result_t (*get_plane_detections_ext)(struct xrt_device *xdev,
582 uint64_t plane_detection_id,
583 struct xrt_plane_detections_ext *out_detections);
584
585 /*!
586 * @brief Get the per-view pose in relation to the view space.
587 *
588 * On most devices with coplanar displays and no built-in eye tracking
589 * or IPD sensing, this just calls a helper to process the provided
590 * eye relation, but this may also handle canted displays as well as
591 * eye tracking.
592 *
593 * Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
594 *
595 * @param[in] xdev The device.
596 * @param[in] default_eye_relation
597 * The interpupillary relation as a 3D position.
598 * Most simple stereo devices would just want to
599 * set `out_pose->position.[x|y|z] = ipd.[x|y|z]
600 * / 2.0f` and adjust for left vs right view.
601 * Not to be confused with IPD that is absolute
602 * distance, this is a full 3D translation
603 * If a device has a more accurate/dynamic way of
604 * knowing the eye relation, it may ignore this
605 * input.
606 * @param[in] at_timestamp_ns This is when the caller wants the poses and FOVs to be from.
607 * @param[in] view_count Number of views.
608 * @param[in] view_type Type of view configuration (mono or stereo).
609 * @param[out] out_head_relation
610 * The head pose in the device tracking space.
611 * Combine with @p out_poses to get the views in
612 * device tracking space.
613 * @param[out] out_fovs An array (of size @p view_count ) to populate
614 * with the device-suggested fields of view.
615 * @param[out] out_poses An array (of size @p view_count ) to populate
616 * with view output poses in head space. When
617 * implementing, be sure to also set orientation:
618 * most likely identity orientation unless you
619 * have canted screens.
620 * (Caution: Even if you have eye tracking, you
621 * won't use eye orientation here!)
622 */
623 xrt_result_t (*get_view_poses)(struct xrt_device *xdev,
624 const struct xrt_vec3 *default_eye_relation,
625 int64_t at_timestamp_ns,
626 enum xrt_view_type view_type,
627 uint32_t view_count,
628 struct xrt_space_relation *out_head_relation,
629 struct xrt_fov *out_fovs,
630 struct xrt_pose *out_poses);
631
632 /**
633 * Compute the distortion at a single point.
634 *
635 * The input is @p u @p v in screen/output space (that is, predistorted), you are to compute and return the u,v
636 * coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build
637 * the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's
638 * optics.
639 *
640 * @param xdev the device
641 * @param view the view index
642 * @param u horizontal texture coordinate
643 * @param v vertical texture coordinate
644 * @param[out] out_result corresponding u,v pairs for all three color channels.
645 */
646 xrt_result_t (*compute_distortion)(
647 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result);
648
649 /*!
650 * Get the visibility mask for this device.
651 *
652 * @param[in] xdev The device.
653 * @param[in] type The type of visibility mask.
654 * @param[in] view_index The index of the view to get the mask for.
655 * @param[out] out_mask Output mask, caller must free.
656 */
657 xrt_result_t (*get_visibility_mask)(struct xrt_device *xdev,
658 enum xrt_visibility_mask_type type,
659 uint32_t view_index,
660 struct xrt_visibility_mask **out_mask);
661
662 /*!
663 * Called by the @ref xrt_space_overseer when a reference space that is
664 * implemented by this device is first used, or when the last usage of
665 * the reference space stops.
666 *
667 * What is provided is both the @ref xrt_reference_space_type that
668 * triggered the usage change and the @ref xrt_input_name (if any) that
669 * is used to drive the space.
670 *
671 * @see xrt_space_overseer_ref_space_inc
672 * @see xrt_space_overseer_ref_space_dec
673 * @see xrt_input_name
674 * @see xrt_reference_space_type
675 */
676 xrt_result_t (*ref_space_usage)(struct xrt_device *xdev,
677 enum xrt_reference_space_type type,
678 enum xrt_input_name name,
679 bool used);
680
681 /*!
682 * @brief Check if given form factor is available or not.
683 *
684 * This should only be used in HMD device, if the device driver supports form factor check.
685 *
686 * @param[in] xdev The device.
687 * @param[in] form_factor Form factor to check.
688 * @param[out] out_available true if given form factor is available; otherwise false.
689 */
690 xrt_result_t (*is_form_factor_available)(struct xrt_device *xdev,
691 enum xrt_form_factor form_factor,
692 bool *out_available);
693
694 /*!
695 * @brief Get battery status information.
696 *
697 * @param[in] xdev The device.
698 * @param[out] out_present Whether battery status information exist for this device.
699 * @param[out] out_charging Whether the device's battery is being charged.
700 * @param[out] out_charge Battery charge as a value between 0 and 1.
701 */
702 xrt_result_t (*get_battery_status)(struct xrt_device *xdev,
703 bool *out_present,
704 bool *out_charging,
705 float *out_charge);
706
707 /*!
708 * @brief Get the current display brightness.
709 *
710 * @param[in] xdev The device.
711 * @param[out] out_brightness Current display brightness. Usually between 0 and 1. Some devices may
712 * exceed 1 if the supported range exceeds 100%
713 */
714 xrt_result_t (*get_brightness)(struct xrt_device *xdev, float *out_brightness);
715
716 /*!
717 * @brief Set the display brightness.
718 *
719 * @param[in] xdev The device.
720 * @param[in] brightness Desired display brightness. Usually between 0 and 1. Some devices may
721 * allow exceeding 1 if the supported range exceeds 100%, but it will be clamped to
722 * the supported range.
723 * @param[in] relative Whether to add \a brightness to the current brightness, instead of overwriting
724 * the current brightness.
725 */
726 xrt_result_t (*set_brightness)(struct xrt_device *xdev, float brightness, bool relative);
727
728 /*!
729 * @brief Gets the compositor info for a device for the given mode.
730 *
731 * This function should never block, and never wait on congested locks.
732 *
733 * @param[in] xdev The device.
734 * @param[in] mode The mode to query with.
735 * @param[out] out_info Populated with the output data.
736 */
737 xrt_result_t (*get_compositor_info)(struct xrt_device *xdev,
738 const struct xrt_device_compositor_mode *mode,
739 struct xrt_device_compositor_info *out_info);
740
741 /*!
742 * Enable the feature for this device.
743 *
744 * @param[in] xdev The device.
745 * @param[in] type The type of device feature.
746 */
747 xrt_result_t (*begin_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type);
748
749 /*!
750 * Disable the feature for this device.
751 *
752 * @param[in] xdev The device.
753 * @param[in] type The type of device feature.
754 */
755 xrt_result_t (*end_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type);
756
757 /*!
758 * Destroy device.
759 */
760 void (*destroy)(struct xrt_device *xdev);
761
762 // Add new functions above destroy.
763};
764
765/*!
766 * Helper function for @ref xrt_device::update_inputs.
767 *
768 * @copydoc xrt_device::update_inputs
769 *
770 * @public @memberof xrt_device
771 */
772XRT_NONNULL_ALL static inline xrt_result_t
774{
775 return xdev->update_inputs(xdev);
776}
777
778/*!
779 * Helper function for @ref xrt_device::get_tracked_pose.
780 *
781 * @copydoc xrt_device::get_tracked_pose
782 *
783 * @public @memberof xrt_device
784 */
785XRT_NONNULL_ALL static inline xrt_result_t
787 enum xrt_input_name name,
788 int64_t at_timestamp_ns,
789 struct xrt_space_relation *out_relation)
790{
791 return xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
792}
793
794/*!
795 * Helper function for @ref xrt_device::get_hand_tracking.
796 *
797 * @copydoc xrt_device::get_hand_tracking
798 *
799 * @public @memberof xrt_device
800 */
801XRT_NONNULL_ALL static inline xrt_result_t
803 enum xrt_input_name name,
804 int64_t desired_timestamp_ns,
805 struct xrt_hand_joint_set *out_value,
806 int64_t *out_timestamp_ns)
807{
808 return xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns);
809}
810
811/*!
812 * Helper function for @ref xrt_device::get_face_tracking.
813 *
814 * @copydoc xrt_device::get_face_tracking
815 *
816 * @public @memberof xrt_device
817 */
818XRT_NONNULL_ALL static inline xrt_result_t
820 enum xrt_input_name facial_expression_type,
821 int64_t at_timestamp_ns,
822 struct xrt_facial_expression_set *out_value)
823{
824 return xdev->get_face_tracking(xdev, facial_expression_type, at_timestamp_ns, out_value);
825}
826
827/*!
828 * Helper function for @ref xrt_device::get_face_calibration_state_android.
829 *
830 * @copydoc xrt_device::get_face_calibration_state_android
831 *
832 * @public @memberof xrt_device
833 */
834XRT_NONNULL_ALL static inline xrt_result_t
835xrt_device_get_face_calibration_state_android(struct xrt_device *xdev, bool *out_face_is_calibrated)
836{
837 return xdev->get_face_calibration_state_android(xdev, out_face_is_calibrated);
838}
839
840/*!
841 * Helper function for @ref xrt_device::get_body_skeleton.
842 *
843 * @copydoc xrt_device::get_body_skeleton
844 *
845 * @public @memberof xrt_device
846 */
847XRT_NONNULL_ALL static inline xrt_result_t
849 enum xrt_input_name body_tracking_type,
850 struct xrt_body_skeleton *out_value)
851{
852 return xdev->get_body_skeleton(xdev, body_tracking_type, out_value);
853}
854
855/*!
856 * Helper function for @ref xrt_device::get_body_joints.
857 *
858 * @copydoc xrt_device::get_body_joints
859 *
860 * @public @memberof xrt_device
861 */
862XRT_NONNULL_ALL static inline xrt_result_t
864 enum xrt_input_name body_tracking_type,
865 int64_t desired_timestamp_ns,
866 struct xrt_body_joint_set *out_value)
867{
868 return xdev->get_body_joints(xdev, body_tracking_type, desired_timestamp_ns, out_value);
869}
870
871/*!
872 * Helper function for @ref xrt_device::reset_body_tracking_calibration_meta.
873 *
874 * @copydoc xrt_device::reset_body_tracking_calibration_meta
875 *
876 * @public @memberof xrt_device
877 */
878XRT_NONNULL_ALL static inline xrt_result_t
886
887/*!
888 * Helper function for @ref xrt_device::set_body_tracking_calibration_override_meta.
889 *
890 * @copydoc xrt_device::set_body_tracking_calibration_override_meta
891 *
892 * @public @memberof xrt_device
893 */
894XRT_NONNULL_ALL static inline xrt_result_t
896{
899 }
900 return xdev->set_body_tracking_calibration_override_meta(xdev, new_body_height);
901}
902
903/*!
904 * Helper function for @ref xrt_device::set_body_tracking_fidelity_meta.
905 *
906 * @copydoc xrt_device::set_body_tracking_fidelity_meta
907 *
908 * @public @memberof xrt_device
909 */
910XRT_NONNULL_ALL static inline xrt_result_t
911xrt_device_set_body_tracking_fidelity_meta(struct xrt_device *xdev, enum xrt_body_tracking_fidelity_meta new_fidelity)
912{
913 if (xdev->set_body_tracking_fidelity_meta == NULL) {
915 }
916 return xdev->set_body_tracking_fidelity_meta(xdev, new_fidelity);
917}
918
919/*!
920 * Helper function for @ref xrt_device::set_output.
921 *
922 * @copydoc xrt_device::set_output
923 *
924 * @public @memberof xrt_device
925 */
926XRT_NONNULL_ALL static inline xrt_result_t
927xrt_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
928{
929 xdev->set_output(xdev, name, value);
930 return XRT_SUCCESS;
931}
932
933XRT_NONNULL_ALL static inline xrt_result_t
934xrt_device_get_output_limits(struct xrt_device *xdev, struct xrt_output_limits *limits)
935{
936 if (xdev->get_output_limits) {
937 return xdev->get_output_limits(xdev, limits);
938 } else {
940 }
941}
942
943/*!
944 * Helper function for @ref xrt_device::get_presence.
945 *
946 * @copydoc xrt_device::get_presence
947 *
948 * @public @memberof xrt_device
949 */
950XRT_NONNULL_ALL static inline xrt_result_t
951xrt_device_get_presence(struct xrt_device *xdev, bool *presence)
952{
953 if (xdev->get_presence) {
954 return xdev->get_presence(xdev, presence);
955 } else {
957 }
958}
959
960/*!
961 * Helper function for @ref xrt_device::begin_plane_detection_ext.
962 *
963 * @public @memberof xrt_device
964 */
965XRT_NONNULL_ALL static inline xrt_result_t
967 const struct xrt_plane_detector_begin_info_ext *begin_info,
968 uint64_t plane_detection_id,
969 uint64_t *out_plane_detection_id)
970{
971 return xdev->begin_plane_detection_ext(xdev, begin_info, plane_detection_id, out_plane_detection_id);
972}
973
974/*!
975 * Helper function for @ref xrt_device::destroy_plane_detection_ext.
976 *
977 * @public @memberof xrt_device
978 */
979XRT_NONNULL_ALL static inline xrt_result_t
980xrt_device_destroy_plane_detection_ext(struct xrt_device *xdev, uint64_t plane_detection_id)
981{
982 return xdev->destroy_plane_detection_ext(xdev, plane_detection_id);
983}
984
985/*!
986 * Helper function for @ref xrt_device::get_plane_detections_ext.
987 *
988 * @public @memberof xrt_device
989 */
990XRT_NONNULL_ALL static inline xrt_result_t
992 uint64_t plane_detection_id,
993 enum xrt_plane_detector_state_ext *out_state)
994{
995 return xdev->get_plane_detection_state_ext(xdev, plane_detection_id, out_state);
996}
997
998/*!
999 * Helper function for @ref xrt_device::get_plane_detections_ext.
1000 *
1001 * @public @memberof xrt_device
1002 */
1003XRT_NONNULL_ALL static inline xrt_result_t
1005 uint64_t plane_detection_id,
1006 struct xrt_plane_detections_ext *out_detections)
1007{
1008 return xdev->get_plane_detections_ext(xdev, plane_detection_id, out_detections);
1009}
1010
1011/*!
1012 * Helper function for @ref xrt_device::get_view_poses.
1013 *
1014 * @copydoc xrt_device::get_view_poses
1015 * @public @memberof xrt_device
1016 */
1017XRT_NONNULL_ALL static inline xrt_result_t
1019 const struct xrt_vec3 *default_eye_relation,
1020 int64_t at_timestamp_ns,
1021 enum xrt_view_type view_type,
1022 uint32_t view_count,
1023 struct xrt_space_relation *out_head_relation,
1024 struct xrt_fov *out_fovs,
1025 struct xrt_pose *out_poses)
1026{
1027 return xdev->get_view_poses( //
1028 xdev, //
1029 default_eye_relation, //
1030 at_timestamp_ns, //
1031 view_type, //
1032 view_count, //
1033 out_head_relation, //
1034 out_fovs, //
1035 out_poses); //
1036}
1037
1038/*!
1039 * Helper function for @ref xrt_device::compute_distortion.
1040 *
1041 * @copydoc xrt_device::compute_distortion
1042 *
1043 * @public @memberof xrt_device
1044 */
1045XRT_NONNULL_ALL static inline xrt_result_t
1047 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
1048{
1049 return xdev->compute_distortion(xdev, view, u, v, out_result);
1050}
1051
1052/*!
1053 * Helper function for @ref xrt_device::get_visibility_mask.
1054 *
1055 * @copydoc xrt_device::get_visibility_mask
1056 *
1057 * @public @memberof xrt_device
1058 */
1059XRT_NONNULL_ALL static inline xrt_result_t
1061 enum xrt_visibility_mask_type type,
1062 uint32_t view_index,
1063 struct xrt_visibility_mask **out_mask)
1064{
1065 return xdev->get_visibility_mask(xdev, type, view_index, out_mask);
1066}
1067
1068/*!
1069 * Helper function for @ref xrt_device::ref_space_usage.
1070 *
1071 * @copydoc xrt_device::ref_space_usage
1072 *
1073 * @public @memberof xrt_device
1074 */
1075XRT_NONNULL_ALL static inline xrt_result_t
1077 enum xrt_reference_space_type type,
1078 enum xrt_input_name name,
1079 bool used)
1080{
1081 return xdev->ref_space_usage(xdev, type, name, used);
1082}
1083
1084/*!
1085 * Helper function for @ref xrt_device::is_form_factor_available.
1086 *
1087 * @copydoc xrt_device::is_form_factor_available
1088 *
1089 * @public @memberof xrt_device
1090 */
1091XRT_NONNULL_ALL static inline xrt_result_t
1092xrt_device_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor, bool *out_available)
1093{
1094 return xdev->is_form_factor_available(xdev, form_factor, out_available);
1095}
1096
1097/*!
1098 * Helper function for @ref xrt_device::get_battery_status.
1099 *
1100 * @copydoc xrt_device::get_battery_status
1101 *
1102 * @public @memberof xrt_device
1103 */
1104XRT_NONNULL_ALL static inline xrt_result_t
1105xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
1106{
1107 return xdev->get_battery_status(xdev, out_present, out_charging, out_charge);
1108}
1109
1110/*!
1111 * Helper function for @ref xrt_device::get_brightness.
1112 *
1113 * @copydoc xrt_device::get_brightness
1114 * @public @memberof xrt_device
1115 */
1116XRT_NONNULL_ALL static inline xrt_result_t
1117xrt_device_get_brightness(struct xrt_device *xdev, float *out_brightness)
1118{
1119 return xdev->get_brightness(xdev, out_brightness);
1120}
1121
1122/*!
1123 * Helper function for @ref xrt_device::set_brightness.
1124 *
1125 * @copydoc xrt_device::set_brightness
1126 * @public @memberof xrt_device
1127 */
1128XRT_NONNULL_ALL static inline xrt_result_t
1129xrt_device_set_brightness(struct xrt_device *xdev, float brightness, bool relative)
1130{
1131 return xdev->set_brightness(xdev, brightness, relative);
1132}
1133
1134/*!
1135 * Helper function for @ref xrt_device::get_compositor_info.
1136 *
1137 * @copydoc xrt_device::get_compositor_info
1138 *
1139 * @public @memberof xrt_device
1140 */
1141XRT_NONNULL_ALL static inline xrt_result_t
1143 const struct xrt_device_compositor_mode *mode,
1144 struct xrt_device_compositor_info *out_info)
1145{
1146 return xdev->get_compositor_info(xdev, mode, out_info);
1147}
1148
1149/*!
1150 * Helper function for @ref xrt_device::begin_feature.
1151 *
1152 * @copydoc xrt_device::begin_feature
1153 *
1154 * @public @memberof xrt_device
1155 */
1156XRT_NONNULL_ALL static inline xrt_result_t
1158{
1159 return xdev->begin_feature(xdev, type);
1160}
1161
1162/*!
1163 * Helper function for @ref xrt_device::end_feature.
1164 *
1165 * @copydoc xrt_device::end_feature
1166 *
1167 * @public @memberof xrt_device
1168 */
1169XRT_NONNULL_ALL static inline xrt_result_t
1171{
1172 return xdev->end_feature(xdev, type);
1173}
1174
1175/*!
1176 * Helper function for @ref xrt_device::destroy.
1177 *
1178 * Handles nulls, sets your pointer to null.
1179 *
1180 * @public @memberof xrt_device
1181 */
1182XRT_NONNULL_ALL static inline void
1184{
1185 struct xrt_device *xdev = *xdev_ptr;
1186 if (xdev == NULL) {
1187 return;
1188 }
1189
1190 xdev->destroy(xdev);
1191 *xdev_ptr = NULL;
1192}
1193
1194
1195#ifdef __cplusplus
1196} // extern "C"
1197#endif
xrt_plane_detection_capability_flags_ext
Caps for a plane detector, see xrt_device.
Definition xrt_plane_detector.h:30
xrt_visibility_mask_type
Visibility mask, mirror of XrVisibilityMaskKHR.
Definition xrt_defines.h:2468
xrt_blend_mode
Blend mode that the device supports, exact mirror of XrEnvironmentBlendMode.
Definition xrt_defines.h:112
xrt_form_factor
What form factor is this device, mostly maps onto OpenXR's XrFormFactor.
Definition xrt_defines.h:2408
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:930
enum xrt_result xrt_result_t
Result type used across Monado.
xrt_reference_space_type
Type of a OpenXR mapped reference space, maps to the semantic spaces on the xrt_space_overseer struct...
Definition xrt_defines.h:625
xrt_output_name
Name of a output with a baked in type.
Definition xrt_defines.h:1612
xrt_plane_detector_state_ext
State of a plane detector, see xrt_device.
Definition xrt_plane_detector.h:83
xrt_device_type
How an xrt_device can be used.
Definition xrt_defines.h:827
@ XRT_SUCCESS
The operation succeeded.
Definition xrt_results.h:27
@ XRT_ERROR_NOT_IMPLEMENTED
The interface function called is not implemented by its interface.
Definition xrt_results.h:192
A binding pair, going from a binding point to a device input.
Definition xrt_device.h:217
enum xrt_input_name device
To input on the device.
Definition xrt_device.h:219
enum xrt_input_name from
From which name.
Definition xrt_device.h:218
A binding pair, going from a binding point to a device output.
Definition xrt_device.h:228
enum xrt_output_name device
To output on the device.
Definition xrt_device.h:230
enum xrt_output_name from
From which name.
Definition xrt_device.h:229
A binding profile, has lists of binding pairs to goes from device in name to the device it hangs off ...
Definition xrt_device.h:240
enum xrt_device_name name
Device this binding emulates.
Definition xrt_device.h:242
Definition xrt_defines.h:2301
Definition xrt_defines.h:2198
Compositor information for a device.
Definition xrt_device.h:88
XRT_ALIGNAS(8) int64_t scanout_time_ns
The amount of time it takes to scanout the display in nanoseconds, from the start of the scanout,...
enum xrt_scanout_direction scanout_direction
The direction scanout on the display occurs.
Definition xrt_device.h:90
Compositor mode information for a device.
Definition xrt_device.h:104
int64_t frame_interval_ns
The amount of nanoseconds between frames.
Definition xrt_device.h:106
Static data of supported features of the xrt_device this struct sits on.
Definition xrt_device.h:280
bool get_views_quad
The device itself only has 2 views but is aware of quad views, has better knowledge of which fovs to ...
Definition xrt_device.h:307
A single HMD or input device.
Definition xrt_device.h:318
xrt_result_t(* set_body_tracking_fidelity_meta)(struct xrt_device *xdev, enum xrt_body_tracking_fidelity_meta new_fidelity)
XR_META_body_tracking_fidelity - body tracking extension for request changing the tracking fidelity.
Definition xrt_device.h:507
static XRT_NONNULL_ALL xrt_result_t xrt_device_end_feature(struct xrt_device *xdev, enum xrt_device_feature_type type)
Helper function for xrt_device::end_feature.
Definition xrt_device.h:1170
xrt_result_t(* get_plane_detections_ext)(struct xrt_device *xdev, uint64_t plane_detection_id, struct xrt_plane_detections_ext *out_detections)
Get results of a plane detection request.
Definition xrt_device.h:581
xrt_result_t(* get_body_skeleton)(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, struct xrt_body_skeleton *out_value)
Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc.
Definition xrt_device.h:462
xrt_result_t(* reset_body_tracking_calibration_meta)(struct xrt_device *xdev)
XR_META_body_tracking_calibration - body tracking extension to reset the body tracking calibration.
Definition xrt_device.h:488
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_face_calibration_state_android(struct xrt_device *xdev, bool *out_face_is_calibrated)
Helper function for xrt_device::get_face_calibration_state_android.
Definition xrt_device.h:835
xrt_result_t(* get_body_joints)(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, int64_t desired_timestamp_ns, struct xrt_body_joint_set *out_value)
Get the joint locations for a body tracker.
Definition xrt_device.h:478
xrt_result_t(* begin_plane_detection_ext)(struct xrt_device *xdev, const struct xrt_plane_detector_begin_info_ext *begin_info, uint64_t plane_detection_id, uint64_t *out_plane_detection_id)
Begin a plane detection request.
Definition xrt_device.h:547
xrt_result_t(* ref_space_usage)(struct xrt_device *xdev, enum xrt_reference_space_type type, enum xrt_input_name name, bool used)
Called by the xrt_space_overseer when a reference space that is implemented by this device is first u...
Definition xrt_device.h:676
xrt_result_t(* get_presence)(struct xrt_device *xdev, bool *presence)
Get current presence status of the device.
Definition xrt_device.h:536
xrt_result_t(* set_output)(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
Set a output value.
Definition xrt_device.h:518
xrt_result_t(* compute_distortion)(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
Compute the distortion at a single point.
Definition xrt_device.h:646
static XRT_NONNULL_ALL xrt_result_t xrt_device_begin_feature(struct xrt_device *xdev, enum xrt_device_feature_type type)
Helper function for xrt_device::begin_feature.
Definition xrt_device.h:1157
static XRT_NONNULL_ALL xrt_result_t xrt_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 for xrt_device::get_visibility_mask.
Definition xrt_device.h:1060
xrt_result_t(* set_body_tracking_calibration_override_meta)(struct xrt_device *xdev, float new_body_height)
XR_META_body_tracking_calibration - body tracking extension to suggest a body tracking calibration ov...
Definition xrt_device.h:497
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_plane_detections_ext(struct xrt_device *xdev, uint64_t plane_detection_id, struct xrt_plane_detections_ext *out_detections)
Helper function for xrt_device::get_plane_detections_ext.
Definition xrt_device.h:1004
static XRT_NONNULL_ALL xrt_result_t xrt_device_update_inputs(struct xrt_device *xdev)
Helper function for xrt_device::update_inputs.
Definition xrt_device.h:773
xrt_result_t(* get_output_limits)(struct xrt_device *xdev, struct xrt_output_limits *limits)
Gets limits of this devices outputs.
Definition xrt_device.h:528
static XRT_NONNULL_ALL xrt_result_t xrt_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 for xrt_device::get_view_poses.
Definition xrt_device.h:1018
static XRT_NONNULL_ALL xrt_result_t xrt_device_destroy_plane_detection_ext(struct xrt_device *xdev, uint64_t plane_detection_id)
Helper function for xrt_device::destroy_plane_detection_ext.
Definition xrt_device.h:980
xrt_result_t(* get_hand_tracking)(struct xrt_device *xdev, enum xrt_input_name name, int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, int64_t *out_timestamp_ns)
Get relationship of hand joints to the tracking origin space as the base space.
Definition xrt_device.h:419
xrt_result_t(* get_visibility_mask)(struct xrt_device *xdev, enum xrt_visibility_mask_type type, uint32_t view_index, struct xrt_visibility_mask **out_mask)
Get the visibility mask for this device.
Definition xrt_device.h:657
static XRT_NONNULL_ALL xrt_result_t xrt_device_set_brightness(struct xrt_device *xdev, float brightness, bool relative)
Helper function for xrt_device::set_brightness.
Definition xrt_device.h:1129
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition xrt_device.h:330
xrt_result_t(* get_face_tracking)(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set *out_value)
Get the requested blend shape properties & weights for a face tracker.
Definition xrt_device.h:437
xrt_result_t(* destroy_plane_detection_ext)(struct xrt_device *xdev, uint64_t plane_detection_id)
Destroy internal resources associated with plane_detector_id.
Definition xrt_device.h:559
static XRT_NONNULL_ALL xrt_result_t xrt_device_set_body_tracking_calibration_override_meta(struct xrt_device *xdev, float new_body_height)
Helper function for xrt_device::set_body_tracking_calibration_override_meta.
Definition xrt_device.h:895
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_brightness(struct xrt_device *xdev, float *out_brightness)
Helper function for xrt_device::get_brightness.
Definition xrt_device.h:1117
struct xrt_output * outputs
Array of output structs.
Definition xrt_device.h:348
xrt_result_t(* begin_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type)
Enable the feature for this device.
Definition xrt_device.h:747
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_presence(struct xrt_device *xdev, bool *presence)
Helper function for xrt_device::get_presence.
Definition xrt_device.h:951
size_t output_count
Number of outputs.
Definition xrt_device.h:346
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, int64_t desired_timestamp_ns, struct xrt_hand_joint_set *out_value, int64_t *out_timestamp_ns)
Helper function for xrt_device::get_hand_tracking.
Definition xrt_device.h:802
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_face_tracking(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set *out_value)
Helper function for xrt_device::get_face_tracking.
Definition xrt_device.h:819
xrt_result_t(* set_brightness)(struct xrt_device *xdev, float brightness, bool relative)
Set the display brightness.
Definition xrt_device.h:726
struct xrt_input * inputs
Array of input structs.
Definition xrt_device.h:343
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_body_skeleton(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, struct xrt_body_skeleton *out_value)
Helper function for xrt_device::get_body_skeleton.
Definition xrt_device.h:848
size_t input_count
Number of inputs.
Definition xrt_device.h:341
xrt_result_t(* get_battery_status)(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
Get battery status information.
Definition xrt_device.h:702
static XRT_NONNULL_ALL xrt_result_t xrt_device_reset_body_tracking_calibration_meta(struct xrt_device *xdev)
Helper function for xrt_device::reset_body_tracking_calibration_meta.
Definition xrt_device.h:879
void(* destroy)(struct xrt_device *xdev)
Destroy device.
Definition xrt_device.h:760
static XRT_NONNULL_ALL xrt_result_t xrt_device_set_body_tracking_fidelity_meta(struct xrt_device *xdev, enum xrt_body_tracking_fidelity_meta new_fidelity)
Helper function for xrt_device::set_body_tracking_fidelity_meta.
Definition xrt_device.h:911
xrt_result_t(* get_brightness)(struct xrt_device *xdev, float *out_brightness)
Get the current display brightness.
Definition xrt_device.h:714
xrt_result_t(* get_compositor_info)(struct xrt_device *xdev, const struct xrt_device_compositor_mode *mode, struct xrt_device_compositor_info *out_info)
Gets the compositor info for a device for the given mode.
Definition xrt_device.h:737
static XRT_NONNULL_ALL xrt_result_t xrt_device_ref_space_usage(struct xrt_device *xdev, enum xrt_reference_space_type type, enum xrt_input_name name, bool used)
Helper function for xrt_device::ref_space_usage.
Definition xrt_device.h:1076
xrt_result_t(* get_plane_detection_state_ext)(struct xrt_device *xdev, uint64_t plane_detection_id, enum xrt_plane_detector_state_ext *out_state)
Get the state of a plane detection request.
Definition xrt_device.h:569
xrt_result_t(* update_inputs)(struct xrt_device *xdev)
Update any attached inputs.
Definition xrt_device.h:365
xrt_result_t(* 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)
Get the per-view pose in relation to the view space.
Definition xrt_device.h:623
static XRT_NONNULL_ALL xrt_result_t xrt_device_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor, bool *out_available)
Helper function for xrt_device::is_form_factor_available.
Definition xrt_device.h:1092
static XRT_NONNULL_ALL xrt_result_t xrt_device_begin_plane_detection_ext(struct xrt_device *xdev, const struct xrt_plane_detector_begin_info_ext *begin_info, uint64_t plane_detection_id, uint64_t *out_plane_detection_id)
Helper function for xrt_device::begin_plane_detection_ext.
Definition xrt_device.h:966
xrt_result_t(* get_face_calibration_state_android)(struct xrt_device *xdev, bool *out_face_is_calibrated)
Gets the face tracking calibration state.
Definition xrt_device.h:450
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_tracked_pose(struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Helper function for xrt_device::get_tracked_pose.
Definition xrt_device.h:786
struct xrt_tracking_origin * tracking_origin
Always set, pointing to the tracking system for this device.
Definition xrt_device.h:333
static XRT_NONNULL_ALL xrt_result_t xrt_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
Helper function for xrt_device::set_output.
Definition xrt_device.h:927
xrt_result_t(* end_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type)
Disable the feature for this device.
Definition xrt_device.h:755
size_t binding_profile_count
Number of bindings in xrt_device::binding_profiles.
Definition xrt_device.h:336
static XRT_NONNULL_ALL void xrt_device_destroy(struct xrt_device **xdev_ptr)
Helper function for xrt_device::destroy.
Definition xrt_device.h:1183
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_compositor_info(struct xrt_device *xdev, const struct xrt_device_compositor_mode *mode, struct xrt_device_compositor_info *out_info)
Helper function for xrt_device::get_compositor_info.
Definition xrt_device.h:1142
static XRT_NONNULL_ALL xrt_result_t xrt_device_compute_distortion(struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
Helper function for xrt_device::compute_distortion.
Definition xrt_device.h:1046
enum xrt_device_name name
Enum identifier of the device.
Definition xrt_device.h:320
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
Helper function for xrt_device::get_battery_status.
Definition xrt_device.h:1105
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_plane_detection_state_ext(struct xrt_device *xdev, uint64_t plane_detection_id, enum xrt_plane_detector_state_ext *out_state)
Helper function for xrt_device::get_plane_detections_ext.
Definition xrt_device.h:991
static XRT_NONNULL_ALL xrt_result_t xrt_device_get_body_joints(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, int64_t desired_timestamp_ns, struct xrt_body_joint_set *out_value)
Helper function for xrt_device::get_body_joints.
Definition xrt_device.h:863
xrt_result_t(* get_tracked_pose)(struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Get relationship of a tracked device to the tracking origin space as the base space.
Definition xrt_device.h:391
xrt_result_t(* is_form_factor_available)(struct xrt_device *xdev, enum xrt_form_factor form_factor, bool *out_available)
Check if given form factor is available or not.
Definition xrt_device.h:690
Definition xrt_defines.h:1967
Describes a projection matrix fov.
Definition xrt_defines.h:512
Joint set type used for hand tracking.
Definition xrt_defines.h:1521
All of the device components that deals with interfacing to a users head.
Definition xrt_device.h:117
float * vertices
Data.
Definition xrt_device.h:159
uint32_t vertex_count
Number of vertices.
Definition xrt_device.h:161
uint64_t nominal_frame_interval_ns
Nominal frame interval.
Definition xrt_device.h:129
uint32_t stride
Stride of vertices.
Definition xrt_device.h:163
int * indices
Indices, for triangle strip.
Definition xrt_device.h:168
enum xrt_distortion_model models
Supported distortion models, a bitfield.
Definition xrt_device.h:152
uint32_t index_count_total
Total number of elements in mesh::indices array.
Definition xrt_device.h:174
uint32_t uv_channels_count
1 or 3 for (chromatic aberration).
Definition xrt_device.h:165
enum xrt_distortion_model preferred
Preferred disortion model, single value.
Definition xrt_device.h:154
A single named input, that sits on a xrt_device.
Definition xrt_device.h:188
XRT_ALIGNAS(8) int64_t timestamp
alignas for 32 bit client support, see IPC Design and Implementation
bool active
Is this input active.
Definition xrt_device.h:190
A tightly packed 2x2 matrix of floats.
Definition xrt_defines.h:539
Output limits of a particular device.
Definition xrt_device.h:266
float haptic_pcm_sample_rate
The sample rate of the device's haptic PCM support, 0 if haptic PCM is not supported.
Definition xrt_device.h:268
A union of all output types.
Definition xrt_defines.h:2386
A single named output, that sits on a xrt_device.
Definition xrt_device.h:206
Each plane has n polygons; ultimately plane metadata from xrt_plane_detections_ext::locations and xrt...
Definition xrt_plane_detector.h:172
A query for a plane.
Definition xrt_plane_detector.h:97
A pose composed of a position and orientation.
Definition xrt_defines.h:492
A relation with two spaces, includes velocity and acceleration.
Definition xrt_defines.h:683
A tracking system or device origin.
Definition xrt_tracking.h:78
Represents a uv triplet for distortion, basically just three xrt_vec2.
Definition xrt_defines.h:279
A 3 element vector with single floats.
Definition xrt_defines.h:289
A per-lens/display view information.
Definition xrt_device.h:35
struct xrt_matrix_2x2 rot
Rotation 2d matrix used to rotate the position of the output of the distortion shaders onto the scree...
Definition xrt_device.h:81
struct xrt_view::@252 display
Physical properties of this display (or the part of a display that covers this view).
struct xrt_view::@251 viewport
Viewport position on the screen.
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition xrt_visibility_mask.h:26
A union of all input types.
Definition xrt_defines.h:1537
Common defines and enums for XRT.
xrt_distortion_model
Which distortion model does the device expose, used both as a bitfield and value.
Definition xrt_defines.h:167
xrt_device_name
A enum that is used to name devices so that the state trackers can reason about the devices easier.
Definition xrt_defines.h:737
xrt_scanout_direction
Screen scanout direction.
Definition xrt_defines.h:179
xrt_view_type
View type to be rendered to by the compositor.
Definition xrt_defines.h:2417
xrt_device_feature_type
Higher level features for devices.
Definition xrt_device.h:254
Header for limits of the XRT interfaces.
Header defining planes detector enum and structs.
Header defining visibility mask helper struct.