39#define IPC_TRACE(d, ...) U_LOG_IFL_T(d->log_level, __VA_ARGS__)
40#define IPC_DEBUG(d, ...) U_LOG_IFL_D(d->log_level, __VA_ARGS__)
41#define IPC_INFO(d, ...) U_LOG_IFL_I(d->log_level, __VA_ARGS__)
42#define IPC_WARN(d, ...) U_LOG_IFL_W(d->log_level, __VA_ARGS__)
43#define IPC_ERROR(d, ...) U_LOG_IFL_E(d->log_level, __VA_ARGS__)
52#define IPC_MAX_CLIENT_SEMAPHORES 8
53#define IPC_MAX_CLIENT_SWAPCHAINS (XRT_MAX_LAYERS * 2)
54#define IPC_MAX_CLIENT_SPACES 128
143 int server_thread_index;
157 volatile enum ipc_thread_state state;
187#if defined(XRT_OS_ANDROID) || defined(XRT_OS_LINUX) || defined(XRT_DOXYGEN)
192#if defined(XRT_OS_ANDROID) || defined(XRT_DOXYGEN)
251#define XRT_IPC_GOT_IMPL
254#if (defined(XRT_OS_LINUX) && !defined(XRT_OS_ANDROID)) || defined(XRT_DOXYGEN)
271#define XRT_IPC_GOT_IMPL
274#if defined(XRT_OS_WINDOWS) || defined(XRT_DOXYGEN)
288#define XRT_IPC_GOT_IMPL
291#ifndef XRT_IPC_GOT_IMPL
333 struct u_debug_gui *debug_gui;
356 volatile bool running;
359 bool exit_on_disconnect;
365 volatile uint32_t current_slot_index;
372 int active_client_index;
373 int last_active_client_index;
502 return &ics->
server->idevs[device_id];
Generic typedef for platform-specific shared memory handle.
u_logging_level
Logging level enum.
Definition: u_logging.h:43
void ipc_server_handle_client_connected(struct ipc_server *vs, xrt_ipc_handle_t ipc_handle)
Called when a client has connected, it takes the client's ipc handle.
Definition: ipc_server_process.c:908
void ipc_server_handle_shutdown_signal(struct ipc_server *vs)
Perform whatever needs to be done when the mainloop polling identifies that the server should be shut...
Definition: ipc_server_process.c:902
void ipc_server_handle_failure(struct ipc_server *vs)
Perform whatever needs to be done when the mainloop polling encounters a failure.
Definition: ipc_server_process.c:895
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.
Definition: ipc_server_process.c:805
void ipc_server_deactivate_session(volatile struct ipc_client_state *ics)
Called by client threads to set a session to deactivate.
Definition: ipc_server_process.c:869
void ipc_server_activate_session(volatile struct ipc_client_state *ics)
Called by client threads to set a session to active.
Definition: ipc_server_process.c:835
void * ipc_server_client_thread(void *_ics)
Thread function for the client side dispatching.
Definition: ipc_server_per_client_thread.c:351
void ipc_server_update_state(struct ipc_server *s)
Called by client threads to recalculate active client.
Definition: ipc_server_process.c:884
xrt_result_t ipc_server_set_active_client(struct ipc_server *s, uint32_t client_id)
Set the new active client.
Definition: ipc_server_process.c:815
xrt_result_t ipc_server_toggle_io_client(struct ipc_server *s, uint32_t client_id)
Toggle the io for this client.
Definition: ipc_server_process.c:825
#define XRT_SYSTEM_MAX_DEVICES
Maximum number of devices simultaneously usable by an implementation of xrt_system_devices.
Definition: xrt_system.h:141
#define XRT_SPACE_REFERENCE_TYPE_COUNT
The number of enumerations in xrt_reference_space_type.
Definition: xrt_defines.h:612
enum xrt_result xrt_result_t
Result type used across Monado.
IPC message channel functions.
Common protocol definition.
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,...
Definition: ipc_server_per_client_thread.c:320
static struct xrt_device * get_xdev(volatile struct ipc_client_state *ics, uint32_t device_id)
Get a xdev with the given device_id.
Definition: ipc_server.h:491
static struct ipc_device * get_idev(volatile struct ipc_client_state *ics, uint32_t device_id)
Get a idev with the given device_id.
Definition: ipc_server.h:500
Wrapper around OS threading native functions.
State for a connected application.
Definition: ipc_protocol.h:306
Holds the state for a single client.
Definition: ipc_server.h:82
uint32_t swapchain_count
Number of swapchains in use by client.
Definition: ipc_server.h:96
struct xrt_swapchain * xscs[(XRT_MAX_LAYERS *2)]
Ptrs to the swapchains.
Definition: ipc_server.h:99
struct xrt_session * xs
Session for this client.
Definition: ipc_server.h:87
struct ipc_message_channel imc
Socket fd used for client comms.
Definition: ipc_server.h:139
struct ipc_server * server
Link back to the main server.
Definition: ipc_server.h:84
uint32_t local_floor_space_index
Index of localfloorspace in ipc client.
Definition: ipc_server.h:125
struct ipc_swapchain_data swapchain_data[(XRT_MAX_LAYERS *2)]
Data for the swapchains.
Definition: ipc_server.h:102
uint32_t compositor_semaphore_count
Number of compositor semaphores in use by client.
Definition: ipc_server.h:105
uint32_t local_space_overseer_index
Index of localspace in space overseer.
Definition: ipc_server.h:123
struct xrt_space * xspcs[128]
Ptrs to the spaces.
Definition: ipc_server.h:130
uint32_t local_space_index
Index of localspace in ipc client.
Definition: ipc_server.h:121
bool ref_space_used[XRT_SPACE_REFERENCE_TYPE_COUNT]
Which of the references spaces is the client using.
Definition: ipc_server.h:133
struct xrt_compositor_semaphore * xcsems[8]
Ptrs to the semaphores.
Definition: ipc_server.h:108
uint32_t space_count
Number of spaces.
Definition: ipc_server.h:119
bool device_feature_used[XRT_DEVICE_FEATURE_MAX_ENUM]
Which of the device features is the client using.
Definition: ipc_server.h:136
bool io_active
Is the inputs and outputs active.
Definition: ipc_server.h:93
uint32_t local_floor_space_overseer_index
Index of localfloorspace in space overseer.
Definition: ipc_server.h:127
struct xrt_compositor * xc
Compositor for this client.
Definition: ipc_server.h:90
Definition: ipc_server.h:166
bool io_active
Is the IO suppressed for this device.
Definition: ipc_server.h:171
struct xrt_device * xdev
The actual device.
Definition: ipc_server.h:168
Wrapper for a socket and flags.
Definition: ipc_message_channel.h:30
Platform-specific mainloop object for the IPC server.
Definition: ipc_server.h:185
bool launched_by_socket
Were we launched by socket activation, instead of explicitly?
Definition: ipc_server.h:264
pthread_cond_t accept_cond
Condition variable for accepting clients.
Definition: ipc_server.h:236
char * pipe_name
Name of the Pipe that we accept connections on.
Definition: ipc_server.h:284
int last_accepted_fd
The last client fd we accepted, to acknowledge client acceptance.
Definition: ipc_server.h:227
int epoll_fd
For waiting on various events in the main thread.
Definition: ipc_server.h:189
void ipc_server_mainloop_deinit(struct ipc_server_mainloop *ml)
De-initialize the mainloop object.
Definition: ipc_server_mainloop_android.c:160
pthread_mutex_t accept_mutex
Mutex for accepting clients.
Definition: ipc_server.h:247
int pipe_read
File descriptor for the read end of our pipe for submitting new clients.
Definition: ipc_server.h:199
int listen_socket
Socket that we accept connections on.
Definition: ipc_server.h:261
int pipe_write
File descriptor for the write end of our pipe for submitting new clients.
Definition: ipc_server.h:206
int ipc_server_mainloop_init(struct ipc_server_mainloop *ml)
Initialize the mainloop object.
Definition: ipc_server_mainloop_android.c:142
char * socket_filename
The socket filename we bound to, if any.
Definition: ipc_server.h:267
pthread_mutex_t client_push_mutex
Mutex for being able to register oneself as a new client.
Definition: ipc_server.h:217
void ipc_server_mainloop_poll(struct ipc_server *vs, struct ipc_server_mainloop *ml)
Poll the mainloop.
Definition: ipc_server_mainloop_android.c:119
HANDLE pipe_handle
Named Pipe that we accept connections on.
Definition: ipc_server.h:281
Main IPC object for the server.
Definition: ipc_server.h:327
struct u_process * process
Handle for the current process, e.g. pidfile on linux.
Definition: ipc_server.h:331
struct xrt_system_compositor * xsysc
System compositor.
Definition: ipc_server.h:345
struct xrt_space_overseer * xso
Space overseer.
Definition: ipc_server.h:342
uint32_t id_generator
Generator for IDs.
Definition: ipc_server.h:368
struct xrt_system * xsys
The XRT interfaces level system.
Definition: ipc_server.h:336
struct xrt_system_devices * xsysd
System devices.
Definition: ipc_server.h:339
A big struct that contains all data that is shared to a client, no pointers allowed in this.
Definition: ipc_protocol.h:197
Information about a single swapchain.
Definition: ipc_server.h:67
Definition: ipc_server.h:155
A wrapper around a native mutex.
Definition: os_threading.h:55
A wrapper around a native thread.
Definition: os_threading.h:272
Definition: u_worker.c:37
Definition: u_process.c:43
Main compositor server interface.
Definition: xrt_compositor.h:2224
Compositor semaphore used for synchronization, needs to be as capable as a Vulkan pipeline semaphore.
Definition: xrt_compositor.h:788
Common compositor client interface/base.
Definition: xrt_compositor.h:988
A single HMD or input device.
Definition: xrt_device.h:241
This interface acts as a root object for Monado.
Definition: xrt_instance.h:114
The XRT representation of XrSession, this object does not have all of the functionality of a session,...
Definition: xrt_session.h:246
Object that oversees and manages spaces, one created for each XR system.
Definition: xrt_space.h:96
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition: xrt_space.h:31
Common swapchain interface/base.
Definition: xrt_compositor.h:536
The system compositor handles composition for a system.
Definition: xrt_compositor.h:2414
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition: xrt_system.h:219
Properties provided by the system.
Definition: xrt_system.h:44
A system is a collection of devices, policies and optionally a compositor that is organised into a ch...
Definition: xrt_system.h:62
A tracking system or device origin.
Definition: xrt_tracking.h:71
Basic logging functionality.
Header holding common defines.
int xrt_ipc_handle_t
The type for an IPC handle.
Definition: xrt_handles.h:74
Header for limits of the XRT interfaces.
Header defining xrt space and space overseer.
Header for system objects.