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