|
Monado OpenXR Runtime
|

Modules | |
| Server Internals | |
| These are only called by the platform-specific mainloop polling code. | |
Files | |
| file | ipc_server.h |
| Common server side code. | |
| file | ipc_server_handle_helpers.h |
| Helpers shared between the IPC server handle functions. | |
| file | ipc_server_handler.c |
| Handling functions called from generated dispatch function. | |
| file | ipc_server_handler_app_policy.c |
| IPC server handlers for app policy objects. | |
| file | ipc_server_handler_body_tracker.c |
| IPC server handlers for xrt_body_tracker. | |
| file | ipc_server_handler_hand_tracker.c |
| IPC server handlers for xrt_hand_tracker. | |
| file | ipc_server_handler_io_cache.c |
| IPC server handlers for xrt_io_cache. | |
| file | ipc_server_handler_swapchain.c |
| Swapchain handling functions called from generated dispatch function. | |
| file | ipc_server_interface.h |
| Interface for IPC server code. | |
| file | ipc_server_mainloop_android.c |
| Server mainloop details on Android. | |
| file | ipc_server_mainloop_android.h |
| Additional server entry points needed for Android. | |
| file | ipc_server_mainloop_linux.c |
| Server mainloop details on Linux. | |
| file | ipc_server_mainloop_windows.cpp |
| Server mainloop details on Windows. | |
| file | ipc_server_objects.c |
| Tracking objects to IDs. | |
| file | ipc_server_objects.h |
| Tracking objects to IDs. | |
| file | ipc_server_per_client_thread.c |
| Per client thread listening on the socket. | |
| file | ipc_server_process.c |
| Server process functions. | |
| file | ipc_server_thread_shutdown.c |
| IPC client thread shutdown and blocking I/O cancellation. | |
| file | ipc_server_thread_shutdown.h |
| IPC client thread shutdown and blocking I/O cancellation. | |
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_server_mainloop |
| Platform-specific mainloop object for the IPC server. More... | |
| struct | ipc_server |
| Main IPC object for the server. More... | |
| struct | ipc_server_main_info |
| Information passed into the IPC server main function, used for customization of the IPC server. More... | |
| struct | ipc_server_callbacks |
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. | |
| xrt_result_t | ipc_server_get_client_session_running_state (struct ipc_server *s, uint32_t client_id, struct xrt_compositor_session_running_state *out_running_state) |
| Get the session running state for this client. | |
| xrt_result_t | ipc_server_get_client_view_config (struct ipc_server *s, uint32_t client_id, enum xrt_view_type view_type, struct xrt_view_config *out_default_view_config, struct xrt_recommended_view_config *out_recommended_view_config) |
| Get the view configuration for this client. | |
| xrt_result_t | ipc_server_set_client_recommended_view_config (struct ipc_server *s, uint32_t client_id, enum xrt_view_type view_type, const struct xrt_recommended_view_config *recommended_view_config) |
| Set the recommended view configuration 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. | |
| static bool | ipc_server_client_is_input_blocked (volatile struct ipc_client_state *ics, enum xrt_input_name name) |
| Is the given input blocked for this client by its ipc_client_io_blocks. | |
| static void | ipc_server_client_filter_blocked_inputs (volatile struct ipc_client_state *ics, struct xrt_input *inputs, uint32_t input_count) |
| Zero out the inputs that are blocked for this client, in place. | |
| static void | ipc_server_client_filter_blocked_outputs (volatile struct ipc_client_state *ics, struct xrt_output *outputs, uint32_t output_count) |
| Zero out the outputs if outputs are blocked for this client, in place. | |
| static xrt_result_t | ipc_server_validate_output_value (volatile struct ipc_client_state *ics, const struct xrt_output_value *value) |
| Plain output calls copy the value as is, so reject PCM values: they hold client pointers and must go through a varlen haptic output call. | |
| static xrt_result_t | ipc_server_validate_pcm_haptic_buffer (volatile struct ipc_client_state *ics, const struct ipc_pcm_haptic_buffer *buffer) |
| Reject haptic output calls with no samples, since the message channel can't send zero bytes, or with more samples than the service will allocate, see IPC_MAX_PCM_HAPTIC_SAMPLES. | |
| int | ipc_server_main_common (const struct ipc_server_main_info *ismi, const struct ipc_server_callbacks *iscb, void *data) |
| Common main function for starting the IPC service. | |
| int | ipc_server_main (int argc, char **argv, const struct ipc_server_main_info *ismi) |
| Main entrypoint to the compositor process. | |
| xrt_result_t | ipc_server_objects_get_xdev_and_validate (volatile struct ipc_client_state *ics, uint32_t id, struct xrt_device **out_xdev) |
| Get a device by its per-client-connection slot index. | |
| xrt_result_t | ipc_server_objects_get_xdev_id_or_add (volatile struct ipc_client_state *ics, struct xrt_device *xdev, uint32_t *out_id) |
| Get or allocate a per-client-connection slot index for a device object. | |
| xrt_result_t | ipc_server_objects_get_xtrack_and_validate (volatile struct ipc_client_state *ics, uint32_t id, struct xrt_tracking_origin **out_xtrack) |
| Get a tracking origin by ID, must only be called from the per client thread as this function accesses the client state's memory. | |
| xrt_result_t | ipc_server_objects_get_xtrack_id_or_add (volatile struct ipc_client_state *ics, struct xrt_tracking_origin *xtrack, uint32_t *out_id) |
| Get a tracking origin ID for a given tracking origin object, must only be called from the per client thread as this function accesses the client state's memory. | |
| xrt_result_t | ipc_server_objects_get_xspc_and_validate (volatile struct ipc_client_state *ics, uint32_t id, struct xrt_space **out_xspc) |
| Get a space by ID, must only be called from the per client thread. | |
| xrt_result_t | ipc_server_objects_get_xspc_id_or_add (volatile struct ipc_client_state *ics, struct xrt_space *xspc, uint32_t *out_id) |
| Track a space and return its ID. | |
| xrt_result_t | ipc_server_objects_destroy_xspc (volatile struct ipc_client_state *ics, uint32_t id) |
| Destroy a tracked space. | |
| xrt_result_t | ipc_server_objects_get_xbt_and_validate (volatile struct ipc_client_state *ics, uint32_t id, struct xrt_body_tracker **out_xbt) |
| Get a body tracker by ID, must only be called from the per client thread. | |
| xrt_result_t | ipc_server_objects_get_xbt_id_or_add (volatile struct ipc_client_state *ics, struct xrt_body_tracker *xbt, uint32_t *out_id) |
| Track a newly created body tracker and return its ID. | |
| xrt_result_t | ipc_server_objects_destroy_xbt (volatile struct ipc_client_state *ics, uint32_t id) |
| Destroy a tracked body tracker. | |
| xrt_result_t | ipc_server_objects_get_xht_and_validate (volatile struct ipc_client_state *ics, uint32_t id, struct xrt_hand_tracker **out_xht) |
| Get a hand tracker by ID, must only be called from the per client thread. | |
| xrt_result_t | ipc_server_objects_get_xht_id_or_add (volatile struct ipc_client_state *ics, struct xrt_hand_tracker *xht, uint32_t *out_id) |
| Track a newly created hand tracker and return its ID. | |
| xrt_result_t | ipc_server_objects_destroy_xht (volatile struct ipc_client_state *ics, uint32_t id) |
| Destroy a tracked hand tracker. | |
| xrt_result_t | ipc_server_objects_get_xic_and_validate (volatile struct ipc_client_state *ics, uint32_t id, struct xrt_io_cache **out_xic) |
| Get an input/output cache by ID, must only be called from the per client thread. | |
| xrt_result_t | ipc_server_objects_get_xic_id_or_add (volatile struct ipc_client_state *ics, struct xrt_io_cache *xic, uint32_t *out_id) |
| Track a newly created input/output cache and return its ID. | |
| xrt_result_t | ipc_server_objects_destroy_xic (volatile struct ipc_client_state *ics, uint32_t id) |
| Destroy a tracked input/output cache. | |
Server side IPC code.
| void ipc_server_activate_session | ( | volatile struct ipc_client_state * | ics | ) |
#include <ipc/server/ipc_server.h>
Called by client threads to set a session to active.
References lock, and ipc_client_state::server.
|
inlinestatic |
#include <ipc/server/ipc_server_handle_helpers.h>
Zero out the inputs that are blocked for this client, in place.
References ipc_server_client_is_input_blocked(), and U_ZERO.
|
inlinestatic |
#include <ipc/server/ipc_server_handle_helpers.h>
Zero out the outputs if outputs are blocked for this client, in place.
References U_ZERO.
|
inlinestatic |
#include <ipc/server/ipc_server_handle_helpers.h>
Is the given input blocked for this client by its ipc_client_io_blocks.
References XRT_GET_INPUT_TYPE, XRT_INPUT_GENERIC_HEAD_POSE, XRT_INPUT_TYPE_BODY_TRACKING, XRT_INPUT_TYPE_BOOLEAN, XRT_INPUT_TYPE_FACE_TRACKING, XRT_INPUT_TYPE_HAND_TRACKING, XRT_INPUT_TYPE_POSE, XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE, XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE, XRT_INPUT_TYPE_VEC2_MINUS_ONE_TO_ONE, and XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE.
Referenced by ipc_server_client_filter_blocked_inputs().
| void * ipc_server_client_thread | ( | void * | _ics | ) |
#include <ipc/server/ipc_server.h>
Thread function for the client side dispatching.
Referenced by ipc_server_handle_client_connected().
| void ipc_server_deactivate_session | ( | volatile struct ipc_client_state * | ics | ) |
#include <ipc/server/ipc_server.h>
Called by client threads to set a session to deactivate.
References lock, and ipc_client_state::server.
| xrt_result_t ipc_server_get_client_app_state | ( | struct ipc_server * | s, |
| uint32_t | client_id, | ||
| struct ipc_app_state * | out_ias | ||
| ) |
| xrt_result_t ipc_server_get_client_session_running_state | ( | struct ipc_server * | s, |
| uint32_t | client_id, | ||
| struct xrt_compositor_session_running_state * | out_running_state | ||
| ) |
| xrt_result_t ipc_server_get_client_view_config | ( | struct ipc_server * | s, |
| uint32_t | client_id, | ||
| enum xrt_view_type | view_type, | ||
| struct xrt_view_config * | out_default_view_config, | ||
| struct xrt_recommended_view_config * | out_recommended_view_config | ||
| ) |
| xrt_result_t ipc_server_init_system_if_available_locked | ( | struct ipc_server * | s, |
| volatile struct ipc_client_state * | ics, | ||
| bool * | out_available | ||
| ) |
#include <ipc/server/ipc_server.h>
Finish setting up the server by creating the system, compositor and devices.
References ipc_client_state::has_init_shm_system, XRT_SUCCESS, xso, xsys, xsysc, and xsysd.
Referenced by ipc_server_main_common().
| int ipc_server_main | ( | int | argc, |
| char ** | argv, | ||
| const struct ipc_server_main_info * | ismi | ||
| ) |
#include <ipc/server/ipc_server_interface.h>
Main entrypoint to the compositor process.
Both socket_filename and pid_filename in ismi must be set, otherwise this fails and returns -1.
References ipc_server_callbacks::client_connected, ipc_server_callbacks::client_disconnected, ipc_server_callbacks::init_failed, ipc_server_main_common(), ipc_server_callbacks::mainloop_entering, and ipc_server_callbacks::mainloop_leaving.
| int ipc_server_main_common | ( | const struct ipc_server_main_info * | ismi, |
| const struct ipc_server_callbacks * | iscb, | ||
| void * | data | ||
| ) |
#include <ipc/server/ipc_server_interface.h>
Common main function for starting the IPC service.
Except on Android, ismi must have both socket_filename and pid_filename set, otherwise ipc_server_callbacks::init_failed is called with XRT_ERROR_INVALID_ARGUMENT and -1 is returned.
References callbacks, init_all(), ipc_server_callbacks::init_failed, ipc_server_init_system_if_available_locked(), ipc_server_callbacks::mainloop_entering, ipc_server_callbacks::mainloop_leaving, no_stdin, ipc_server_main_info::no_stdin, ipc_server_main_info::pid_filename, ipc_server_main_info::socket_filename, u_debug_gui_create(), u_debug_gui_start(), u_debug_gui_stop(), U_LOG_CHK_ONLY_PRINT, U_LOG_IFL_E, U_LOG_IFL_I, U_TYPED_CALLOC, ipc_server_main_info::udgci, XRT_ERROR_INVALID_ARGUMENT, XRT_SUCCESS, and xsysd.
Referenced by ipc_server_main().
| xrt_result_t ipc_server_objects_destroy_xbt | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Destroy a tracked body tracker.
References ipc_client_state::server, ipc_client_state::xbts, xrt_body_tracker::xrt_body_tracker_destroy(), XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_destroy_xht | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Destroy a tracked hand tracker.
References ipc_client_state::server, ipc_client_state::xhts, XRT_ERROR_IPC_FAILURE, xrt_hand_tracker::xrt_hand_tracker_destroy(), and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_destroy_xic | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Destroy a tracked input/output cache.
References ipc_client_state::server, ipc_client_state::xics, XRT_ERROR_IPC_FAILURE, xrt_io_cache::xrt_io_cache_destroy(), and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_destroy_xspc | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Destroy a tracked space.
References ipc_client_state::server, XRT_ERROR_IPC_FAILURE, xrt_space::xrt_space_reference(), XRT_SUCCESS, and ipc_client_state::xspcs.
| xrt_result_t ipc_server_objects_get_xbt_and_validate | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id, | ||
| struct xrt_body_tracker ** | out_xbt | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get a body tracker by ID, must only be called from the per client thread.
References ipc_client_state::server, ipc_client_state::xbts, XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_get_xbt_id_or_add | ( | volatile struct ipc_client_state * | ics, |
| struct xrt_body_tracker * | xbt, | ||
| uint32_t * | out_id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Track a newly created body tracker and return its ID.
Takes ownership of xbt until explicit destroy or client disconnect.
References ipc_client_state::server, ipc_client_state::xbts, XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_get_xdev_and_validate | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id, | ||
| struct xrt_device ** | out_xdev | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get a device by its per-client-connection slot index.
The id is a uint32_t index into ics->objects.xdevs used for IPC message lookups. It is not xrt_device::id.
Must only be called from the per client thread as this function accesses the client state's memory.
| ics | The client state instance. |
| id | The per-client slot index. |
| out_xdev | Will be filled with the device object on success. |
References xrt_device::id, ipc_client_state::server, ipc_client_state::xdevs, XRT_ERROR_IPC_FAILURE, XRT_SUCCESS, and XRT_SYSTEM_MAX_DEVICES.
| xrt_result_t ipc_server_objects_get_xdev_id_or_add | ( | volatile struct ipc_client_state * | ics, |
| struct xrt_device * | xdev, | ||
| uint32_t * | out_id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get or allocate a per-client-connection slot index for a device object.
The returned uint32_t is used in IPC messages to look up xdev on the server. It is not xrt_device::id, which is assigned at device creation and synchronized to clients via ipc_device_info.
Must only be called from the per client thread as this function accesses the client state's memory.
| ics | The client state instance. |
| xdev | The device object. |
| out_id | Will be filled with the slot index on success. |
References ipc_server_objects_get_xtrack_id_or_add(), ipc_client_state::server, xrt_device::str, xrt_device::tracking_origin, ipc_client_state::xdevs, XRT_ERROR_IPC_FAILURE, XRT_SUCCESS, and XRT_SYSTEM_MAX_DEVICES.
| xrt_result_t ipc_server_objects_get_xht_and_validate | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id, | ||
| struct xrt_hand_tracker ** | out_xht | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get a hand tracker by ID, must only be called from the per client thread.
References ipc_client_state::server, ipc_client_state::xhts, XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_get_xht_id_or_add | ( | volatile struct ipc_client_state * | ics, |
| struct xrt_hand_tracker * | xht, | ||
| uint32_t * | out_id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Track a newly created hand tracker and return its ID.
Takes ownership of xht until explicit destroy or client disconnect.
References ipc_client_state::server, ipc_client_state::xhts, XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_get_xic_and_validate | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id, | ||
| struct xrt_io_cache ** | out_xic | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get an input/output cache by ID, must only be called from the per client thread.
References ipc_client_state::server, ipc_client_state::xics, XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_get_xic_id_or_add | ( | volatile struct ipc_client_state * | ics, |
| struct xrt_io_cache * | xic, | ||
| uint32_t * | out_id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Track a newly created input/output cache and return its ID.
Takes ownership of xic until explicit destroy or client disconnect.
References ipc_client_state::server, ipc_client_state::xics, XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.
| xrt_result_t ipc_server_objects_get_xspc_and_validate | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id, | ||
| struct xrt_space ** | out_xspc | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get a space by ID, must only be called from the per client thread.
References ipc_client_state::server, XRT_ERROR_IPC_FAILURE, XRT_SUCCESS, and ipc_client_state::xspcs.
| xrt_result_t ipc_server_objects_get_xspc_id_or_add | ( | volatile struct ipc_client_state * | ics, |
| struct xrt_space * | xspc, | ||
| uint32_t * | out_id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Track a space and return its ID.
Grabs and stores a reference if newly tracked.
References ipc_client_state::server, XRT_ERROR_IPC_FAILURE, xrt_space::xrt_space_reference(), XRT_SUCCESS, and ipc_client_state::xspcs.
| xrt_result_t ipc_server_objects_get_xtrack_and_validate | ( | volatile struct ipc_client_state * | ics, |
| uint32_t | id, | ||
| struct xrt_tracking_origin ** | out_xtrack | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get a tracking origin by ID, must only be called from the per client thread as this function accesses the client state's memory.
| ics | The client state instance. |
| id | The tracking origin ID. |
| out_xtrack | Will be filled with the tracking origin object on success. |
References ipc_client_state::server, XRT_ERROR_IPC_FAILURE, XRT_SUCCESS, XRT_SYSTEM_MAX_DEVICES, and ipc_client_state::xtracks.
| xrt_result_t ipc_server_objects_get_xtrack_id_or_add | ( | volatile struct ipc_client_state * | ics, |
| struct xrt_tracking_origin * | xtrack, | ||
| uint32_t * | out_id | ||
| ) |
#include <ipc/server/ipc_server_objects.h>
Get a tracking origin ID for a given tracking origin object, must only be called from the per client thread as this function accesses the client state's memory.
| ics | The client state instance. |
| xtrack | The tracking origin object. |
| out_id | Will be filled with the tracking origin ID on success. |
References xrt_tracking_origin::name, ipc_client_state::server, XRT_ERROR_IPC_FAILURE, XRT_SUCCESS, XRT_SYSTEM_MAX_DEVICES, and ipc_client_state::xtracks.
Referenced by ipc_server_objects_get_xdev_id_or_add().
| xrt_result_t ipc_server_set_active_client | ( | struct ipc_server * | s, |
| uint32_t | client_id | ||
| ) |
| xrt_result_t ipc_server_set_client_io_blocks | ( | struct ipc_server * | s, |
| uint32_t | client_id, | ||
| const struct ipc_client_io_blocks * | blocks | ||
| ) |
| xrt_result_t ipc_server_set_client_recommended_view_config | ( | struct ipc_server * | s, |
| uint32_t | client_id, | ||
| enum xrt_view_type | view_type, | ||
| const struct xrt_recommended_view_config * | recommended_view_config | ||
| ) |
#include <ipc/server/ipc_server.h>
Set the recommended view configuration for this client.
References lock.
| xrt_result_t ipc_server_toggle_io_client | ( | struct ipc_server * | s, |
| uint32_t | client_id | ||
| ) |
| void ipc_server_update_state | ( | struct ipc_server * | s | ) |
#include <ipc/server/ipc_server.h>
Called by client threads to recalculate active client.
References lock.
|
inlinestatic |
#include <ipc/server/ipc_server_handle_helpers.h>
Plain output calls copy the value as is, so reject PCM values: they hold client pointers and must go through a varlen haptic output call.
References ipc_client_state::server, XRT_ERROR_INVALID_ARGUMENT, and XRT_SUCCESS.
|
inlinestatic |
#include <ipc/server/ipc_server_handle_helpers.h>
Reject haptic output calls with no samples, since the message channel can't send zero bytes, or with more samples than the service will allocate, see IPC_MAX_PCM_HAPTIC_SAMPLES.
References IPC_MAX_PCM_HAPTIC_SAMPLES, ipc_client_state::server, XRT_ERROR_INVALID_ARGUMENT, and XRT_SUCCESS.