Monado OpenXR Runtime
comp_multi_compositor.c File Reference

Multi client wrapper compositor. More...

#include "xrt/xrt_session.h"
#include "os/os_time.h"
#include "util/u_var.h"
#include "util/u_wait.h"
#include "util/u_misc.h"
#include "util/u_time.h"
#include "util/u_debug.h"
#include "util/u_handles.h"
#include "util/u_trace_marker.h"
#include "util/u_distortion_mesh.h"
#include "multi/comp_multi_private.h"
#include <math.h>
#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for comp_multi_compositor.c:

Functions

static void slot_clear_locked (struct multi_compositor *mc, struct multi_layer_slot *slot)
 Clear a slot, need to have the list_and_timing_lock held. More...
 
static void slot_move_into_cleared (struct multi_layer_slot *dst, struct multi_layer_slot *src)
 Clear a slot, need to have the list_and_timing_lock held. More...
 
static void slot_move_and_clear_locked (struct multi_compositor *mc, struct multi_layer_slot *dst, struct multi_layer_slot *src)
 Move a slot into a cleared slot, must be cleared before. More...
 
xrt_result_t multi_compositor_push_event (struct multi_compositor *mc, const union xrt_session_event *xse)
 
static bool is_pushed_or_waiting_locked (struct multi_compositor *mc)
 
static void wait_fence (struct xrt_compositor_fence **xcf_ptr)
 
static void wait_semaphore (struct xrt_compositor_semaphore **xcsem_ptr, uint64_t value)
 
static void wait_for_scheduled_free (struct multi_compositor *mc)
 
static void * run_func (void *ptr)
 
static void wait_for_wait_thread_locked (struct multi_compositor *mc)
 
static void wait_for_wait_thread (struct multi_compositor *mc)
 
static void push_fence_to_wait_thread (struct multi_compositor *mc, int64_t frame_id, struct xrt_compositor_fence *xcf)
 
static void push_semaphore_to_wait_thread (struct multi_compositor *mc, int64_t frame_id, struct xrt_compositor_semaphore *xcsem, uint64_t value)
 
static xrt_result_t multi_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 multi_compositor_create_swapchain (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
 
static xrt_result_t multi_compositor_import_swapchain (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 multi_compositor_import_fence (struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf)
 
static xrt_result_t multi_compositor_create_semaphore (struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
 
static xrt_result_t multi_compositor_begin_session (struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
 
static xrt_result_t multi_compositor_end_session (struct xrt_compositor *xc)
 
static xrt_result_t multi_compositor_predict_frame (struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_wake_time_ns, int64_t *out_predicted_gpu_time_ns, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns)
 
static xrt_result_t multi_compositor_mark_frame (struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
 
static xrt_result_t multi_compositor_wait_frame (struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns)
 
static xrt_result_t multi_compositor_begin_frame (struct xrt_compositor *xc, int64_t frame_id)
 
static xrt_result_t multi_compositor_discard_frame (struct xrt_compositor *xc, int64_t frame_id)
 
static xrt_result_t multi_compositor_layer_begin (struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
 
static xrt_result_t multi_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 multi_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 multi_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 multi_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 multi_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 multi_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 multi_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 multi_compositor_layer_commit (struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
 
static xrt_result_t multi_compositor_layer_commit_with_semaphore (struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value)
 
static xrt_result_t multi_compositor_set_thread_hint (struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
 
static xrt_result_t multi_compositor_get_display_refresh_rate (struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
 
static xrt_result_t multi_compositor_request_display_refresh_rate (struct xrt_compositor *xc, float display_refresh_rate_hz)
 
static void multi_compositor_destroy (struct xrt_compositor *xc)
 
static void log_frame_time_diff (int64_t frame_time_ns, int64_t display_time_ns)
 
void multi_compositor_deliver_any_frames (struct multi_compositor *mc, int64_t display_time_ns)
 
void multi_compositor_latch_frame_locked (struct multi_compositor *mc, int64_t when_ns, int64_t system_frame_id)
 
void multi_compositor_retire_delivered_locked (struct multi_compositor *mc, int64_t when_ns)
 
xrt_result_t multi_compositor_create (struct multi_system_compositor *msc, const struct xrt_session_info *xsi, struct xrt_session_event_sink *xses, struct xrt_compositor_native **out_xcn)
 Create a multi client wrapper compositor. More...
 

Detailed Description

Multi client wrapper 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

◆ multi_compositor_create()

xrt_result_t multi_compositor_create ( struct multi_system_compositor msc,
const struct xrt_session_info xsi,
struct xrt_session_event_sink xses,
struct xrt_compositor_native **  out_xcn 
)

Create a multi client wrapper compositor.

◆ multi_compositor_layer_commit()

static xrt_result_t multi_compositor_layer_commit ( struct xrt_compositor xc,
xrt_graphics_sync_handle_t  sync_handle 
)
static

If import_fence succeeded, we have transferred ownership to the compositor no need to do anything more. If the call failed we need to close the handle.

◆ slot_clear_locked()

static void slot_clear_locked ( struct multi_compositor mc,
struct multi_layer_slot slot 
)
static

◆ slot_move_and_clear_locked()

static void slot_move_and_clear_locked ( struct multi_compositor mc,
struct multi_layer_slot dst,
struct multi_layer_slot src 
)
static

Move a slot into a cleared slot, must be cleared before.

References slot_clear_locked(), and slot_move_into_cleared().

◆ slot_move_into_cleared()

static void slot_move_into_cleared ( struct multi_layer_slot dst,
struct multi_layer_slot src 
)
static

Clear a slot, need to have the list_and_timing_lock held.

References U_ZERO.

Referenced by slot_move_and_clear_locked().