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 bool notify_chirality;
321
322 bool planes;
323 enum xrt_plane_detection_capability_flags_ext plane_capability_flags;
324
325 /*!
326 * The device itself only has 2 views but is aware of quad views, has
327 * better knowledge of which fovs to use for quad views to stereo views
328 * emulation. So it supports retrieving quad views from get_views.
329 */
331};
332
333/*!
334 * @interface xrt_device
335 *
336 * A single HMD or input device.
337 *
338 * @ingroup xrt_iface
339 */
341{
342 //! Instance identifier, see @ref xrt_device_id.
343 struct xrt_device_id id;
344
345 //! Enum identifier of the device.
347 enum xrt_device_type device_type;
348
349 //! A string describing the device.
350 char str[XRT_DEVICE_NAME_LEN];
351
352 //! A unique identifier. Persistent across configurations, if possible.
353 char serial[XRT_DEVICE_NAME_LEN];
354
355 //! Null if this device does not interface with the users head.
357
358 //! Always set, pointing to the tracking system for this device.
360
361 //! Number of bindings in xrt_device::binding_profiles
363 // Array of alternative binding profiles.
364 struct xrt_binding_profile *binding_profiles;
365
366 //! Number of inputs.
368 //! Array of input structs.
370
371 //! Number of outputs.
373 //! Array of output structs.
375
376 //! What features/functions/things does this device supports?
377 struct xrt_device_supported supported;
378
379
380 /*
381 *
382 * Functions.
383 *
384 */
385
386 /*!
387 * Update any attached inputs.
388 *
389 * @param[in] xdev The device.
390 */
391 xrt_result_t (*update_inputs)(struct xrt_device *xdev);
392
393 /*!
394 * @brief Get relationship of a tracked device to the tracking origin
395 * space as the base space.
396 *
397 * It is the responsibility of the device driver to do any prediction,
398 * there are helper functions available for this.
399 *
400 * The timestamps are system monotonic timestamps, such as returned by
401 * os_monotonic_get_ns().
402 *
403 * @param[in] xdev The device.
404 * @param[in] name Some devices may have multiple poses on
405 * them, select the one using this field. For
406 * HMDs use @p XRT_INPUT_GENERIC_HEAD_POSE.
407 * For Unbounded Reference Space you can use
408 * @p XRT_INPUT_GENERIC_UNBOUNDED_SPACE_POSE
409 * to get the origin of that space.
410 * @param[in] at_timestamp_ns If the device can predict or has a history
411 * of positions, this is when the caller
412 * wants the pose to be from.
413 * @param[out] out_relation The relation read from the device.
414 *
415 * @see xrt_input_name
416 */
417 xrt_result_t (*get_tracked_pose)(struct xrt_device *xdev,
418 enum xrt_input_name name,
419 int64_t at_timestamp_ns,
420 struct xrt_space_relation *out_relation);
421
422 /*!
423 * @brief Get relationship of hand joints to the tracking origin space as
424 * the base space.
425 *
426 * It is the responsibility of the device driver to either do prediction
427 * or return joints from a previous time and write that time out to
428 * @p out_timestamp_ns.
429 *
430 * The timestamps are system monotonic timestamps, such as returned by
431 * os_monotonic_get_ns().
432 *
433 * @param[in] xdev The device.
434 * @param[in] name Some devices may have multiple poses on
435 * them, select the one using this field. For
436 * hand tracking use @p XRT_INPUT_GENERIC_HAND_TRACKING_DEFAULT_SET.
437 * @param[in] desired_timestamp_ns If the device can predict or has a history
438 * of positions, this is when the caller
439 * wants the pose to be from.
440 * @param[out] out_value The hand joint data read from the device.
441 * @param[out] out_timestamp_ns The timestamp of the data being returned.
442 *
443 * @see xrt_input_name
444 */
445 xrt_result_t (*get_hand_tracking)(struct xrt_device *xdev,
446 enum xrt_input_name name,
447 int64_t desired_timestamp_ns,
448 struct xrt_hand_joint_set *out_value,
449 int64_t *out_timestamp_ns);
450
451 /*!
452 * @brief Get the requested blend shape properties & weights for a face tracker
453 *
454 * @param[in] xdev The device.
455 * @param[in] facial_expression_type The facial expression data type (XR_FB_face_tracking,
456 * XR_HTC_facial_tracking, etc).
457 * @param[in] at_timestamp_ns Timestamp to be optionally used for prediction/history. For OXR extensions
458 * that do not pass a timestamp, the current timestamp is used.
459 * @param[in] out_value Set of requested expression weights & blend shape properties.
460 *
461 * @see xrt_input_name
462 */
463 xrt_result_t (*get_face_tracking)(struct xrt_device *xdev,
464 enum xrt_input_name facial_expression_type,
465 int64_t at_timestamp_ns,
466 struct xrt_facial_expression_set *out_value);
467
468 /*!
469 * @brief Gets the face tracking calibration state
470 *
471 * @param[in] xdev The device.
472 * @param[in] out_face_is_calibrated Is face tracking calibrated?
473 *
474 * @see xrt_input_name
475 */
476 xrt_result_t (*get_face_calibration_state_android)(struct xrt_device *xdev, bool *out_face_is_calibrated);
477
478 /*!
479 * @brief Get the body skeleton in T-pose, used to query the skeleton hierarchy, scale, proportions etc
480 *
481 * @param[in] xdev The device.
482 * @param[in] body_tracking_type The body joint set type (XR_FB_body_tracking,
483 * XR_META_body_tracking_full_body, etc).
484 * @param[in] out_value The body skeleton hierarchy/properties.
485 *
486 * @see xrt_input_name
487 */
488 xrt_result_t (*get_body_skeleton)(struct xrt_device *xdev,
489 enum xrt_input_name body_tracking_type,
490 struct xrt_body_skeleton *out_value);
491
492 /*!
493 * @brief Get the joint locations for a body tracker
494 *
495 * @param[in] xdev The device.
496 * @param[in] body_tracking_type The body joint set type (XR_FB_body_tracking,
497 * XR_META_body_tracking_full_body, etc).
498 * @param[in] desired_timestamp_ns If the device can predict or has a history
499 * of locations, this is when the caller
500 * @param[in] out_value Set of body joint locations & properties.
501 *
502 * @see xrt_input_name
503 */
504 xrt_result_t (*get_body_joints)(struct xrt_device *xdev,
505 enum xrt_input_name body_tracking_type,
506 int64_t desired_timestamp_ns,
507 struct xrt_body_joint_set *out_value);
508
509 /*!
510 * @brief XR_META_body_tracking_calibration - body tracking extension to reset the body tracking calibration
511 *
512 * @param[in] xdev The body tracking device.
513 */
514 xrt_result_t (*reset_body_tracking_calibration_meta)(struct xrt_device *xdev);
515
516 /*!
517 * @brief XR_META_body_tracking_calibration - body tracking extension to suggest a body tracking calibration
518 * override
519 *
520 * @param[in] xdev The body tracking device.
521 * @param[in] new_body_height The suggested new body height to override.
522 */
523 xrt_result_t (*set_body_tracking_calibration_override_meta)(struct xrt_device *xdev, float new_body_height);
524
525 /*!
526 * @brief XR_META_body_tracking_fidelity - body tracking extension for request changing the tracking fidelity
527 *
528 * @param[in] xdev The body tracking device.
529 * @param[in] new_fidelity The new tracking fidelity mode.
530 *
531 * @see xrt_body_tracking_fidelity_meta
532 */
533 xrt_result_t (*set_body_tracking_fidelity_meta)(struct xrt_device *xdev,
534 enum xrt_body_tracking_fidelity_meta new_fidelity);
535
536 /*!
537 * Set a output value.
538 *
539 * @param[in] xdev The device.
540 * @param[in] name The output component name to set.
541 * @param[in] value The value to set the output to.
542 * @see xrt_output_name
543 */
544 xrt_result_t (*set_output)(struct xrt_device *xdev,
545 enum xrt_output_name name,
546 const struct xrt_output_value *value);
547
548 /*!
549 * Gets limits of this devices outputs.
550 *
551 * @param[in] xdev The device.
552 * @param[out] limits The returned limits.
553 */
554 xrt_result_t (*get_output_limits)(struct xrt_device *xdev, struct xrt_output_limits *limits);
555
556 /*!
557 * Begin a plane detection request
558 *
559 * @param[in] xdev The device.
560 * @param[in] begin_info The query specifying what type of planes are requested.
561 * @param[in] plane_detection_id The id for a previous plane detection request to be replaced or 0.
562 * @param[out] out_plane_detection_id The id of the new plane detection request generated by the xdev.
563 * @return generally XRT_SUCCESS, except for internal runtime failures.
564 */
565 xrt_result_t (*begin_plane_detection_ext)(struct xrt_device *xdev,
566 const struct xrt_plane_detector_begin_info_ext *begin_info,
567 uint64_t plane_detection_id,
568 uint64_t *out_plane_detection_id);
569
570 /*!
571 * Destroy internal resources associated with plane_detector_id.
572 *
573 * @param[in] xdev The device.
574 * @param[in] plane_detection_id An id generated by the xdev.
575 * @return generally XRT_SUCCESS, except for internal runtime failures.
576 */
577 xrt_result_t (*destroy_plane_detection_ext)(struct xrt_device *xdev, uint64_t plane_detection_id);
578
579 /*!
580 * Get the state of a plane detection request.
581 *
582 * @param[in] xdev The device.
583 * @param[in] plane_detector_id An id generated by the xdev.
584 * @param[out] out_state The state of the plane detection.
585 * @return generally XRT_SUCCESS, except for internal runtime failures.
586 */
587 xrt_result_t (*get_plane_detection_state_ext)(struct xrt_device *xdev,
588 uint64_t plane_detection_id,
589 enum xrt_plane_detector_state_ext *out_state);
590
591 /*!
592 * Get results of a plane detection request.
593 *
594 * @param[in] xdev The device.
595 * @param[in] plane_detector_id An id generated by the xdev.
596 * @param[out] detections The detected planes, if any.
597 * @return generally XRT_SUCCESS, except for internal runtime failures.
598 */
599 xrt_result_t (*get_plane_detections_ext)(struct xrt_device *xdev,
600 uint64_t plane_detection_id,
601 struct xrt_plane_detections_ext *out_detections);
602
603 /*!
604 * @brief Get the per-view pose in relation to the view space.
605 *
606 * On most devices with coplanar displays and no built-in eye tracking
607 * or IPD sensing, this just calls a helper to process the provided
608 * eye relation, but this may also handle canted displays as well as
609 * eye tracking.
610 *
611 * Incorporates a call to xrt_device::get_tracked_pose or a wrapper for it
612 *
613 * @param[in] xdev The device.
614 * @param[in] default_eye_relation
615 * The interpupillary relation as a 3D position.
616 * Most simple stereo devices would just want to
617 * set `out_pose->position.[x|y|z] = ipd.[x|y|z]
618 * / 2.0f` and adjust for left vs right view.
619 * Not to be confused with IPD that is absolute
620 * distance, this is a full 3D translation
621 * If a device has a more accurate/dynamic way of
622 * knowing the eye relation, it may ignore this
623 * input.
624 * @param[in] at_timestamp_ns This is when the caller wants the poses and FOVs to be from.
625 * @param[in] view_count Number of views.
626 * @param[in] view_type Type of view configuration (mono or stereo).
627 * @param[out] out_head_relation
628 * The head pose in the device tracking space.
629 * Combine with @p out_poses to get the views in
630 * device tracking space.
631 * @param[out] out_fovs An array (of size @p view_count ) to populate
632 * with the device-suggested fields of view.
633 * @param[out] out_poses An array (of size @p view_count ) to populate
634 * with view output poses in head space. When
635 * implementing, be sure to also set orientation:
636 * most likely identity orientation unless you
637 * have canted screens.
638 * (Caution: Even if you have eye tracking, you
639 * won't use eye orientation here!)
640 */
641 xrt_result_t (*get_view_poses)(struct xrt_device *xdev,
642 const struct xrt_vec3 *default_eye_relation,
643 int64_t at_timestamp_ns,
644 enum xrt_view_type view_type,
645 uint32_t view_count,
646 struct xrt_space_relation *out_head_relation,
647 struct xrt_fov *out_fovs,
648 struct xrt_pose *out_poses);
649
650 /**
651 * Compute the distortion at a single point.
652 *
653 * The input is @p u @p v in screen/output space (that is, predistorted), you are to compute and return the u,v
654 * coordinates to sample the render texture. The compositor will step through a range of u,v parameters to build
655 * the lookup (vertex attribute or distortion texture) used to pre-distort the image as required by the device's
656 * optics.
657 *
658 * @param xdev the device
659 * @param view the view index
660 * @param u horizontal texture coordinate
661 * @param v vertical texture coordinate
662 * @param[out] out_result corresponding u,v pairs for all three color channels.
663 */
664 xrt_result_t (*compute_distortion)(
665 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result);
666
667 /*!
668 * Get the visibility mask for this device.
669 *
670 * @param[in] xdev The device.
671 * @param[in] type The type of visibility mask.
672 * @param[in] view_index The index of the view to get the mask for.
673 * @param[out] out_mask Output mask, caller must free.
674 */
675 xrt_result_t (*get_visibility_mask)(struct xrt_device *xdev,
676 enum xrt_visibility_mask_type type,
677 uint32_t view_index,
678 struct xrt_visibility_mask **out_mask);
679
680 /*!
681 * Called by the @ref xrt_space_overseer when a reference space that is
682 * implemented by this device is first used, or when the last usage of
683 * the reference space stops.
684 *
685 * What is provided is both the @ref xrt_reference_space_type that
686 * triggered the usage change and the @ref xrt_input_name (if any) that
687 * is used to drive the space.
688 *
689 * @see xrt_space_overseer_ref_space_inc
690 * @see xrt_space_overseer_ref_space_dec
691 * @see xrt_input_name
692 * @see xrt_reference_space_type
693 */
694 xrt_result_t (*ref_space_usage)(struct xrt_device *xdev,
695 enum xrt_reference_space_type type,
696 enum xrt_input_name name,
697 bool used);
698
699 /*!
700 * @brief Check if given form factor is available or not.
701 *
702 * This should only be used in HMD device, if the device driver supports form factor check.
703 *
704 * @param[in] xdev The device.
705 * @param[in] form_factor Form factor to check.
706 * @param[out] out_available true if given form factor is available; otherwise false.
707 */
708 xrt_result_t (*is_form_factor_available)(struct xrt_device *xdev,
709 enum xrt_form_factor form_factor,
710 bool *out_available);
711
712 /*!
713 * @brief Get battery status information.
714 *
715 * @param[in] xdev The device.
716 * @param[out] out_present Whether battery status information exist for this device.
717 * @param[out] out_charging Whether the device's battery is being charged.
718 * @param[out] out_charge Battery charge as a value between 0 and 1.
719 */
720 xrt_result_t (*get_battery_status)(struct xrt_device *xdev,
721 bool *out_present,
722 bool *out_charging,
723 float *out_charge);
724
725 /*!
726 * @brief Get the current display brightness.
727 *
728 * @param[in] xdev The device.
729 * @param[out] out_brightness Current display brightness. Usually between 0 and 1. Some devices may
730 * exceed 1 if the supported range exceeds 100%
731 */
732 xrt_result_t (*get_brightness)(struct xrt_device *xdev, float *out_brightness);
733
734 /*!
735 * @brief Set the display brightness.
736 *
737 * @param[in] xdev The device.
738 * @param[in] brightness Desired display brightness. Usually between 0 and 1. Some devices may
739 * allow exceeding 1 if the supported range exceeds 100%, but it will be clamped to
740 * the supported range.
741 * @param[in] relative Whether to add \a brightness to the current brightness, instead of overwriting
742 * the current brightness.
743 */
744 xrt_result_t (*set_brightness)(struct xrt_device *xdev, float brightness, bool relative);
745
746 /*!
747 * @brief Gets the compositor info for a device for the given mode.
748 *
749 * This function should never block, and never wait on congested locks.
750 *
751 * @param[in] xdev The device.
752 * @param[in] mode The mode to query with.
753 * @param[out] out_info Populated with the output data.
754 */
755 xrt_result_t (*get_compositor_info)(struct xrt_device *xdev,
756 const struct xrt_device_compositor_mode *mode,
757 struct xrt_device_compositor_info *out_info);
758
759 /*!
760 * Enable the feature for this device.
761 *
762 * @param[in] xdev The device.
763 * @param[in] type The type of device feature.
764 */
765 xrt_result_t (*begin_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type);
766
767 /*!
768 * Disable the feature for this device.
769 *
770 * @param[in] xdev The device.
771 * @param[in] type The type of device feature.
772 */
773 xrt_result_t (*end_feature)(struct xrt_device *xdev, enum xrt_device_feature_type type);
774
775 /*!
776 * Notify the device of it's new chirality, or that it no longer has a set chirality.
777 *
778 * Devices are assumed to have no set chirality by default.
779 *
780 * @param[in] xdev The device.
781 * @param[in] has_chirality Whether or not the device has a set chirality.
782 * @param[in] chirality The device's current chirality (unset if `has_chirality` is false).
783 */
784 xrt_result_t (*notify_chirality)(struct xrt_device *xdev, bool has_chirality, enum xrt_hand chirality);
785
786 /*!
787 * Destroy device.
788 */
789 void (*destroy)(struct xrt_device *xdev);
790
791 // Add new functions above destroy.
792};
793
794/*!
795 * Helper function for @ref xrt_device::update_inputs.
796 *
797 * @copydoc xrt_device::update_inputs
798 *
799 * @public @memberof xrt_device
800 */
801XRT_NONNULL_ALL static inline xrt_result_t
803{
804 return xdev->update_inputs(xdev);
805}
806
807/*!
808 * Helper function for @ref xrt_device::get_tracked_pose.
809 *
810 * @copydoc xrt_device::get_tracked_pose
811 *
812 * @public @memberof xrt_device
813 */
814XRT_NONNULL_ALL static inline xrt_result_t
816 enum xrt_input_name name,
817 int64_t at_timestamp_ns,
818 struct xrt_space_relation *out_relation)
819{
820 return xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
821}
822
823/*!
824 * Helper function for @ref xrt_device::get_hand_tracking.
825 *
826 * @copydoc xrt_device::get_hand_tracking
827 *
828 * @public @memberof xrt_device
829 */
830XRT_NONNULL_ALL static inline xrt_result_t
832 enum xrt_input_name name,
833 int64_t desired_timestamp_ns,
834 struct xrt_hand_joint_set *out_value,
835 int64_t *out_timestamp_ns)
836{
837 return xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns);
838}
839
840/*!
841 * Helper function for @ref xrt_device::get_face_tracking.
842 *
843 * @copydoc xrt_device::get_face_tracking
844 *
845 * @public @memberof xrt_device
846 */
847XRT_NONNULL_ALL static inline xrt_result_t
849 enum xrt_input_name facial_expression_type,
850 int64_t at_timestamp_ns,
851 struct xrt_facial_expression_set *out_value)
852{
853 return xdev->get_face_tracking(xdev, facial_expression_type, at_timestamp_ns, out_value);
854}
855
856/*!
857 * Helper function for @ref xrt_device::get_face_calibration_state_android.
858 *
859 * @copydoc xrt_device::get_face_calibration_state_android
860 *
861 * @public @memberof xrt_device
862 */
863XRT_NONNULL_ALL static inline xrt_result_t
864xrt_device_get_face_calibration_state_android(struct xrt_device *xdev, bool *out_face_is_calibrated)
865{
866 return xdev->get_face_calibration_state_android(xdev, out_face_is_calibrated);
867}
868
869/*!
870 * Helper function for @ref xrt_device::get_body_skeleton.
871 *
872 * @copydoc xrt_device::get_body_skeleton
873 *
874 * @public @memberof xrt_device
875 */
876XRT_NONNULL_ALL static inline xrt_result_t
878 enum xrt_input_name body_tracking_type,
879 struct xrt_body_skeleton *out_value)
880{
881 return xdev->get_body_skeleton(xdev, body_tracking_type, out_value);
882}
883
884/*!
885 * Helper function for @ref xrt_device::get_body_joints.
886 *
887 * @copydoc xrt_device::get_body_joints
888 *
889 * @public @memberof xrt_device
890 */
891XRT_NONNULL_ALL static inline xrt_result_t
893 enum xrt_input_name body_tracking_type,
894 int64_t desired_timestamp_ns,
895 struct xrt_body_joint_set *out_value)
896{
897 return xdev->get_body_joints(xdev, body_tracking_type, desired_timestamp_ns, out_value);
898}
899
900/*!
901 * Helper function for @ref xrt_device::reset_body_tracking_calibration_meta.
902 *
903 * @copydoc xrt_device::reset_body_tracking_calibration_meta
904 *
905 * @public @memberof xrt_device
906 */
907XRT_NONNULL_ALL static inline xrt_result_t
915
916/*!
917 * Helper function for @ref xrt_device::set_body_tracking_calibration_override_meta.
918 *
919 * @copydoc xrt_device::set_body_tracking_calibration_override_meta
920 *
921 * @public @memberof xrt_device
922 */
923XRT_NONNULL_ALL static inline xrt_result_t
925{
928 }
929 return xdev->set_body_tracking_calibration_override_meta(xdev, new_body_height);
930}
931
932/*!
933 * Helper function for @ref xrt_device::set_body_tracking_fidelity_meta.
934 *
935 * @copydoc xrt_device::set_body_tracking_fidelity_meta
936 *
937 * @public @memberof xrt_device
938 */
939XRT_NONNULL_ALL static inline xrt_result_t
940xrt_device_set_body_tracking_fidelity_meta(struct xrt_device *xdev, enum xrt_body_tracking_fidelity_meta new_fidelity)
941{
942 if (xdev->set_body_tracking_fidelity_meta == NULL) {
944 }
945 return xdev->set_body_tracking_fidelity_meta(xdev, new_fidelity);
946}
947
948/*!
949 * Helper function for @ref xrt_device::set_output.
950 *
951 * @copydoc xrt_device::set_output
952 *
953 * @public @memberof xrt_device
954 */
955XRT_NONNULL_ALL static inline xrt_result_t
956xrt_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
957{
958 xdev->set_output(xdev, name, value);
959 return XRT_SUCCESS;
960}
961
962XRT_NONNULL_ALL static inline xrt_result_t
963xrt_device_get_output_limits(struct xrt_device *xdev, struct xrt_output_limits *limits)
964{
965 if (xdev->get_output_limits) {
966 return xdev->get_output_limits(xdev, limits);
967 } else {
969 }
970}
971
972/*!
973 * Helper function for @ref xrt_device::begin_plane_detection_ext.
974 *
975 * @public @memberof xrt_device
976 */
977XRT_NONNULL_ALL static inline xrt_result_t
979 const struct xrt_plane_detector_begin_info_ext *begin_info,
980 uint64_t plane_detection_id,
981 uint64_t *out_plane_detection_id)
982{
983 return xdev->begin_plane_detection_ext(xdev, begin_info, plane_detection_id, out_plane_detection_id);
984}
985
986/*!
987 * Helper function for @ref xrt_device::destroy_plane_detection_ext.
988 *
989 * @public @memberof xrt_device
990 */
991XRT_NONNULL_ALL static inline xrt_result_t
992xrt_device_destroy_plane_detection_ext(struct xrt_device *xdev, uint64_t plane_detection_id)
993{
994 return xdev->destroy_plane_detection_ext(xdev, plane_detection_id);
995}
996
997/*!
998 * Helper function for @ref xrt_device::get_plane_detections_ext.
999 *
1000 * @public @memberof xrt_device
1001 */
1002XRT_NONNULL_ALL static inline xrt_result_t
1004 uint64_t plane_detection_id,
1005 enum xrt_plane_detector_state_ext *out_state)
1006{
1007 return xdev->get_plane_detection_state_ext(xdev, plane_detection_id, out_state);
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 struct xrt_plane_detections_ext *out_detections)
1019{
1020 return xdev->get_plane_detections_ext(xdev, plane_detection_id, out_detections);
1021}
1022
1023/*!
1024 * Helper function for @ref xrt_device::get_view_poses.
1025 *
1026 * @copydoc xrt_device::get_view_poses
1027 * @public @memberof xrt_device
1028 */
1029XRT_NONNULL_ALL static inline xrt_result_t
1031 const struct xrt_vec3 *default_eye_relation,
1032 int64_t at_timestamp_ns,
1033 enum xrt_view_type view_type,
1034 uint32_t view_count,
1035 struct xrt_space_relation *out_head_relation,
1036 struct xrt_fov *out_fovs,
1037 struct xrt_pose *out_poses)
1038{
1039 return xdev->get_view_poses( //
1040 xdev, //
1041 default_eye_relation, //
1042 at_timestamp_ns, //
1043 view_type, //
1044 view_count, //
1045 out_head_relation, //
1046 out_fovs, //
1047 out_poses); //
1048}
1049
1050/*!
1051 * Helper function for @ref xrt_device::compute_distortion.
1052 *
1053 * @copydoc xrt_device::compute_distortion
1054 *
1055 * @public @memberof xrt_device
1056 */
1057XRT_NONNULL_ALL static inline xrt_result_t
1059 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
1060{
1061 return xdev->compute_distortion(xdev, view, u, v, out_result);
1062}
1063
1064/*!
1065 * Helper function for @ref xrt_device::get_visibility_mask.
1066 *
1067 * @copydoc xrt_device::get_visibility_mask
1068 *
1069 * @public @memberof xrt_device
1070 */
1071XRT_NONNULL_ALL static inline xrt_result_t
1073 enum xrt_visibility_mask_type type,
1074 uint32_t view_index,
1075 struct xrt_visibility_mask **out_mask)
1076{
1077 return xdev->get_visibility_mask(xdev, type, view_index, out_mask);
1078}
1079
1080/*!
1081 * Helper function for @ref xrt_device::ref_space_usage.
1082 *
1083 * @copydoc xrt_device::ref_space_usage
1084 *
1085 * @public @memberof xrt_device
1086 */
1087XRT_NONNULL_ALL static inline xrt_result_t
1089 enum xrt_reference_space_type type,
1090 enum xrt_input_name name,
1091 bool used)
1092{
1093 return xdev->ref_space_usage(xdev, type, name, used);
1094}
1095
1096/*!
1097 * Helper function for @ref xrt_device::is_form_factor_available.
1098 *
1099 * @copydoc xrt_device::is_form_factor_available
1100 *
1101 * @public @memberof xrt_device
1102 */
1103XRT_NONNULL_ALL static inline xrt_result_t
1104xrt_device_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor, bool *out_available)
1105{
1106 return xdev->is_form_factor_available(xdev, form_factor, out_available);
1107}
1108
1109/*!
1110 * Helper function for @ref xrt_device::get_battery_status.
1111 *
1112 * @copydoc xrt_device::get_battery_status
1113 *
1114 * @public @memberof xrt_device
1115 */
1116XRT_NONNULL_ALL static inline xrt_result_t
1117xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
1118{
1119 return xdev->get_battery_status(xdev, out_present, out_charging, out_charge);
1120}
1121
1122/*!
1123 * Helper function for @ref xrt_device::get_brightness.
1124 *
1125 * @copydoc xrt_device::get_brightness
1126 * @public @memberof xrt_device
1127 */
1128XRT_NONNULL_ALL static inline xrt_result_t
1129xrt_device_get_brightness(struct xrt_device *xdev, float *out_brightness)
1130{
1131 return xdev->get_brightness(xdev, out_brightness);
1132}
1133
1134/*!
1135 * Helper function for @ref xrt_device::set_brightness.
1136 *
1137 * @copydoc xrt_device::set_brightness
1138 * @public @memberof xrt_device
1139 */
1140XRT_NONNULL_ALL static inline xrt_result_t
1141xrt_device_set_brightness(struct xrt_device *xdev, float brightness, bool relative)
1142{
1143 return xdev->set_brightness(xdev, brightness, relative);
1144}
1145
1146/*!
1147 * Helper function for @ref xrt_device::get_compositor_info.
1148 *
1149 * @copydoc xrt_device::get_compositor_info
1150 *
1151 * @public @memberof xrt_device
1152 */
1153XRT_NONNULL_ALL static inline xrt_result_t
1155 const struct xrt_device_compositor_mode *mode,
1156 struct xrt_device_compositor_info *out_info)
1157{
1158 return xdev->get_compositor_info(xdev, mode, out_info);
1159}
1160
1161/*!
1162 * Helper function for @ref xrt_device::begin_feature.
1163 *
1164 * @copydoc xrt_device::begin_feature
1165 *
1166 * @public @memberof xrt_device
1167 */
1168XRT_NONNULL_ALL static inline xrt_result_t
1170{
1171 return xdev->begin_feature(xdev, type);
1172}
1173
1174/*!
1175 * Helper function for @ref xrt_device::end_feature.
1176 *
1177 * @copydoc xrt_device::end_feature
1178 *
1179 * @public @memberof xrt_device
1180 */
1181XRT_NONNULL_ALL static inline xrt_result_t
1183{
1184 return xdev->end_feature(xdev, type);
1185}
1186
1187/*!
1188 * Helper function for @ref xrt_device::notify_chirality.
1189 *
1190 * @copydoc xrt_device::notify_chirality
1191 *
1192 * @public @memberof xrt_device
1193 */
1194XRT_NONNULL_ALL static inline xrt_result_t
1195xrt_device_notify_chirality(struct xrt_device *xdev, bool has_chirality, enum xrt_hand chirality)
1196{
1197 return xdev->notify_chirality(xdev, has_chirality, chirality);
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_hand
Enumeration for left and right hand.
Definition xrt_defines.h:1488
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:2478
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:2418
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:940
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:635
xrt_output_name
Name of a output with a baked in type.
Definition xrt_defines.h:1622
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:837
@ 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:2311
Definition xrt_defines.h:2208
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:330
A single HMD or input device.
Definition xrt_device.h:341
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:533
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:1182
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:599
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:488
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:514
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:864
static XRT_NONNULL_ALL xrt_result_t xrt_device_notify_chirality(struct xrt_device *xdev, bool has_chirality, enum xrt_hand chirality)
Helper function for xrt_device::notify_chirality.
Definition xrt_device.h:1195
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:504
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:565
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:694
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:544
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:664
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:1169
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:1072
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:523
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:1016
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:802
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:554
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:1030
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:992
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:445
xrt_result_t(* notify_chirality)(struct xrt_device *xdev, bool has_chirality, enum xrt_hand chirality)
Notify the device of it's new chirality, or that it no longer has a set chirality.
Definition xrt_device.h:784
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:675
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:1141
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition xrt_device.h:356
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:463
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:577
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:924
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:1129
struct xrt_output * outputs
Array of output structs.
Definition xrt_device.h:374
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:765
size_t output_count
Number of outputs.
Definition xrt_device.h:372
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:831
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:848
xrt_result_t(* set_brightness)(struct xrt_device *xdev, float brightness, bool relative)
Set the display brightness.
Definition xrt_device.h:744
struct xrt_input * inputs
Array of input structs.
Definition xrt_device.h:369
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:877
size_t input_count
Number of inputs.
Definition xrt_device.h:367
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:720
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:908
void(* destroy)(struct xrt_device *xdev)
Destroy device.
Definition xrt_device.h:789
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:940
xrt_result_t(* get_brightness)(struct xrt_device *xdev, float *out_brightness)
Get the current display brightness.
Definition xrt_device.h:732
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:755
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:1088
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:587
xrt_result_t(* update_inputs)(struct xrt_device *xdev)
Update any attached inputs.
Definition xrt_device.h:391
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:641
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:1104
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:978
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:476
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:815
struct xrt_tracking_origin * tracking_origin
Always set, pointing to the tracking system for this device.
Definition xrt_device.h:359
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:956
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:773
size_t binding_profile_count
Number of bindings in xrt_device::binding_profiles.
Definition xrt_device.h:362
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:1154
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:1058
enum xrt_device_name name
Enum identifier of the device.
Definition xrt_device.h:346
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:1117
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:1003
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:892
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:417
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:708
Definition xrt_defines.h:1977
Describes a projection matrix fov.
Definition xrt_defines.h:522
Joint set type used for hand tracking.
Definition xrt_defines.h:1531
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:549
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:2396
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:502
A relation with two spaces, includes velocity and acceleration.
Definition xrt_defines.h:693
A tracking system or device origin.
Definition xrt_tracking.h:83
Represents a uv triplet for distortion, basically just three xrt_vec2.
Definition xrt_defines.h:289
A 3 element vector with single floats.
Definition xrt_defines.h:299
A per-lens/display view information.
Definition xrt_device.h:57
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::@252 display
Physical properties of this display (or the part of a display that covers this view).
struct xrt_view::@251 viewport
Viewport position on the screen.
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition xrt_visibility_mask.h:26
A union of all input types.
Definition xrt_defines.h:1547
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:747
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:2427
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.