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