Monado OpenXR Runtime
comp_compositor Struct Reference

Main compositor struct tying everything in the compositor together. More...

#include <main/comp_compositor.h>

Inheritance diagram for comp_compositor:
Collaboration diagram for comp_compositor:

Data Fields

struct comp_base base
 
struct comp_settings settings
 The settings. More...
 
struct xrt_devicexdev
 The device we are displaying to. More...
 
struct render_shaders shaders
 Vulkan shaders that the compositor (renderer) uses. More...
 
struct render_resources nr
 Vulkan resources that the compositor (renderer) uses. More...
 
const struct comp_target_factorytarget_factory
 The selected target factory that we create our target from. More...
 
struct comp_targettarget
 The target we are displaying to. More...
 
struct comp_rendererr
 Renderer helper. More...
 
int64_t last_frame_time_ns
 Timestamp of last-rendered (immersive) frame. More...
 
VkExtent2D view_extents
 
bool mirroring_to_debug_gui
 Are we mirroring any of the views to the debug gui? If so, turn off the fast path. More...
 
struct comp_window_peekpeek
 On screen window to display the content of the HMD. More...
 
struct {
   int64_t   last_begin
 
   int64_t   last_end
 
app_profiling
 Data exclusive to the begin_frame/end_frame for computing an estimate of the app's needs. More...
 
struct u_frame_times_widget compositor_frame_times
 
struct {
   struct comp_frame   waited
 
   struct comp_frame   rendering
 
frame
 
struct {
   struct comp_scratch_single_images   views [2]
 
scratch
 
struct {
   bool   atw_off
 Temporarily disable ATW. More...
 
   bool   disable_fast_path
 Should the fast path be disabled. More...
 
