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
48/*!
49 * Convenience helper to go from a xdev to @ref ipc_client_xdev.
50 *
51 * @ingroup ipc_client
52 */
53static inline struct ipc_client_xdev *
55{
56 return (struct ipc_client_xdev *)xdev;
57}
58
59/*!
60 * Initializes a ipc_client_xdev so that it's basically fully usable as a
61 * @ref xrt_device object. Does not fill in the destroy function or the any
62 * if the HMD components / functions.
63 *
64 * @ingroup ipc_client
65 * @public @memberof ipc_client_xdev
66 */
69 struct ipc_connection *ipc_c,
71 uint32_t device_id,
73
74/*!
75 * Frees any memory that was allocated as part of init and resets some pointers.
76 *
77 * @ingroup ipc_client
78 * @public @memberof ipc_client_xdev
79 */
80void
82
83
84#ifdef __cplusplus
85}
86#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:591
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:453
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 single HMD or input device.
Definition xrt_device.h:328
Misc helpers for device drivers.