Monado OpenXR Runtime
Loading...
Searching...
No Matches
ipc_server_objects.h
Go to the documentation of this file.
1// Copyright 2025-2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Tracking objects to IDs.
6 * @author Jakob Bornecrantz <tbornecrantz@nvidia.com>
7 * @ingroup ipc_server
8 */
9
10#pragma once
11
12#include "xrt/xrt_results.h"
13
14struct xrt_space;
15struct xrt_hand_tracker;
16struct ipc_client_state;
17
18
19/*
20 *
21 * Device functions.
22 *
23 */
24
25/*!
26 * Get a device by ID, must only be called from the per client
27 * thread as this function accesses the client state's memory.
28 *
29 * @param ics The client state instance.
30 * @param id The device ID.
31 * @param out_xdev Will be filled with the device object on success.
32 * @return XRT_SUCCESS on success, some other result on failure.
33 *
34 * @ingroup ipc_server
35 */
38 uint32_t id,
39 struct xrt_device **out_xdev);
40
41/*!
42 * Get a device ID for a given device object, must only be called from the per
43 * client thread as this function accesses the client state's memory.
44 *
45 * @param ics The client state instance.
46 * @param xdev The device object.
47 * @param out_id Will be filled with the device ID on success.
48 * @return XRT_SUCCESS on success, some other result on failure.
49 *
50 * @ingroup ipc_server
51 */
53ipc_server_objects_get_xdev_id_or_add(volatile struct ipc_client_state *ics, struct xrt_device *xdev, uint32_t *out_id);
54
55
56/*
57 *
58 * Tracking origin functions.
59 *
60 */
61
62/*!
63 * Get a tracking origin by ID, must only be called from the per client
64 * thread as this function accesses the client state's memory.
65 *
66 * @param ics The client state instance.
67 * @param id The tracking origin ID.
68 * @param out_xtrack Will be filled with the tracking origin object on success.
69 * @return XRT_SUCCESS on success, some other result on failure.
70 *
71 * @ingroup ipc_server
72 */
75 uint32_t id,
76 struct xrt_tracking_origin **out_xtrack);
77
78/*!
79 * Get a tracking origin ID for a given tracking origin object, must only be
80 * called from the per client thread as this function accesses the client
81 * state's memory.
82 *
83 * @param ics The client state instance.
84 * @param xtrack The tracking origin object.
85 * @param out_id Will be filled with the tracking origin ID on success.
86 * @return XRT_SUCCESS on success, some other result on failure.
87 *
88 * @ingroup ipc_server
89 */
92 struct xrt_tracking_origin *xtrack,
93 uint32_t *out_id);
94
95
96/*
97 *
98 * Space functions.
99 *
100 */
101
102/*!
103 * Get a space by ID, must only be called from the per client thread.
104 *
105 * @ingroup ipc_server
106 */
109 uint32_t id,
110 struct xrt_space **out_xspc);
111
112/*!
113 * Track a space and return its ID. Grabs and stores a reference if newly
114 * tracked.
115 *
116 * @ingroup ipc_server
117 */
119ipc_server_objects_get_xspc_id_or_add(volatile struct ipc_client_state *ics, struct xrt_space *xspc, uint32_t *out_id);
120
121/*!
122 * Destroy a tracked space.
123 *
124 * @ingroup ipc_server
125 */
127ipc_server_objects_destroy_xspc(volatile struct ipc_client_state *ics, uint32_t id);
128
129
130/*
131 *
132 * Hand tracker functions.
133 *
134 */
135
136/*!
137 * Get a hand tracker by ID, must only be called from the per client thread.
138 *
139 * @ingroup ipc_server
140 */
143 uint32_t id,
144 struct xrt_hand_tracker **out_xht);
145
146/*!
147 * Track a newly created hand tracker and return its ID. Takes ownership of
148 * @p xht until explicit destroy or client disconnect.
149 *
150 * @ingroup ipc_server
151 */
154 struct xrt_hand_tracker *xht,
155 uint32_t *out_id);
156
157/*!
158 * Destroy a tracked hand tracker.
159 *
160 * @ingroup ipc_server
161 */
163ipc_server_objects_destroy_xht(volatile struct ipc_client_state *ics, uint32_t id);
xrt_result_t ipc_server_objects_destroy_xspc(volatile struct ipc_client_state *ics, uint32_t id)
Destroy a tracked space.
Definition ipc_server_objects.c:204
xrt_result_t ipc_server_objects_get_xspc_and_validate(volatile struct ipc_client_state *ics, uint32_t id, struct xrt_space **out_xspc)
Get a space by ID, must only be called from the per client thread.
Definition ipc_server_objects.c:155
xrt_result_t ipc_server_objects_get_xdev_and_validate(volatile struct ipc_client_state *ics, uint32_t id, struct xrt_device **out_xdev)
Get a device by ID, must only be called from the per client thread as this function accesses the clie...
Definition ipc_server_objects.c:30
xrt_result_t ipc_server_objects_get_xht_and_validate(volatile struct ipc_client_state *ics, uint32_t id, struct xrt_hand_tracker **out_xht)
Get a hand tracker by ID, must only be called from the per client thread.
Definition ipc_server_objects.c:230
xrt_result_t ipc_server_objects_get_xspc_id_or_add(volatile struct ipc_client_state *ics, struct xrt_space *xspc, uint32_t *out_id)
Track a space and return its ID.
Definition ipc_server_objects.c:176
xrt_result_t ipc_server_objects_get_xht_id_or_add(volatile struct ipc_client_state *ics, struct xrt_hand_tracker *xht, uint32_t *out_id)
Track a newly created hand tracker and return its ID.
Definition ipc_server_objects.c:251
xrt_result_t ipc_server_objects_get_xdev_id_or_add(volatile struct ipc_client_state *ics, struct xrt_device *xdev, uint32_t *out_id)
Get a device ID for a given device object, must only be called from the per client thread as this fun...
Definition ipc_server_objects.c:51
xrt_result_t ipc_server_objects_get_xtrack_and_validate(volatile struct ipc_client_state *ics, uint32_t id, struct xrt_tracking_origin **out_xtrack)
Get a tracking origin by ID, must only be called from the per client thread as this function accesses...
Definition ipc_server_objects.c:98
xrt_result_t ipc_server_objects_destroy_xht(volatile struct ipc_client_state *ics, uint32_t id)
Destroy a tracked hand tracker.
Definition ipc_server_objects.c:271
xrt_result_t ipc_server_objects_get_xtrack_id_or_add(volatile struct ipc_client_state *ics, struct xrt_tracking_origin *xtrack, uint32_t *out_id)
Get a tracking origin ID for a given tracking origin object, must only be called from the per client ...
Definition ipc_server_objects.c:119
enum xrt_result xrt_result_t
Result type used across Monado.
Holds the state for a single client.
Definition ipc_server.h:96
A single HMD or input device.
Definition xrt_device.h:311
A hand tracker that owns device/source selection policy.
Definition xrt_hand_tracker.h:76
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition xrt_space.h:32
A tracking system or device origin.
Definition xrt_tracking.h:78
Internal result type for XRT.