Monado OpenXR Runtime
ipc_client_xdev.h
Go to the documentation of this file.
1// Copyright 2020-2023, Collabora, Ltd.
2// Copyright 2025, 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;
25
26/*!
27 * An IPC client proxy for an @ref xrt_device.
28 *
29 * @implements xrt_device
30 * @ingroup ipc_client
31 */
33{
34 struct xrt_device base;
35
36 struct ipc_connection *ipc_c;
37
38 uint32_t device_id;
39};
40
41/*!
42 * Convenience helper to go from a xdev to @ref ipc_client_xdev.
43 *
44 * @ingroup ipc_client
45 */
46static inline struct ipc_client_xdev *
48{
49 return (struct ipc_client_xdev *)xdev;
50}
51
52/*!
53 * Initializes a ipc_client_xdev so that it's basically fully usable as a
54 * @ref xrt_device object. Does not fill in the destroy function or the any
55 * if the HMD components / functions.
56 *
57 * @ingroup ipc_client
58 * @public @memberof ipc_client_xdev
59 */
60void
62 struct ipc_connection *ipc_c,
63 struct xrt_tracking_origin *xtrack,
64 uint32_t device_id,
66
67/*!
68 * Frees any memory that was allocated as part of init and resets some pointers.
69 *
70 * @ingroup ipc_client
71 * @public @memberof ipc_client_xdev
72 */
73void
75
76
77#ifdef __cplusplus
78}
79#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:503
void ipc_client_xdev_init(struct ipc_client_xdev *icx, struct ipc_connection *ipc_c, struct xrt_tracking_origin *xtrack, 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:414
static struct ipc_client_xdev * ipc_client_xdev(struct xrt_device *xdev)
Convenience helper to go from a xdev to ipc_client_xdev.
Definition: ipc_client_xdev.h:47
An IPC client proxy for an xrt_device.
Definition: ipc_client_xdev.h:33
Connection.
Definition: ipc_client.h:61
A single HMD or input device.
Definition: xrt_device.h:309
A tracking system or device origin.
Definition: xrt_tracking.h:75
Misc helpers for device drivers.