Monado OpenXR Runtime
ipc_server_handler.c File Reference

Handling functions called from generated dispatch function. More...

#include "util/u_misc.h"
#include "util/u_handles.h"
#include "util/u_pretty_print.h"
#include "util/u_visibility_mask.h"
#include "util/u_trace_marker.h"
#include "server/ipc_server.h"
#include "ipc_server_generated.h"
Include dependency graph for ipc_server_handler.c:

Macros

#define P(...)   u_pp(dg, __VA_ARGS__)
 
#define PNT(...)   u_pp(dg, "\n\t" __VA_ARGS__)
 
#define PNTT(...)   u_pp(dg, "\n\t\t" __VA_ARGS__)
 
#define EXT(NAME)   PNTT(#NAME ": %s", client_desc->info.NAME ? "true" : "false")
 
#define CREATE(NAME)
 

Functions

static xrt_result_t validate_device_id (volatile struct ipc_client_state *ics, int64_t device_id, struct xrt_device **out_device)
 
static xrt_result_t validate_origin_id (volatile struct ipc_client_state *ics, int64_t origin_id, struct xrt_tracking_origin **out_xtrack)
 
static xrt_result_t validate_swapchain_state (volatile struct ipc_client_state *ics, uint32_t *out_index)
 
static void set_swapchain_info (volatile struct ipc_client_state *ics, uint32_t index, const struct xrt_swapchain_create_info *info, struct xrt_swapchain *xsc)
 
static xrt_result_t validate_reference_space_type (volatile struct ipc_client_state *ics, enum xrt_reference_space_type type)
 
static xrt_result_t validate_device_feature_type (volatile struct ipc_client_state *ics, enum xrt_device_feature_type type)
 
static xrt_result_t validate_space_id (volatile struct ipc_client_state *ics, int64_t space_id, struct xrt_space **out_xspc)
 
static xrt_result_t get_new_space_id (volatile struct ipc_client_state *ics, uint32_t *out_id)
 
static xrt_result_t track_space (volatile struct ipc_client_state *ics, struct xrt_space *xs, uint32_t *out_id)
 
static xrt_result_t get_new_localspace_id (volatile struct ipc_client_state *ics, uint32_t *out_local_id, uint32_t *out_local_floor_id)
 
static xrt_result_t create_localspace (volatile struct ipc_client_state *ics, uint32_t *out_local_id, uint32_t *out_local_floor_id)
 
xrt_result_t ipc_handle_instance_get_shm_fd (volatile struct ipc_client_state *ics, uint32_t max_handle_capacity, xrt_shmem_handle_t *out_handles, uint32_t *out_handle_count)
 
xrt_result_t ipc_handle_instance_describe_client (volatile struct ipc_client_state *ics, const struct ipc_client_description *client_desc)
 
xrt_result_t ipc_handle_system_compositor_get_info (volatile struct ipc_client_state *ics, struct xrt_system_compositor_info *out_info)
 
xrt_result_t ipc_handle_session_create (volatile struct ipc_client_state *ics, const struct xrt_session_info *xsi, bool create_native_compositor)
 
xrt_result_t ipc_handle_session_poll_events (volatile struct ipc_client_state *ics, union xrt_session_event *out_xse)
 
xrt_result_t ipc_handle_session_begin (volatile struct ipc_client_state *ics)
 
xrt_result_t ipc_handle_session_end (volatile struct ipc_client_state *ics)
 
xrt_result_t ipc_handle_session_destroy (volatile struct ipc_client_state *ics)
 
xrt_result_t ipc_handle_space_create_semantic_ids (volatile struct ipc_client_state *ics, uint32_t *out_root_id, uint32_t *out_view_id, uint32_t *out_local_id, uint32_t *out_local_floor_id, uint32_t *out_stage_id, uint32_t *out_unbounded_id)
 
xrt_result_t ipc_handle_space_create_offset (volatile struct ipc_client_state *ics, uint32_t parent_id, const struct xrt_pose *offset, uint32_t *out_space_id)
 
xrt_result_t ipc_handle_space_create_pose (volatile struct ipc_client_state *ics, uint32_t xdev_id, enum xrt_input_name name, uint32_t *out_space_id)
 
