Monado OpenXR Runtime
Loading...
Searching...
No Matches
ipc_client_xdev.h
Go to the documentation of this file.
1// Copyright 2020-2023, Collabora, Ltd.
2// Copyright 2025-2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Shared functions for IPC client @ref xrt_device.
7 * @author Pete Black <pblack@collabora.com>
8 * @author Jakob Bornecrantz <jakob@collabora.com>
9 * @author Jakob Bornecrantz <tbornecrantz@nvidia.com>
10 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
11 * @ingroup ipc_client
12 */
13
14#pragma once
15
16#include "util/u_device.h"
17
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23
24struct ipc_connection;
26
27/*!
28 * An IPC client proxy for an @ref xrt_device.
29 *
30 * @implements xrt_device
31 * @ingroup ipc_client
32 */
34{
35 struct xrt_device base;
36
37 struct ipc_connection *ipc_c;
38
39 /*!
40 * Per-client-connection slot index for looking up this device on the IPC
41 * server. Passed in IPC message calls such as @c device_get_tracked_pose.
42 * This is not the same as @ref xrt_device::id, which is synchronized from
43 * the service via @ref ipc_device_info.
44 */
45 uint32_t device_id;
46
47 struct xrt_binding_input_pair *all_input_pairs;
48 struct xrt_binding_output_pair *all_output_pairs;
49};
50
51/*!
52 * Convenience helper to go from a xdev to @ref ipc_client_xdev.
53 *
54 * @ingroup ipc_client
55 */
56static inline struct ipc_client_xdev *
58{
59 return (struct ipc_client_xdev *)xdev;
60}
61
62/*!
63 * Initializes a ipc_client_xdev so that it's basically fully usable as a
64 * @ref xrt_device object. Does not fill in the destroy function or the any
65 * if the HMD components / functions.
66 *
67 * @ingroup ipc_client
68 * @public @memberof ipc_client_xdev
69 */
72 struct ipc_connection *ipc_c,
74 uint32_t device_id,
76
77/*!
78 * Frees any memory that was allocated as part of init and resets some pointers.
79 *
80 * @ingroup ipc_client
81 * @public @memberof ipc_client_xdev
82 */
83void
85
86
87#ifdef __cplusplus
88}
89#endif
void(* u_device_destroy_function_t)(struct xrt_device *xdev)
Function pointer type for the device's destroy function.
Definition u_device.h:228
void ipc_client_xdev_fini(struct ipc_client_xdev *icx)
Frees any memory that was allocated as part of init and resets some pointers.
Definition ipc_client_xdev.c:675
xrt_result_t ipc_client_xdev_init(struct ipc_client_xdev *icx, struct ipc_connection *ipc_c, struct ipc_client_tracking_origin_manager *itom, uint32_t device_id, u_device_destroy_function_t destroy_fn)
Initializes a ipc_client_xdev so that it's basically fully usable as a xrt_device object.
Definition ipc_client_xdev.c:460
enum xrt_result xrt_result_t
Result type used across Monado.
Tracking origin manager for IPC client.
Definition ipc_client_tracking_origin.h:32
An IPC client proxy for an xrt_device.
Definition ipc_client_xdev.h:34
uint32_t device_id
Per-client-connection slot index for looking up this device on the IPC server.
Definition ipc_client_xdev.h:45
Connection.
Definition ipc_client.h:62
A binding pair, going from a binding point to a device input.
Definition xrt_device.h:239
A binding pair, going from a binding point to a device output.
Definition xrt_device.h:250
A single HMD or input device.
Definition xrt_device.h:340
Misc helpers for device drivers.