Monado OpenXR Runtime
ipc_client_compositor.c File Reference

Client side wrapper of compositor. More...

#include "xrt/xrt_device.h"
#include "xrt/xrt_compositor.h"
#include "xrt/xrt_defines.h"
#include "xrt/xrt_config_os.h"
#include "os/os_time.h"
#include "util/u_misc.h"
#include "util/u_wait.h"
#include "util/u_handles.h"
#include "util/u_trace_marker.h"
#include "util/u_limited_unique_id.h"
#include "shared/ipc_protocol.h"
#include "client/ipc_client.h"
#include "ipc_client_generated.h"
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
#include <assert.h>
Include dependency graph for ipc_client_compositor.c:

Data Structures

struct  ipc_client_compositor
 Define to test the loopback allocator. More...
 
struct  ipc_client_swapchain
 Client proxy for an xrt_swapchain_native implementation over IPC. More...
 
struct  ipc_client_compositor_semaphore
 Client proxy for an xrt_compositor_semaphore implementation over IPC. More...
 

Functions

static struct ipc_client_compositoripc_client_compositor (struct xrt_compositor *xc)
 
static struct ipc_client_swapchainipc_client_swapchain (struct xrt_swapchain *xs)
 
static struct ipc_client_compositor_semaphoreipc_client_compositor_semaphore (struct xrt_compositor_semaphore *xcsem)
 
static xrt_result_t get_info (struct xrt_compositor *xc, struct xrt_compositor_info *out_info)
 
static xrt_result_t get_system_info (struct ipc_client_compositor *icc, struct xrt_system_compositor_info *out_info)
 
static void ipc_compositor_swapchain_destroy (struct xrt_swapchain *xsc)
 