xrt_result_t ipc_handle_space_locate_space (volatile struct ipc_client_state *ics, uint32_t base_space_id, const struct xrt_pose *base_offset, int64_t at_timestamp, uint32_t space_id, const struct xrt_pose *offset, struct xrt_space_relation *out_relation)
 
xrt_result_t ipc_handle_space_locate_spaces (volatile struct ipc_client_state *ics, uint32_t base_space_id, const struct xrt_pose *base_offset, uint32_t space_count, int64_t at_timestamp)
 
xrt_result_t ipc_handle_space_locate_device (volatile struct ipc_client_state *ics, uint32_t base_space_id, const struct xrt_pose *base_offset, int64_t at_timestamp, uint32_t xdev_id, struct xrt_space_relation *out_relation)
 
xrt_result_t ipc_handle_space_destroy (volatile struct ipc_client_state *ics, uint32_t space_id)
 
xrt_result_t ipc_handle_space_mark_ref_space_in_use (volatile struct ipc_client_state *ics, enum xrt_reference_space_type type)
 
xrt_result_t ipc_handle_space_unmark_ref_space_in_use (volatile struct ipc_client_state *ics, enum xrt_reference_space_type type)
 
xrt_result_t ipc_handle_space_recenter_local_spaces (volatile struct ipc_client_state *ics)
 
xrt_result_t ipc_handle_space_get_tracking_origin_offset (volatile struct ipc_client_state *ics, uint32_t origin_id, struct xrt_pose *out_offset)
 
xrt_result_t ipc_handle_space_set_tracking_origin_offset (volatile struct ipc_client_state *ics, uint32_t origin_id, const struct xrt_pose *offset)
 
xrt_result_t ipc_handle_space_get_reference_space_offset (volatile struct ipc_client_state *ics, enum xrt_reference_space_type type, struct xrt_pose *out_offset)
 
xrt_result_t ipc_handle_space_set_reference_space_offset (volatile struct ipc_client_state *ics, enum xrt_reference_space_type type, const struct xrt_pose *offset)
 
xrt_result_t ipc_handle_compositor_get_info (volatile struct ipc_client_state *ics, struct xrt_compositor_info *out_info)
 
xrt_result_t ipc_handle_compositor_predict_frame (volatile struct ipc_client_state *ics, int64_t *out_frame_id, int64_t *out_wake_up_time_ns, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns)
 
xrt_result_t ipc_handle_compositor_wait_woke (volatile struct ipc_client_state *ics, int64_t frame_id)
 
xrt_result_t ipc_handle_compositor_begin_frame (volatile struct ipc_client_state *ics, int64_t frame_id)
 
xrt_result_t ipc_handle_compositor_discard_frame (volatile struct ipc_client_state *ics, int64_t frame_id)
 
xrt_result_t ipc_handle_compositor_get_display_refresh_rate (volatile struct ipc_client_state *ics, float *out_display_refresh_rate_hz)
 
xrt_result_t ipc_handle_compositor_request_display_refresh_rate (volatile struct ipc_client_state *ics, float display_refresh_rate_hz)
 
xrt_result_t ipc_handle_compositor_set_performance_level (volatile struct ipc_client_state *ics, enum xrt_perf_domain domain, enum xrt_perf_set_level level)
 
