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