   struct u_swapchain_debug   sc
 
debug
 
bool deferred_surface
 If true, part of the compositor startup will be delayed until a session is started. More...
 
- Data Fields inherited from comp_base
struct xrt_compositor_native base
 Base native compositor. More...
 
struct vk_bundle vk
 Vulkan bundle of useful things, used by swapchain and fence. More...
 
struct os_precise_sleeper sleeper
 For default xrt_compositor::wait_frame. More...
 
struct comp_swapchain_shared cscs
 Swapchain garbage collector, used by swapchain, child class needs to call. More...
 
struct comp_layer_accum layer_accum
 Collect layers for a single frame. More...
 
struct comp_frame_params frame_params
 Parameters for a single frame. More...
 
- Data Fields inherited from xrt_compositor_native
struct xrt_compositor base
 Base. More...
 
- Data Fields inherited from xrt_compositor
struct xrt_compositor_info info
 Capabilities and recommended values information. More...
 
xrt_result_t(* get_swapchain_create_properties )(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
 For a given xrt_swapchain_create_info struct returns a filled out xrt_swapchain_create_properties. More...
 
xrt_result_t(* create_passthrough )(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
 Create a passthrough. More...
 
xrt_result_t(* create_passthrough_layer )(struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info)
 Create a passthrough layer. More...
 
xrt_result_t(* destroy_passthrough )(struct xrt_compositor *xc)
 Destroy a passthrough. More...
 
xrt_result_t(* set_performance_level )(struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level)
 Set CPU/GPU performance level. More...
 
xrt_result_t(* get_reference_bounds_rect )(struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds)
 Get the extents of the reference space's bounds rectangle. More...
 
void(* destroy )(struct xrt_compositor *xc)
 Teardown the compositor. More...
 
xrt_result_t(* create_swapchain )(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
 Create a swapchain with a set of images. More...
 
xrt_result_t(* 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)
 Create a swapchain from a set of native images. More...
 
xrt_result_t(* import_fence )(struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf)
 Create a compositor fence from a native sync handle. More...
 
xrt_result_t(* create_semaphore )(struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
 Create a compositor semaphore, also returns a native handle. More...
 
xrt_result_t(* begin_session )(struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
 See xrBeginSession. More...
 
xrt_result_t(* end_session )(struct xrt_compositor *xc)
 See xrEndSession, unlike the OpenXR one the state tracker is responsible to call discard frame before calling this function. More...
 
xrt_result_t(* 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)
 This function and mark_frame function calls are a alternative to wait_frame. More...
 
xrt_result_t(* mark_frame )(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
 This function and predict_frame function calls are a alternative to wait_frame. More...
 
xrt_result_t(* wait_frame )(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period)
 See xrWaitFrame. More...
 
xrt_result_t(* begin_frame )(struct xrt_compositor *xc, int64_t frame_id)
 See xrBeginFrame. More...
 
xrt_result_t(* discard_frame )(struct xrt_compositor *xc, int64_t frame_id)
 Explicitly discard a frame. More...
 
xrt_result_t(* layer_begin )(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
 Begins layer submission. More...
 
xrt_result_t(* layer_projection )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
 Adds a projection layer for submissions. More...
 
xrt_result_t(* 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)
 Adds a projection layer for submission, has depth information. More...
 
xrt_result_t(* layer_quad )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a quad layer for submission, the center of the quad is specified by the pose and extends outwards from it. More...
 
xrt_result_t(* layer_cube )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a cube layer for submission. More...
 
xrt_result_t(* layer_cylinder )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a cylinder layer for submission. More...
 
xrt_result_t(* layer_equirect1 )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a equirect1 layer for submission. More...
 
xrt_result_t(* layer_equirect2 )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a equirect2 layer for submission. More...
 
xrt_result_t(* layer_passthrough )(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
 Adds a passthrough layer for submission. More...
 
xrt_result_t(* layer_commit )(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
 Commits all of the submitted layers. More...
 
xrt_result_t(* layer_commit_with_semaphore )(struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value)
 Commits all of the submitted layers, with a semaphore. More...
 
xrt_result_t(* get_display_refresh_rate )(struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
 Get the current display refresh rate. More...
 
xrt_result_t(* request_display_refresh_rate )(struct xrt_compositor *xc, float display_refresh_rate_hz)
 Request system to change the display refresh rate to the requested value. More...
 
xrt_result_t(* set_thread_hint )(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
 Set thread attributes according to thread type. More...
 

Related Functions

(Note that these are not member functions.)

#define CVK_ERROR(C, FUNC, MSG, RET)   COMP_ERROR(C, FUNC ": %s\n\t" MSG, vk_result_string(RET));
 Helper define for printing Vulkan errors. More...
 
#define COMP_SPEW(c, ...)   U_LOG_IFL_T(c->settings.log_level, __VA_ARGS__);
 Spew level logging. More...
 
#define COMP_DEBUG(c, ...)   U_LOG_IFL_D(c->settings.log_level, __VA_ARGS__);
 Debug level logging. More...
 
#define COMP_INFO(c, ...)   U_LOG_IFL_I(c->settings.log_level, __VA_ARGS__);
 Info level logging. More...
 
#define COMP_WARN(c, ...)   U_LOG_IFL_W(c->settings.log_level, __VA_ARGS__);
 Warn level logging. More...
 
#define COMP_ERROR(c, ...)   U_LOG_IFL_E(c->settings.log_level, __VA_ARGS__);
 Error level logging. More...
 
#define COMP_PRINT_MODE(c, ...)
 Mode printing. More...
 

Additional Inherited Members

- Public Member Functions inherited from xrt_compositor_native
struct xrt_compositor_d3d11xrt_gfx_d3d11_provider_create (struct xrt_compositor_native *xcn, ID3D11Device *device)
 Create a D3D11 compositor client. More...
 
struct xrt_compositor_d3d12xrt_gfx_d3d12_provider_create (struct xrt_compositor_native *xcn, ID3D12Device *device, ID3D12CommandQueue *queue)
 Create a D3D12 compositor client. More...
 
xrt_result_t xrt_gfx_provider_create_gl_egl (struct xrt_compositor_native *xcn, EGLDisplay display, EGLConfig config, EGLContext context, PFNEGLGETPROCADDRESSPROC get_gl_procaddr, bool renderdoc_enabled, struct xrt_compositor_gl **out_xcgl)
 Create an OpenGL(ES) compositor client using EGL. More...
 
struct xrt_compositor_vkxrt_gfx_vk_provider_create (struct xrt_compositor_native *xcn, VkInstance instance, PFN_vkGetInstanceProcAddr get_instance_proc_addr, VkPhysicalDevice physical_device, VkDevice device, bool external_fence_fd_enabled, bool external_semaphore_fd_enabled, bool timeline_semaphore_enabled, bool image_format_list_enabled, bool debug_utils_enabled, bool renderdoc_enabled, uint32_t queue_family_index, uint32_t queue_index)
 Create a Vulkan compositor client. More...
 
struct xrt_compositor_glxrt_gfx_provider_create_gl_win32 (struct xrt_compositor_native *xcn, void *hDC, void *hGLRC)
 Create an OpenGL compositor client using Win32. More...
 
struct xrt_compositor_glxrt_gfx_provider_create_gl_xlib (struct xrt_compositor_native *xcn, Display *xDisplay, uint32_t visualid, GLXFBConfig glxFBConfig, GLXDrawable glxDrawable, GLXContext glxContext)
 Create an OpenGL compositor client using xlib. More...
 
- Static Public Member Functions inherited from xrt_compositor_native
static xrt_result_t xrt_comp_native_create_swapchain (struct xrt_compositor_native *xcn, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_native **out_xscn)
 Create a native swapchain with a set of images. More...
 
static void xrt_comp_native_destroy (struct xrt_compositor_native **xcn_ptr)
 Teardown the compositor. More...
 
- Static Public Member Functions inherited from xrt_compositor
static xrt_result_t xrt_comp_get_swapchain_create_properties (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
 For a given xrt_swapchain_create_info struct returns a filled out xrt_swapchain_create_properties. More...
 
static xrt_result_t xrt_comp_create_passthrough (struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
 Create a passthrough. More...
 
static xrt_result_t xrt_comp_create_passthrough_layer (struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info)
 Create a passthrough layer. More...
 
static xrt_result_t xrt_comp_destroy_passthrough (struct xrt_compositor *xc)
 Destroy a passthrough. More...
 
static xrt_result_t xrt_comp_get_display_refresh_rate (struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
 Get the current display refresh rate. More...
 
static xrt_result_t xrt_comp_request_display_refresh_rate (struct xrt_compositor *xc, float display_refresh_rate_hz)
 Request system to change the display refresh rate to the requested value. More...
 
static xrt_result_t xrt_comp_set_performance_level (struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level)
 Set CPU/GPU performance level. More...
 
static xrt_result_t xrt_comp_get_reference_bounds_rect (struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds)
 Get the extents of the reference space's bounds rectangle. More...
 
static void xrt_comp_destroy (struct xrt_compositor **xc_ptr)
 Teardown the compositor. More...
 
static xrt_result_t xrt_comp_create_swapchain (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
 Create a swapchain with a set of images. More...
 
static xrt_result_t xrt_comp_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)
 Create a swapchain from a set of native images. More...
 
static xrt_result_t xrt_comp_import_fence (struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf)
 Create a compositor fence from a native sync handle. More...
 
static xrt_result_t xrt_comp_create_semaphore (struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
 Create a compositor semaphore, also returns a native handle. More...
 
static xrt_result_t xrt_comp_begin_session (struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
 See xrBeginSession. More...
 
static xrt_result_t xrt_comp_end_session (struct xrt_compositor *xc)
 See xrEndSession, unlike the OpenXR one the state tracker is responsible to call discard frame before calling this function. More...
 
static xrt_result_t xrt_comp_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)
 This function and mark_frame function calls are a alternative to wait_frame. More...
 
static xrt_result_t xrt_comp_mark_frame (struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
 This function and predict_frame function calls are a alternative to wait_frame. More...
 
static xrt_result_t xrt_comp_wait_frame (struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period)
 See xrWaitFrame. More...
 
static xrt_result_t xrt_comp_begin_frame (struct xrt_compositor *xc, int64_t frame_id)
 See xrBeginFrame. More...
 
static xrt_result_t xrt_comp_discard_frame (struct xrt_compositor *xc, int64_t frame_id)
 Explicitly discard a frame. More...
 
static xrt_result_t xrt_comp_layer_begin (struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
 Begins layer submission. More...
 
static xrt_result_t xrt_comp_layer_projection (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
 Adds a projection layer for submissions. More...
 
static xrt_result_t xrt_comp_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)
 Adds a projection layer for submission, has depth information. More...
 
static xrt_result_t xrt_comp_layer_quad (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a quad layer for submission, the center of the quad is specified by the pose and extends outwards from it. More...
 
static xrt_result_t xrt_comp_layer_cube (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a cube layer for submission. More...
 
static xrt_result_t xrt_comp_layer_cylinder (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a cylinder layer for submission. More...
 
static xrt_result_t xrt_comp_layer_equirect1 (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a equirect1 layer for submission. More...
 
static xrt_result_t xrt_comp_layer_equirect2 (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
 Adds a equirect2 layer for submission. More...
 
static xrt_result_t xrt_comp_layer_passthrough (struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
 Adds a passthrough layer for submission. More...
 
static xrt_result_t xrt_comp_layer_commit (struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
 Commits all of the submitted layers. More...
 
static xrt_result_t xrt_comp_layer_commit_with_semaphore (struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value)
 Commits all of the submitted layers, with a semaphore. More...
 
- Protected Member Functions inherited from comp_base
void comp_base_init (struct comp_base *cb)
 Inits all of the supported functions and structs, except vk_bundle. More...
 

Detailed Description

Main compositor struct tying everything in the compositor together.

This ultimately implements xrt_compositor_native but does so by extending comp_base. Yes, it looks like a little bit of "code reuse through inheritance," but it is useful here to avoid lots of boilerplate due to the use of C.

Friends And Related Function Documentation

◆ COMP_DEBUG

#define COMP_DEBUG (   c,
  ... 
)    U_LOG_IFL_D(c->settings.log_level, __VA_ARGS__);
related

Debug level logging.

Referenced by renderer_create_renderings_and_fences().

◆ COMP_ERROR

#define COMP_ERROR (   c,
  ... 
)    U_LOG_IFL_E(c->settings.log_level, __VA_ARGS__);
related

Error level logging.

Referenced by renderer_create_renderings_and_fences().

◆ COMP_INFO

#define COMP_INFO (   c,
  ... 
)    U_LOG_IFL_I(c->settings.log_level, __VA_ARGS__);
related

◆ COMP_PRINT_MODE

#define COMP_PRINT_MODE (   c,
  ... 
)
related
Value:
if (c->settings.print_modes) { \
U_LOG_I(__VA_ARGS__); \
}

Mode printing.

◆ COMP_SPEW

#define COMP_SPEW (   c,
  ... 
)    U_LOG_IFL_T(c->settings.log_level, __VA_ARGS__);
related

Spew level logging.

◆ COMP_WARN

#define COMP_WARN (   c,
  ... 
)    U_LOG_IFL_W(c->settings.log_level, __VA_ARGS__);
related

Warn level logging.

◆ CVK_ERROR

#define CVK_ERROR (   C,
  FUNC,
  MSG,
  RET 
)    COMP_ERROR(C, FUNC ": %s\n\t" MSG, vk_result_string(RET));
related

Helper define for printing Vulkan errors.

Field Documentation

◆ 

struct { ... } comp_compositor::app_profiling

Data exclusive to the begin_frame/end_frame for computing an estimate of the app's needs.

◆ atw_off

bool comp_compositor::atw_off

Temporarily disable ATW.

◆ deferred_surface

bool comp_compositor::deferred_surface

If true, part of the compositor startup will be delayed until a session is started.

◆ disable_fast_path

bool comp_compositor::disable_fast_path

Should the fast path be disabled.

◆ last_frame_time_ns

int64_t comp_compositor::last_frame_time_ns

Timestamp of last-rendered (immersive) frame.

◆ mirroring_to_debug_gui

bool comp_compositor::mirroring_to_debug_gui

Are we mirroring any of the views to the debug gui? If so, turn off the fast path.

Referenced by comp_mirror_to_debug_gui::comp_mirror_is_ready_and_active().

◆ nr

struct render_resources comp_compositor::nr

Vulkan resources that the compositor (renderer) uses.

Referenced by renderer_create_renderings_and_fences().

◆ peek

struct comp_window_peek* comp_compositor::peek

On screen window to display the content of the HMD.

◆ r

struct comp_renderer* comp_compositor::r

◆ settings

struct comp_settings comp_compositor::settings

◆ shaders

struct render_shaders comp_compositor::shaders

Vulkan shaders that the compositor (renderer) uses.

◆ target

struct comp_target* comp_compositor::target

The target we are displaying to.

Referenced by renderer_create_renderings_and_fences().

◆ target_factory

const struct comp_target_factory* comp_compositor::target_factory

The selected target factory that we create our target from.

◆ xdev

struct xrt_device* comp_compositor::xdev

The device we are displaying to.


The documentation for this struct was generated from the following file: