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 * Begin a plane detection request
557 *
558 * @param[in] xdev The device.
559 * @param[in] begin_info The query specifying what type of planes are requested.
560 * @param[in] plane_detection_id The id for a previous plane detection request to be replaced or 0.
561 * @param[out] out_plane_detection_id The id of the new plane detection request generated by the xdev.
562 * @return generally XRT_SUCCESS, except for internal runtime failures.
563 */
564 xrt_result_t (*begin_plane_detection_ext)(struct xrt_device *xdev,
565 const struct xrt_plane_detector_begin_info_ext *begin_info,
566 uint64_t plane_detection_id,
567 uint64_t *out_plane_detection_id);
568
569 /*!
570 * Destroy internal resources associated with plane_detector_id.
571 *
572 * @param[in] xdev The device.
573 * @param[in] plane_detection_id An id generated by the xdev.
574 * @return generally XRT_SUCCESS, except for internal runtime failures.
575 */
576 xrt_result_t (*destroy_plane_detection_ext)(struct xrt_device *xdev, uint64_t plane_detection_id);
577
578 /*!
579 * Get the state of a plane detection request.
580 *
581 * @param[in] xdev The device.
582 * @param[in] plane_detector_id An id generated by the xdev.
583 * @param[out] out_state The state of the plane detection.
584 * @return generally XRT_SUCCESS, except for internal runtime failures.
585 */
586 xrt_result_t (*get_plane_detection_state_ext)(struct xrt_device *xdev,
587 uint64_t plane_detection_id,
588 enum xrt_plane_detector_state_ext *out_state);
589
590 /*!
591 * Get results of a plane detection request.
592 *
593 * @param[in] xdev The device.
594 * @param[in] plane_detector_id An id generated by the xdev.
595 * @param[out] detections The detected planes, if any.
596 * @return generally XRT_SUCCESS, except for internal runtime failures.
597 */
598 xrt_result_t (*get_plane_detections_ext)(struct xrt_device *xdev,
599 uint64_t plane_detection_id,
600 struct xrt_plane_detections_ext *out_detections);
601
602 /*!
603 * @brief Get the per-view pose in relation to the view space.
604 *
605 * On most devices with coplanar displays and no built-in eye tracking
606 * or IPD sensing, this just calls a helper to process the provided
607 * eye relation, but this may also handle canted displays as well as
608 * eye tracking.
609 *
610 * Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
611 *
612 * @param[in] xdev The device.
613 * @param[in] default_eye_relation
614 * The interpupillary relation as a 3D position.
615 * Most simple stereo devices would just want to
616 * set `out_pose->position.[x|y|z] = ipd.[x|y|z]
617 * / 2.0f` and adjust for left vs right view.
618 * Not to be confused with IPD that is absolute
619 * distance, this is a full 3D translation
620 * If a device has a more accurate/dynamic way of
621 * knowing the eye relation, it may ignore this
622 * input.
623 * @param[in] at_timestamp_ns This is when the caller wants the poses and FOVs to be from.
624 * @param[in] view_count Number of views.
625 * @param[in] view_type Type of view configuration (mono or stereo).
626 * @param[out] out_head_relation
627 * The head pose in the device tracking space.
628 * Combine with @p out_poses to get the views in
629 * device tracking space.
630 * @param[out] out_fovs An array (of size @p view_count ) to populate
631 * with the device-suggested fields of view.
632 * @param[out] out_poses An array (of size @p view_count ) to populate
633 * with view output poses in head space. When
634 * implementing, be sure to also set orientation:
635 * most likely identity orientation unless you
636 * have canted screens.
637 * (Caution: Even if you have eye tracking, you
638 * won't use eye orientation here!)
639 */
640 xrt_result_t (*get_view_poses)(struct xrt_device *xdev,
641 const struct xrt_vec3 *default_eye_relation,
642 int64_t at_timestamp_ns,
643 enum xrt_view_type view_type,
644 uint32_t view_count,
645 struct xrt_space_relation *out_head_relation,
646 struct xrt_fov *out_fovs,
647 struct xrt_pose *out_poses);
648
649 /**
650 * Compute the distortion at a single point.
651 *
652 * The input is @p u @p v in screen/output space (that is, predistorted), you are to compute and return the u,v
653 * coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build
654 * the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's
655 * optics.
656 *
657 * @param xdev the device
658 * @param view the view index
659 * @param u horizontal texture coordinate
660 * @param v vertical texture coordinate
661 * @param[out] out_result corresponding u,v pairs for all three color channels.
662 */
663 xrt_result_t (*compute_distortion)(
664 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result);
665
666 /*!
667 * Get the visibility mask for this device.
668 *
669 * @param[in] xdev The device.
670 * @param[in] type The type of visibility mask.
671 * @param[in] view_index The index of the view to get the mask for.
672 * @param[out] out_mask Output mask, caller must free.
673 */
674 xrt_result_t (*get_visibility_mask)(struct xrt_device *xdev,
675 enum xrt_visibility_mask_type type,
676 uint32_t view_index,
677 struct xrt_visibility_mask **out_mask);
678
679 /*!
680 * Called by the @ref xrt_space_overseer when a reference space that is
681 * implemented by this device is first used, or when the last usage of
682 * the reference space stops.
683 *
684 * What is provided is both the @ref xrt_reference_space_type that
685 * triggered the usage change and the @ref xrt_input_name (if any) that
686 * is used to drive the space.
687 *
688 * @see xrt_space_overseer_ref_space_inc
689 * @see xrt_space_overseer_ref_space_dec
690 * @see xrt_input_name
691 * @see xrt_reference_space_type
692 */
693 xrt_result_t (*ref_space_usage)(struct xrt_device *xdev,
694 enum xrt_reference_space_type type,
695 enum xrt_input_name name,
696 bool used);
697
698 /*!
699 * @brief Check if given form factor is available or not.
700 *
701 * This should only be used in HMD device, if the device driver supports form factor check.
702 *
703 * @param[in] xdev The device.
704 * @param[in] form_factor Form factor to check.
705 * @param[out] out_available true if given form factor is available; otherwise false.
706 */
707 xrt_result_t (*is_form_factor_available)(struct xrt_device *xdev,
708 enum xrt_form_factor form_factor,
709 bool *out_available);
710
711 /*!
712 * @brief Get battery status information.
713 *
714 * @param[in] xdev The device.
715 * @param[out] out_present Whether battery status information exist for this device.
716 * @param[out] out_charging Whether the device's battery is being charged.
717 * @param[out] out_charge Battery charge as a value between 0 and 1.
718 */
719 xrt_result_t (*get_battery_status)(struct xrt_device *xdev,
720 bool *out_present,
721 bool *out_charging,
722 float *out_charge);
723
724 /*!
725 * @brief Get the current display brightness.
726 *
727 * @param[in] xdev The device.
728 * @param[out] out_brightness Current display brightness. Usually between 0 and 1. Some devices may
729 * exceed 1 if the supported range exceeds 100%
730 */
731 xrt_result_t (*get_brightness)(struct xrt_device *xdev, float *out_brightness);
732
733 /*!
734 * @brief Set the display brightness.
735 *
736 * @param[in] xdev The device.
737 * @param[in] brightness Desired display brightness. Usually between 0 and 1. Some devices may
738 * allow exceeding 1 if the supported range exceeds 100%, but it will be clamped to
739 * the supported range.
740 * @param[in] relative Whether to add \a brightness to the current brightness, instead of overwriting
741 * the current brightness.
742 */
743 xrt_result_t (*set_brightness)(struct xrt_device *xdev, float brightness, bool relative);
744
745 /*!
746 * @brief Gets the compositor info for a device for the given mode.
747 *
748 * This function should never block, and never wait on congested locks.
749 *
750 * @param[in] xdev The device.
751 * @param[in] mode The mode to query with.
752 * @param[out] out_info Populated with the output data.
753 */
754 xrt_result_t (*get_compositor_info)(struct xrt_device *xdev,
755 const struct xrt_device_compositor_mode *mode,
756 struct xrt_device_compositor_info *out_info);
757
758 /*!
759 * Enable the feature for this device.
760 *
761 * @param[in] xdev The device.
762 * @param[in] type The type of device feature.
763 */
764 xrt_result_t (*begin_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type);
765
766 /*!
767 * Disable 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 (*end_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type);
773
774 /*!
775 * Destroy device.
776 */
777 void (*destroy)(struct xrt_device *xdev);
778
779 // Add new functions above destroy.
780};
781
782/*!
783 * Helper function for @ref xrt_device::update_inputs.
784 *
785 * @copydoc xrt_device::update_inputs
786 *
787 * @public @memberof xrt_device
788 */
789XRT_NONNULL_ALL static inline xrt_result_t
791{
792 return xdev->update_inputs(xdev);
793}
794
795/*!
796 * Helper function for @ref xrt_device::get_tracked_pose.
797 *
798 * @copydoc xrt_device::get_tracked_pose
799 *
800 * @public @memberof xrt_device
801 */
802XRT_NONNULL_ALL static inline xrt_result_t
804 enum xrt_input_name name,
805 int64_t at_timestamp_ns,
806 struct xrt_space_relation *out_relation)
807{
808 return xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
809}
810
811/*!
812 * Helper function for @ref xrt_device::get_hand_tracking.
813 *
814 * @copydoc xrt_device::get_hand_tracking
815 *
816 * @public @memberof xrt_device
817 */
818XRT_NONNULL_ALL static inline xrt_result_t
820 enum xrt_input_name name,
821 int64_t desired_timestamp_ns,
822 struct xrt_hand_joint_set *out_value,
823 int64_t *out_timestamp_ns)
824{
825 return xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns);
826}
827
828/*!
829 * Helper function for @ref xrt_device::get_face_tracking.
830 *
831 * @copydoc xrt_device::get_face_tracking
832 *
833 * @public @memberof xrt_device
834 */
835XRT_NONNULL_ALL static inline xrt_result_t
837 enum xrt_input_name facial_expression_type,
838 int64_t at_timestamp_ns,
839 struct xrt_facial_expression_set *out_value)
840{
841 return xdev->get_face_tracking(xdev, facial_expression_type, at_timestamp_ns, out_value);
842}
843
844/*!
845 * Helper function for @ref xrt_device::get_face_calibration_state_android.
846 *
847 * @copydoc xrt_device::get_face_calibration_state_android
848 *
849 * @public @memberof xrt_device
850 */
851XRT_NONNULL_ALL static inline xrt_result_t
852xrt_device_get_face_calibration_state_android(struct xrt_device *xdev, bool *out_face_is_calibrated)
853{
854 return xdev->get_face_calibration_state_android(xdev, out_face_is_calibrated);
855}
856
857/*!
858 * Helper function for @ref xrt_device::get_body_skeleton.
859 *
860 * @copydoc xrt_device::get_body_skeleton
861 *
862 * @public @memberof xrt_device
863 */
864XRT_NONNULL_ALL static inline xrt_result_t
866 enum xrt_input_name body_tracking_type,
867 struct xrt_body_skeleton *out_value)
868{
869 return xdev->get_body_skeleton(xdev, body_tracking_type, out_value);
870}
871
872/*!
873 * Helper function for @ref xrt_device::get_body_joints.
874 *
875 * @copydoc xrt_device::get_body_joints
876 *
877 * @public @memberof xrt_device
878 */
879XRT_NONNULL_ALL static inline xrt_result_t
881 enum xrt_input_name body_tracking_type,
882 int64_t desired_timestamp_ns,
883 struct xrt_body_joint_set *out_value)
884{
885 return xdev->get_body_joints(xdev, body_tracking_type, desired_timestamp_ns, out_value);
886}
887
888/*!
889 * Helper function for @ref xrt_device::reset_body_tracking_calibration_meta.
890 *
891 * @copydoc xrt_device::reset_body_tracking_calibration_meta
892 *
893 * @public @memberof xrt_device
894 */
895XRT_NONNULL_ALL static inline xrt_result_t
903
904/*!
905 * Helper function for @ref xrt_device::set_body_tracking_calibration_override_meta.
906 *
907 * @copydoc xrt_device::set_body_tracking_calibration_override_meta
908 *
909 * @public @memberof xrt_device
910 */
911XRT_NONNULL_ALL static inline xrt_result_t
913{
916 }
917 return xdev->set_body_tracking_calibration_override_meta(xdev, new_body_height);
918}
919
920/*!
921 * Helper function for @ref xrt_device::set_body_tracking_fidelity_meta.
922 *
923 * @copydoc xrt_device::set_body_tracking_fidelity_meta
924 *
925 * @public @memberof xrt_device
926 */
927XRT_NONNULL_ALL static inline xrt_result_t
928xrt_device_set_body_tracking_fidelity_meta(struct xrt_device *xdev, enum xrt_body_tracking_fidelity_meta new_fidelity)
929{
930 if (xdev->set_body_tracking_fidelity_meta == NULL) {
932 }
933 return xdev->set_body_tracking_fidelity_meta(xdev, new_fidelity);
934}
935
936/*!
937 * Helper function for @ref xrt_device::set_output.
938 *
939 * @copydoc xrt_device::set_output
940 *
941 * @public @memberof xrt_device
942 */
943XRT_NONNULL_ALL static inline xrt_result_t
944xrt_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
945{
946 xdev->set_output(xdev, name, value);
947 return XRT_SUCCESS;
948}
949
950XRT_NONNULL_ALL static inline xrt_result_t
951xrt_device_get_output_limits(struct xrt_device *xdev, struct xrt_output_limits *limits)
952{
953 if (xdev->get_output_limits) {
954 return xdev->get_output_limits(xdev, limits);
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: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: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:598
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:852
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:564
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:693
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:663
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: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: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:790
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: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: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:674
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: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:576
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:912
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: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:764
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:819
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:836
xrt_result_t(* set_brightness)(struct xrt_device *xdev, float brightness, bool relative)
Set the display brightness.
Definition xrt_device.h:743
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:865
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:719
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:896
void(* destroy)(struct xrt_device *xdev)
Destroy device.
Definition xrt_device.h:777
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:928
xrt_result_t(* get_brightness)(struct xrt_device *xdev, float *out_brightness)
Get the current display brightness.
Definition xrt_device.h:731
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:754
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:586
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:640
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: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:803
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:944
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:772
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: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: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: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:880
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:707
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.