static xrt_result_t ipc_compositor_swapchain_wait_image (struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
 
static xrt_result_t ipc_compositor_swapchain_acquire_image (struct xrt_swapchain *xsc, uint32_t *out_index)
 
static xrt_result_t ipc_compositor_swapchain_release_image (struct xrt_swapchain *xsc, uint32_t index)
 
static xrt_result_t ipc_client_compositor_semaphore_wait (struct xrt_compositor_semaphore *xcsem, uint64_t value, uint64_t timeout_ns)
 
static void ipc_client_compositor_semaphore_destroy (struct xrt_compositor_semaphore *xcsem)
 
static xrt_result_t ipc_compositor_get_swapchain_create_properties (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
 
static xrt_result_t swapchain_server_create (struct ipc_client_compositor *icc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
 
static xrt_result_t swapchain_server_import (struct ipc_client_compositor *icc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_swapchain **out_xsc)
 
static xrt_result_t swapchain_allocator_create (struct ipc_client_compositor *icc, struct xrt_image_native_allocator *xina, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
 
static xrt_result_t ipc_compositor_swapchain_create (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
 
static xrt_result_t ipc_compositor_create_passthrough (struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
 
static xrt_result_t ipc_compositor_create_passthrough_layer (struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info)
 
static xrt_result_t ipc_compositor_destroy_passthrough (struct xrt_compositor *xc)
 
static xrt_result_t ipc_compositor_swapchain_import (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_swapchain **out_xsc)
 
static xrt_result_t ipc_compositor_semaphore_create (struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
 
static xrt_result_t ipc_compositor_begin_session (struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
 
static xrt_result_t ipc_compositor_end_session (struct xrt_compositor *xc)
 
static xrt_result_t ipc_compositor_wait_frame (struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period)
 
static xrt_result_t ipc_compositor_begin_frame (struct xrt_compositor *xc, int64_t frame_id)
 
static xrt_result_t ipc_compositor_layer_begin (struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
 
static xrt_result_t ipc_compositor_layer_projection (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_projection_depth (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
 
static xrt_result_t handle_layer (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data, enum xrt_layer_type type)
 
static xrt_result_t ipc_compositor_layer_quad (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_cube (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_cylinder (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_equirect1 (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_equirect2 (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_passthrough (struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
 
static xrt_result_t ipc_compositor_layer_commit (struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
 
static xrt_result_t ipc_compositor_layer_commit_with_semaphore (struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value)
 
static xrt_result_t ipc_compositor_discard_frame (struct xrt_compositor *xc, int64_t frame_id)
 
static xrt_result_t ipc_compositor_set_performance_level (struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level)
 
static xrt_result_t ipc_compositor_set_thread_hint (struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
 
static xrt_result_t ipc_compositor_get_display_refresh_rate (struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
 
static xrt_result_t ipc_compositor_request_display_refresh_rate (struct xrt_compositor *xc, float display_refresh_rate_hz)
 
static xrt_result_t ipc_compositor_get_reference_bounds_rect (struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds)
 
static void ipc_compositor_destroy (struct xrt_compositor *xc)
 
static void ipc_compositor_init (struct ipc_client_compositor *icc, struct xrt_compositor_native **out_xcn)
 
xrt_result_t ipc_syscomp_create_native_compositor (struct xrt_system_compositor *xsc, const struct xrt_session_info *xsi, struct xrt_session_event_sink *xses, struct xrt_compositor_native **out_xcn)
 
void ipc_syscomp_destroy (struct xrt_system_compositor *xsc)
 
xrt_result_t ipc_client_create_native_compositor (struct xrt_system_compositor *xsysc, const struct xrt_session_info *xsi, struct xrt_compositor_native **out_xcn)
 Create a native compositor from a system compositor, this is used instead of the normal xrt_system_compositor::create_native_compositor function because it doesn't support events being generated on the app side. More...
 
xrt_result_t ipc_client_create_system_compositor (struct ipc_connection *ipc_c, struct xrt_image_native_allocator *xina, struct xrt_device *xdev, struct xrt_system_compositor **out_xcs)
 Create an IPC client system compositor. More...
 

Detailed Description

Client side wrapper of compositor.

Author
Pete Black pblac.nosp@m.k@co.nosp@m.llabo.nosp@m.ra.c.nosp@m.om
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ handle_layer()

static xrt_result_t handle_layer ( struct xrt_compositor xc,
struct xrt_device xdev,
struct xrt_swapchain xsc,
const struct xrt_layer_data data,
enum xrt_layer_type  type 
)
static
Todo:
Real id.

◆ ipc_client_create_native_compositor()

xrt_result_t ipc_client_create_native_compositor ( struct xrt_system_compositor xsysc,
const struct xrt_session_info xsi,
struct xrt_compositor_native **  out_xcn 
)

Create a native compositor from a system compositor, this is used instead of the normal xrt_system_compositor::create_native_compositor function because it doesn't support events being generated on the app side.

This will also create the session on the service side.

Parameters
xsyscIPC created system compositor.
xsiSession information struct.
[out]out_xcnPointer to receive the created xrt_compositor_native.

References ipc_client_compositor::compositor_created, container_of, IPC_CHK_AND_RET, ipc_client_compositor::system, and XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.

◆ ipc_client_create_system_compositor()

xrt_result_t ipc_client_create_system_compositor ( struct ipc_connection ipc_c,
struct xrt_image_native_allocator xina,
struct xrt_device xdev,
struct xrt_system_compositor **  out_xcs 
)

Create an IPC client system compositor.

It owns a special implementation of the xrt_system_compositor interface.

This actually creates an IPC client "native" compositor with deferred initialization. The ipc_client_create_native_compositor function actually completes the deferred initialization of the compositor, effectively finishing creation of a compositor IPC proxy.

Parameters
ipc_cIPC connection
xinaOptional native image allocator for client-side allocation. Takes ownership if one is supplied.
xdevTaken in but not used currently
Todo:
remove this param?
Parameters
[out]out_xcsPointer to receive the created xrt_system_compositor.

References xrt_system_compositor::create_native_compositor, ipc_client_compositor::system, and U_TYPED_CALLOC.

◆ ipc_compositor_layer_passthrough()

static xrt_result_t ipc_compositor_layer_passthrough ( struct xrt_compositor xc,
struct xrt_device xdev,
const struct xrt_layer_data data 
)
static
Todo:
Real id.

◆ ipc_compositor_layer_projection()

static xrt_result_t ipc_compositor_layer_projection ( struct xrt_compositor xc,
struct xrt_device xdev,
struct xrt_swapchain xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data data 
)
static
Todo:
Real id.

◆ ipc_compositor_layer_projection_depth()

static xrt_result_t ipc_compositor_layer_projection_depth ( struct xrt_compositor xc,
struct xrt_device xdev,
struct xrt_swapchain xsc[XRT_MAX_VIEWS],
struct xrt_swapchain d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data data 
)
static
Todo:
Real id.

◆ ipc_syscomp_destroy()