static bool _update_projection_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_projection_layer_depth (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool do_single (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i, const char *name, struct xrt_device **out_xdev, struct xrt_swapchain **out_xcs, struct xrt_layer_data **out_data)
 
static bool _update_quad_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_cube_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_cylinder_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_equirect1_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_equirect2_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_passthrough_layer (struct xrt_compositor *xc, volatile struct ipc_client_state *ics, volatile struct ipc_layer_entry *layer, uint32_t i)
 
static bool _update_layers (volatile struct ipc_client_state *ics, struct xrt_compositor *xc, struct ipc_layer_slot *slot)
 
xrt_result_t ipc_handle_compositor_layer_sync (volatile struct ipc_client_state *ics, uint32_t slot_id, uint32_t *out_free_slot_id, const xrt_graphics_sync_handle_t *handles, const uint32_t handle_count)
 
xrt_result_t ipc_handle_compositor_layer_sync_with_semaphore (volatile struct ipc_client_state *ics, uint32_t slot_id, uint32_t semaphore_id, uint64_t semaphore_value, uint32_t *out_free_slot_id)
 
xrt_result_t ipc_handle_compositor_create_passthrough (volatile struct ipc_client_state *ics, const struct xrt_passthrough_create_info *info)
 
xrt_result_t ipc_handle_compositor_create_passthrough_layer (volatile struct ipc_client_state *ics, const struct xrt_passthrough_layer_create_info *info)
 
xrt_result_t ipc_handle_compositor_destroy_passthrough (volatile struct ipc_client_state *ics)
 
xrt_result_t ipc_handle_compositor_set_thread_hint (volatile struct ipc_client_state *ics, enum xrt_thread_hint hint, uint32_t thread_id)
 
xrt_result_t ipc_handle_compositor_get_reference_bounds_rect (volatile struct ipc_client_state *ics, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds)
 
xrt_result_t ipc_handle_system_get_clients (volatile struct ipc_client_state *_ics, struct ipc_client_list *list)
 
xrt_result_t ipc_handle_system_get_properties (volatile struct ipc_client_state *_ics, struct xrt_system_properties *out_properties)
 
xrt_result_t ipc_handle_system_get_client_info (volatile struct ipc_client_state *_ics, uint32_t client_id, struct ipc_app_state *out_ias)
 
xrt_result_t ipc_handle_system_set_primary_client (volatile struct ipc_client_state *_ics, uint32_t client_id)
 
xrt_result_t ipc_handle_system_set_focused_client (volatile struct ipc_client_state *ics, uint32_t client_id)
 
xrt_result_t ipc_handle_system_toggle_io_client (volatile struct ipc_client_state *_ics, uint32_t client_id)
 
xrt_result_t ipc_handle_system_toggle_io_device (volatile struct ipc_client_state *ics, uint32_t device_id)
 
xrt_result_t ipc_handle_swapchain_get_properties (volatile struct ipc_client_state *ics, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
 
xrt_result_t ipc_handle_swapchain_create (volatile struct ipc_client_state *ics, const struct xrt_swapchain_create_info *info, uint32_t *out_id, uint32_t *out_image_count, uint64_t *out_size, bool *out_use_dedicated_allocation, uint32_t max_handle_capacity, xrt_graphics_buffer_handle_t *out_handles, uint32_t *out_handle_count)
 
xrt_result_t ipc_handle_swapchain_import (volatile struct ipc_client_state *ics, const struct xrt_swapchain_create_info *info, const struct ipc_arg_swapchain_from_native *args, uint32_t *out_id, const xrt_graphics_buffer_handle_t *handles, uint32_t handle_count)
 
xrt_result_t ipc_handle_swapchain_wait_image (volatile struct ipc_client_state *ics, uint32_t id, int64_t timeout_ns, uint32_t index)
 
xrt_result_t ipc_handle_swapchain_acquire_image (volatile struct ipc_client_state *ics, uint32_t id, uint32_t *out_index)
 
xrt_result_t ipc_handle_swapchain_release_image (volatile struct ipc_client_state *ics, uint32_t id, uint32_t index)
 
xrt_result_t ipc_handle_swapchain_destroy (volatile struct ipc_client_state *ics, uint32_t id)
 
xrt_result_t ipc_handle_compositor_semaphore_create (volatile struct ipc_client_state *ics, uint32_t *out_id, uint32_t max_handle_count, xrt_graphics_sync_handle_t *out_handles, uint32_t *out_handle_count)
 
xrt_result_t ipc_handle_compositor_semaphore_destroy (volatile struct ipc_client_state *ics, uint32_t id)
 
xrt_result_t ipc_handle_device_update_input (volatile struct ipc_client_state *ics, uint32_t id)
 
static struct xrt_inputfind_input (volatile struct ipc_client_state *ics, uint32_t device_id, enum xrt_input_name name)
 
xrt_result_t ipc_handle_device_get_tracked_pose (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_input_name name, int64_t at_timestamp, struct xrt_space_relation *out_relation)
 
xrt_result_t ipc_handle_device_get_hand_tracking (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_input_name name, int64_t at_timestamp, struct xrt_hand_joint_set *out_value, int64_t *out_timestamp)
 
xrt_result_t ipc_handle_device_get_view_poses (volatile struct ipc_client_state *ics, uint32_t id, const struct xrt_vec3 *fallback_eye_relation, int64_t at_timestamp_ns, uint32_t view_count)
 
xrt_result_t ipc_handle_device_get_view_poses_2 (volatile struct ipc_client_state *ics, uint32_t id, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, uint32_t view_count, struct ipc_info_get_view_poses_2 *out_info)
 
xrt_result_t ipc_handle_device_compute_distortion (volatile struct ipc_client_state *ics, uint32_t id, uint32_t view, float u, float v, bool *out_ret, struct xrt_uv_triplet *out_triplet)
 
xrt_result_t ipc_handle_device_set_output (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_output_name name, const union xrt_output_value *value)
 
xrt_result_t ipc_handle_device_get_visibility_mask (volatile struct ipc_client_state *ics, uint32_t device_id, enum xrt_visibility_mask_type type, uint32_t view_index)
 
xrt_result_t ipc_handle_device_is_form_factor_available (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_form_factor form_factor, bool *out_available)
 
xrt_result_t ipc_handle_system_devices_get_roles (volatile struct ipc_client_state *ics, struct xrt_system_roles *out_roles)
 
xrt_result_t ipc_handle_system_devices_begin_feature (volatile struct ipc_client_state *ics, enum xrt_device_feature_type type)
 
xrt_result_t ipc_handle_system_devices_end_feature (volatile struct ipc_client_state *ics, enum xrt_device_feature_type type)
 
xrt_result_t ipc_handle_device_get_face_tracking (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set *out_value)
 
xrt_result_t ipc_handle_device_get_body_skeleton (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_input_name body_tracking_type, struct xrt_body_skeleton *out_value)
 
xrt_result_t ipc_handle_device_get_body_joints (volatile struct ipc_client_state *ics, uint32_t id, enum xrt_input_name body_tracking_type, int64_t desired_timestamp_ns, struct xrt_body_joint_set *out_value)
 
xrt_result_t ipc_handle_device_get_battery_status (volatile struct ipc_client_state *ics, uint32_t id, bool *out_present, bool *out_charging, float *out_charge)
 

Detailed Description

Macro Definition Documentation

◆ CREATE

#define CREATE (   NAME)
Value:
do { \
*out_##NAME##_id = UINT32_MAX; \
if (xso->semantic.NAME == NULL) { \
break; \
} \
uint32_t id = 0; \
xrt_result_t xret = track_space(ics, xso->semantic.NAME, &id); \
if (xret != XRT_SUCCESS) { \
break; \
} \
*out_##NAME##_id = id; \
} while (false)
@ XRT_SUCCESS
The operation succeeded.
Definition: xrt_results.h:26

Function Documentation

◆ ipc_handle_session_begin()

xrt_result_t ipc_handle_session_begin ( volatile struct ipc_client_state ics)
Todo:
Pass the view type down.

◆ ipc_handle_swapchain_acquire_image()

xrt_result_t ipc_handle_swapchain_acquire_image ( volatile struct ipc_client_state ics,
uint32_t  id,
uint32_t *  out_index 
)
Todo:
Look up the index.

References ipc_client_state::xc, and XRT_ERROR_IPC_SESSION_NOT_CREATED.

◆ ipc_handle_swapchain_release_image()

xrt_result_t ipc_handle_swapchain_release_image ( volatile struct ipc_client_state ics,
uint32_t  id,
uint32_t  index 
)
Todo:
Look up the index.

References ipc_client_state::xc, and XRT_ERROR_IPC_SESSION_NOT_CREATED.

◆ ipc_handle_swapchain_wait_image()

xrt_result_t ipc_handle_swapchain_wait_image ( volatile struct ipc_client_state ics,
uint32_t  id,
int64_t  timeout_ns,
uint32_t  index 
)
Todo:
Look up the index.

References ipc_client_state::xc, and XRT_ERROR_IPC_SESSION_NOT_CREATED.