Monado OpenXR Runtime
ipc_server_process.c File Reference

Server process functions. More...

#include "xrt/xrt_device.h"
#include "xrt/xrt_system.h"
#include "xrt/xrt_instance.h"
#include "xrt/xrt_compositor.h"
#include "xrt/xrt_config_have.h"
#include "xrt/xrt_config_os.h"
#include "os/os_time.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_trace_marker.h"
#include "util/u_verify.h"
#include "util/u_process.h"
#include "util/u_debug_gui.h"
#include "util/u_pretty_print.h"
#include "util/u_git_tag.h"
#include "shared/ipc_shmem.h"
#include "server/ipc_server.h"
#include "server/ipc_server_interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
Include dependency graph for ipc_server_process.c:

Macros

#define PN()   u_pp(dg, "\n")
 
#define PNH()   u_pp(dg, "\n#")
 
#define PNHS(...)   u_pp(dg, "\n# "__VA_ARGS__)
 
#define PN80H()
 

Functions

static int32_t find_xdev_index (struct ipc_server *s, struct xrt_device *xdev)
 
static void init_idev (struct ipc_device *idev, struct xrt_device *xdev)
 
static void teardown_idev (struct ipc_device *idev)
 
static int init_idevs (struct ipc_server *s)
 
static void teardown_idevs (struct ipc_server *s)
 
static XRT_MAYBE_UNUSED void print_linux_end_user_failed_information (enum u_logging_level log_level)
 
static XRT_MAYBE_UNUSED void print_linux_end_user_started_information (enum u_logging_level log_level)
 
static void teardown_all (struct ipc_server *s)
 
static int init_tracking_origins (struct ipc_server *s)
 
static void handle_binding (struct ipc_shared_memory *ism, struct xrt_binding_profile *xbp, struct ipc_shared_binding_profile *isbp, uint32_t *input_pair_index_ptr, uint32_t *output_pair_index_ptr)
 
static int init_shm (struct ipc_server *s)
 
static void init_server_state (struct ipc_server *s)
 
static int init_all (struct ipc_server *s, enum u_logging_level log_level)
 
static int main_loop (struct ipc_server *s)
 
static void handle_overlay_client_events (volatile struct ipc_client_state *ics, int active_id, int prev_active_id)
 
static void handle_focused_client_events (volatile struct ipc_client_state *ics, int active_id, int prev_active_id)
 
static void flush_state_to_all_clients_locked (struct ipc_server *s)
 
static void update_server_state_locked (struct ipc_server *s)
 
static volatile struct ipc_client_statefind_client_locked (struct ipc_server *s, uint32_t client_id)
 
static xrt_result_t get_client_app_state_locked (struct ipc_server *s, uint32_t client_id, struct ipc_app_state *out_ias)
 
static xrt_result_t set_active_client_locked (struct ipc_server *s, uint32_t client_id)
 
static xrt_result_t toggle_io_client_locked (struct ipc_server *s, uint32_t client_id)
 
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. More...
 
xrt_result_t ipc_server_set_active_client (struct ipc_server *s, uint32_t client_id)
 Set the new active client. More...
 
xrt_result_t ipc_server_toggle_io_client (struct ipc_server *s, uint32_t client_id)
 Toggle the io for this client. More...
 
void ipc_server_activate_session (volatile struct ipc_client_state *ics)
 Called by client threads to set a session to active. More...
 
void ipc_server_deactivate_session (volatile struct ipc_client_state *ics)
 Called by client threads to set a session to deactivate. More...
 
void ipc_server_update_state (struct ipc_server *s)
 Called by client threads to recalculate active client. More...
 
void ipc_server_handle_failure (struct ipc_server *vs)
 
void ipc_server_handle_shutdown_signal (struct ipc_server *vs)
 
void ipc_server_handle_client_connected (struct ipc_server *vs, xrt_ipc_handle_t ipc_handle)
 
xrt_result_t ipc_server_get_system_properties (struct ipc_server *vs, struct xrt_system_properties *out_properties)
 
int ipc_server_main (int argc, char **argv)
 Main entrypoint to the compositor process. More...
 

Detailed Description

Macro Definition Documentation

◆ PN80H

#define PN80H ( )
Value:
do { \
PN(); \
for (uint32_t i = 0; i < 8; i++) { \
u_pp(dg, "##########"); \
} \
} while (false)

Function Documentation

◆ ipc_server_handle_client_connected()

void ipc_server_handle_client_connected ( struct ipc_server vs,
xrt_ipc_handle_t  ipc_handle 
)
Todo:
validate ID.