Monado OpenXR Runtime
Loading...
Searching...
No Matches
ipc_server.h File Reference

Common server side code. More...

#include "xrt/xrt_compiler.h"
#include "xrt/xrt_limits.h"
#include "xrt/xrt_space.h"
#include "xrt/xrt_system.h"
#include "os/os_threading.h"
#include "util/u_logging.h"
#include "util/u_hashmap.h"
#include "shared/ipc_protocol.h"
#include "shared/ipc_message_channel.h"
#include "ipc_server_interface.h"
#include <stdio.h>
Include dependency graph for ipc_server.h:

Go to the source code of this file.

Data Structures

struct  ipc_swapchain_data
 Information about a single swapchain. More...
 
struct  ipc_client_state
 Holds the state for a single client. More...
 
struct  ipc_thread
 
struct  ipc_server_mainloop
 Platform-specific mainloop object for the IPC server. More...
 
struct  ipc_server
 Main IPC object for the server. More...
 

Macros

#define IPC_TRACE(d, ...)   U_LOG_IFL_T(d->log_level, __VA_ARGS__)
 
#define IPC_DEBUG(d, ...)   U_LOG_IFL_D(d->log_level, __VA_ARGS__)
 
#define IPC_INFO(d, ...)   U_LOG_IFL_I(d->log_level, __VA_ARGS__)
 
#define IPC_WARN(d, ...)   U_LOG_IFL_W(d->log_level, __VA_ARGS__)
 
#define IPC_ERROR(d, ...)   U_LOG_IFL_E(d->log_level, __VA_ARGS__)
 
#define IPC_CHK_AND_RET(S, ...)   U_LOG_CHK_AND_RET((S)->log_level, __VA_ARGS__)
 
#define IPC_CHK_WITH_GOTO(S, ...)   U_LOG_CHK_WITH_GOTO((S)->log_level, __VA_ARGS__)
 
#define IPC_CHK_WITH_RET(S, ...)   U_LOG_CHK_WITH_RET((S)->log_level, __VA_ARGS__)
 
#define IPC_CHK_ONLY_PRINT(S, ...)   U_LOG_CHK_ONLY_PRINT((S)->log_level, __VA_ARGS__)
 
#define IPC_CHK_ALWAYS_RET(S, ...)   U_LOG_CHK_ALWAYS_RET((S)->log_level, __VA_ARGS__)
 
#define IPC_MAX_CLIENT_SEMAPHORES   8
 
#define IPC_MAX_CLIENT_SWAPCHAINS   (XRT_MAX_LAYERS * 2)
 
#define IPC_MAX_CLIENT_SPACES   128
 
#define IPC_MAX_CLIENT_FUTURES   128
 
#define XRT_IPC_GOT_IMPL
 
#define XRT_IPC_GOT_IMPL
 
#define XRT_IPC_GOT_IMPL
 

Enumerations

enum  ipc_thread_state { IPC_THREAD_READY , IPC_THREAD_STARTING , IPC_THREAD_RUNNING , IPC_THREAD_STOPPING }
 

Functions

xrt_result_t ipc_server_init_system_if_available_locked (struct ipc_server *s, volatile struct ipc_client_state *ics, bool *out_available)
 Finish setting up the server by creating the system, compositor and devices.
 
xrt_result_t ipc_server_get_client_app_state (struct ipc_server *s, uint32_t client_id, struct ipc_app_state *out_ias)
 Get the current state of a client.
 
xrt_result_t ipc_server_set_active_client (struct ipc_server *s, uint32_t client_id)
 Set the new active client.
 
xrt_result_t ipc_server_toggle_io_client (struct ipc_server *s, uint32_t client_id)
 Toggle the io for this client.
 
xrt_result_t ipc_server_set_client_io_blocks (struct ipc_server *s, uint32_t client_id, const struct ipc_client_io_blocks *blocks)
 Block certain types of IO for this client.
 
void ipc_server_activate_session (volatile struct ipc_client_state *ics)
 Called by client threads to set a session to active.
 
void ipc_server_deactivate_session (volatile struct ipc_client_state *ics)
 Called by client threads to set a session to deactivate.
 
void ipc_server_update_state (struct ipc_server *s)
 Called by client threads to recalculate active client.
 
void * ipc_server_client_thread (void *_ics)
 Thread function for the client side dispatching.
 
void ipc_server_client_destroy_session_and_compositor (volatile struct ipc_client_state *ics)
 This destroys the native compositor for this client and any extra objects created from it, like all of the swapchains.
 
xrt_result_t ipc_server_get_system_properties (struct ipc_server *vs, struct xrt_system_properties *out_properties)
 
static struct ipc_shared_memoryget_ism (volatile struct ipc_client_state *ics)
 Get the data in the shared memory of the given client.
 
static xrt_shmem_handle_t get_ism_handle (volatile struct ipc_client_state *ics)
 Get the handle for the shared memory of the given client.
 

Detailed Description

Function Documentation

◆ get_ism()

static struct ipc_shared_memory * get_ism ( volatile struct ipc_client_state ics)
inlinestatic

Get the data in the shared memory of the given client.

References ipc_client_state::server.

◆ get_ism_handle()

static xrt_shmem_handle_t get_ism_handle ( volatile struct ipc_client_state ics)
inlinestatic

Get the handle for the shared memory of the given client.

◆ ipc_server_client_destroy_session_and_compositor()

void ipc_server_client_destroy_session_and_compositor ( volatile struct ipc_client_state ics)

This destroys the native compositor for this client and any extra objects created from it, like all of the swapchains.

References ipc_client_state::server, ipc_client_state::swapchain_count, ipc_client_state::swapchain_data, ipc_client_state::xc, ipc_client_state::xcsems, ipc_client_state::xfts, ipc_client_state::xs, and ipc_client_state::xscs.