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