Monado OpenXR Runtime
ipc_client.h File Reference

Common client side code. More...

#include "xrt/xrt_compiler.h"
#include "xrt/xrt_config_os.h"
#include "util/u_threading.h"
#include "util/u_logging.h"
#include "shared/ipc_utils.h"
#include "shared/ipc_protocol.h"
#include "shared/ipc_message_channel.h"
#include <stdio.h>
Include dependency graph for ipc_client.h:

Go to the source code of this file.

Data Structures

struct  ipc_connection
 Connection. More...
 
struct  ipc_client_xdev
 An IPC client proxy for an xrt_device. More...
 

Macros

#define IPC_TRACE(IPC_C, ...)   U_LOG_IFL_T((IPC_C)->imc.log_level, __VA_ARGS__)
 
#define IPC_DEBUG(IPC_C, ...)   U_LOG_IFL_D((IPC_C)->imc.log_level, __VA_ARGS__)
 
#define IPC_INFO(IPC_C, ...)   U_LOG_IFL_I((IPC_C)->imc.log_level, __VA_ARGS__)
 
#define IPC_WARN(IPC_C, ...)   U_LOG_IFL_W((IPC_C)->imc.log_level, __VA_ARGS__)
 
#define IPC_ERROR(IPC_C, ...)   U_LOG_IFL_E((IPC_C)->imc.log_level, __VA_ARGS__)
 
#define IPC_CHK_AND_RET(IPC_C, XRET, FUNC_STR)
 This define will error if XRET is not XRT_SUCCESS, printing out that the FUNC_STR string has failed, then returns XRET. More...
 
#define IPC_CHK_WITH_GOTO(IPC_C, XRET, FUNC_STR, GOTO)
 This define will error if XRET is not XRT_SUCCESS, printing out that the FUNC_STR string has failed, then gotos GOTO. More...
 
#define IPC_CHK_WITH_RET(IPC_C, XRET, FUNC_STR, RET)
 This define will error if XRET is not XRT_SUCCESS, printing out that the FUNC_STR string has failed, then returns RET. More...
 
#define IPC_CHK_ONLY_PRINT(IPC_C, XRET, FUNC_STR)
 This define will error if XRET is not XRT_SUCCESS, printing out that the FUNC_STR string has failed, it only prints and does nothing else. More...
 
#define IPC_CHK_ALWAYS_RET(IPC_C, XRET, FUNC_STR)
 This define will error if XRET is not XRT_SUCCESS, printing out that the FUNC_STR string has failed, then it will always return the value. More...
 

Functions

static struct ipc_client_xdevipc_client_xdev (struct xrt_device *xdev)
 Convenience helper to go from a xdev to ipc_client_xdev. More...
 
xrt_result_t ipc_client_create_system_compositor (struct ipc_connection *ipc_c, struct xrt_image_native_allocator *xina, struct xrt_device *xdev, struct xrt_system_compositor **out_xcs)
 Create an IPC client system compositor. More...
 
xrt_result_t ipc_client_create_native_compositor (struct xrt_system_compositor *xsysc, const struct xrt_session_info *xsi, struct xrt_compositor_native **out_xcn)
 Create a native compositor from a system compositor, this is used instead of the normal xrt_system_compositor::create_native_compositor function because it doesn't support events being generated on the app side. More...
 
struct xrt_deviceipc_client_hmd_create (struct ipc_connection *ipc_c, struct xrt_tracking_origin *xtrack, uint32_t device_id)
 
struct xrt_deviceipc_client_device_create (struct ipc_connection *ipc_c, struct xrt_tracking_origin *xtrack, uint32_t device_id)
 
struct xrt_systemipc_client_system_create (struct ipc_connection *ipc_c, struct xrt_system_compositor *xsysc)
 
struct xrt_space_overseeripc_client_space_overseer_create (struct ipc_connection *ipc_c)
 
struct xrt_system_devicesipc_client_system_devices_create (struct ipc_connection *ipc_c)
 
struct xrt_sessionipc_client_session_create (struct ipc_connection *ipc_c)
 

Detailed Description

Function Documentation

◆ ipc_client_create_native_compositor()

xrt_result_t ipc_client_create_native_compositor ( struct xrt_system_compositor xsysc,
const struct xrt_session_info xsi,
struct xrt_compositor_native **  out_xcn 
)

Create a native compositor from a system compositor, this is used instead of the normal xrt_system_compositor::create_native_compositor function because it doesn't support events being generated on the app side.

This will also create the session on the service side.

Parameters
xsyscIPC created system compositor.
xsiSession information struct.
[out]out_xcnPointer to receive the created xrt_compositor_native.

References ipc_client_compositor::compositor_created, container_of, IPC_CHK_AND_RET, ipc_client_compositor::system, and XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.

◆ ipc_client_create_system_compositor()

xrt_result_t ipc_client_create_system_compositor ( struct ipc_connection ipc_c,
struct xrt_image_native_allocator xina,
struct xrt_device xdev,
struct xrt_system_compositor **  out_xcs 
)

Create an IPC client system compositor.

It owns a special implementation of the xrt_system_compositor interface.

This actually creates an IPC client "native" compositor with deferred initialization. The ipc_client_create_native_compositor function actually completes the deferred initialization of the compositor, effectively finishing creation of a compositor IPC proxy.

Parameters
ipc_cIPC connection
xinaOptional native image allocator for client-side allocation. Takes ownership if one is supplied.
xdevTaken in but not used currently
Todo:
remove this param?
Parameters
[out]out_xcsPointer to receive the created xrt_system_compositor.

References xrt_system_compositor::create_native_compositor, ipc_client_compositor::system, and U_TYPED_CALLOC.