|
Monado OpenXR Runtime
|
Compositor rendering code. More...
#include "render/render_interface.h"#include "xrt/xrt_defines.h"#include "xrt/xrt_frame.h"#include "xrt/xrt_compositor.h"#include "xrt/xrt_results.h"#include "os/os_time.h"#include "math/m_api.h"#include "math/m_matrix_2x2.h"#include "math/m_space.h"#include "util/u_misc.h"#include "util/u_trace_marker.h"#include "util/u_distortion_mesh.h"#include "util/u_sink.h"#include "util/u_var.h"#include "util/u_frame_times_widget.h"#include "util/u_debug.h"#include "util/comp_render.h"#include "util/comp_high_level_render.h"#include "main/comp_frame.h"#include "main/comp_mirror_to_debug_gui.h"#include "vk/vk_helpers.h"#include "vk/vk_cmd.h"#include "vk/vk_image_readback_to_xf_pool.h"#include "vk/vk_submit_helpers.h"#include <string.h>#include <stdlib.h>#include <stdio.h>#include <assert.h>#include <math.h>
Data Structures | |
| struct | comp_renderer |
| Holds associated vulkan objects and state to render with a distortion. More... | |
Macros | |
| #define | LOG_FRAME_LAG(...) U_LOG_IFL(debug_get_log_option_comp_frame_lag_level(), u_log_get_global_level(), __VA_ARGS__) |
| #define | ADD_WAIT(LIST, SEMAPHORE, STAGE, IS_TIMELINE) |
| #define | ADD_SIGNAL(LIST, SEMAPHORE, IS_TIMELINE) |
Enumerations | |
| enum | comp_target_fov_source { COMP_TARGET_FOV_SOURCE_DISTORTION , COMP_TARGET_FOV_SOURCE_DEVICE_VIEWS } |
| What is the source of the FoV values used for the final image that the compositor produces and is sent to the hardware (or software). More... | |
Functions | |
| static void | renderer_wait_queue_idle (struct comp_renderer *r) |
| static void | calc_viewport_data (struct comp_renderer *r, struct render_viewport_data out_viewport_data[XRT_MAX_VIEWS], size_t view_count) |
| static void | calc_vertex_rot_data (struct comp_renderer *r, struct xrt_matrix_2x2 out_vertex_rots[XRT_MAX_VIEWS], size_t view_count) |
| static void | calc_pose_data (struct comp_renderer *r, enum comp_target_fov_source fov_source, struct xrt_fov out_fovs[XRT_MAX_VIEWS], struct xrt_pose out_world_scanout_begin[XRT_MAX_VIEWS], struct xrt_pose out_world_scanout_end[XRT_MAX_VIEWS], struct xrt_pose out_eye[XRT_MAX_VIEWS], uint32_t view_count) |
| static void | renderer_build_rendering_target_resources (struct comp_renderer *r, struct render_gfx_target_resources *rtr, uint32_t index) |
| static void | renderer_create_renderings_and_fences (struct comp_renderer *r) |
| static void | renderer_close_renderings_and_fences (struct comp_renderer *r) |
| static void | renderer_init (struct comp_renderer *r, struct comp_compositor *c, VkExtent2D scratch_extent) |
| Create renderer and initialize non-image-dependent members. | |
| static void | renderer_wait_for_last_fence (struct comp_renderer *r) |
| static bool | requires_present_acquire_wait (struct comp_renderer *r) |
| static XRT_CHECK_RESULT VkResult | renderer_submit_queue (struct comp_renderer *r, VkCommandBuffer cmd, VkPipelineStageFlags pipeline_stage_flag) |
| static void | renderer_acquire_swapchain_image (struct comp_renderer *r) |
| static void | renderer_resize (struct comp_renderer *r) |
| static bool | renderer_present_swapchain_image (struct comp_renderer *r, uint64_t desired_present_time_ns, uint64_t present_slop_ns) |
| static void | renderer_wait_for_present (struct comp_renderer *r, uint64_t desired_present_time_ns) |
| static void | renderer_fini (struct comp_renderer *r) |
| static XRT_CHECK_RESULT VkResult | dispatch_graphics (struct comp_renderer *r, struct render_gfx *render, struct chl_frame_state *frame_state, enum comp_target_fov_source fov_source) |
| static XRT_CHECK_RESULT VkResult | dispatch_compute (struct comp_renderer *r, struct render_compute *render, struct chl_frame_state *frame_state, enum comp_target_fov_source fov_source) |
| XRT_CHECK_RESULT xrt_result_t | comp_renderer_draw (struct comp_renderer *r) |
| struct comp_renderer * | comp_renderer_create (struct comp_compositor *c, VkExtent2D scratch_extent) |
| void | comp_renderer_destroy (struct comp_renderer **ptr_r) |
| void | comp_renderer_add_debug_vars (struct comp_renderer *self) |
Compositor rendering code.
| #define ADD_SIGNAL | ( | LIST, | |
| SEMAPHORE, | |||
| IS_TIMELINE | |||
| ) |
| #define ADD_WAIT | ( | LIST, | |
| SEMAPHORE, | |||
| STAGE, | |||
| IS_TIMELINE | |||
| ) |
What is the source of the FoV values used for the final image that the compositor produces and is sent to the hardware (or software).
| Enumerator | |
|---|---|
| COMP_TARGET_FOV_SOURCE_DISTORTION | The FoV values used for the final target is taken from the distortion information on the xrt_hmd_parts struct. |
| COMP_TARGET_FOV_SOURCE_DEVICE_VIEWS | The FoV values used for the final target is taken from the those returned from the device's get_views. |
|
static |
References u_pp_sink_stack_only::buffer, comp_renderer::c, COMP_TARGET_FOV_SOURCE_DEVICE_VIEWS, COMP_TARGET_FOV_SOURCE_DISTORTION, xrt_hmd_parts::distortion, xrt_hmd_parts::fov, comp_frame_params::fovs, comp_compositor::frame_interval_ns, xrt_device_compositor_mode::frame_interval_ns, comp_base::frame_params, xrt_device::hmd, xrt_relation_chain::m_relation_chain_push_pose_if_not_identity(), xrt_relation_chain::m_relation_chain_push_relation(), xrt_relation_chain::m_relation_chain_resolve(), comp_frame_params::poses, xrt_device_compositor_info::scanout_direction, xrt_device::supported, U_LOG_E, u_pp_xrt_result(), comp_compositor::xdev, xrt_space_relation::XRT_SPACE_RELATION_ZERO, XRT_STRUCT_INIT, and XRT_SUCCESS.
Referenced by dispatch_compute(), and dispatch_graphics().
| XRT_CHECK_RESULT xrt_result_t comp_renderer_draw | ( | struct comp_renderer * | r | ) |
|
static |
References comp_renderer::acquired_buffer, comp_renderer::c, calc_pose_data(), render_resources::cmd, comp_target::final_layout, comp_target::images, comp_base::layer_accum, comp_layer_accum::layer_count, comp_layer_accum::layers, render_compute::r, comp_compositor::r, comp_compositor::target, render_resources::view_count, comp_base::vk, and VK_CHK_AND_RET.
Referenced by comp_renderer::comp_renderer_draw().
|
static |
References comp_renderer::c, calc_pose_data(), render_resources::cmd, comp_base::layer_accum, comp_layer_accum::layer_count, comp_layer_accum::layers, render_gfx_target_resources::r, render_gfx::r, comp_compositor::r, render_resources::view_count, comp_base::vk, and VK_CHK_AND_RET.
Referenced by comp_renderer::comp_renderer_draw().
|
static |
References comp_renderer::c, comp_target::images, comp_compositor::nr, comp_compositor::r, comp_compositor::target, comp_renderer::target_render_pass, and comp_target::width.
Referenced by renderer_create_renderings_and_fences().
|
static |
References ARRAY_SIZE, comp_renderer::buffer_count, comp_renderer::c, comp_compositor::COMP_DEBUG, comp_compositor::COMP_ERROR, comp_renderer::fences, comp_target::final_layout, comp_target::format, comp_compositor::nr, comp_target::present_load_op, comp_compositor::r, renderer_build_rendering_target_resources(), comp_renderer::rtr_array, comp_compositor::target, comp_renderer::target_render_pass, U_TYPED_ARRAY_CALLOC, and comp_base::vk.
|
static |
Create renderer and initialize non-image-dependent members.
References comp_renderer::acquired_buffer, comp_renderer::c, comp_renderer::fenced_buffer, comp_compositor::nr, comp_renderer::rtr_array, comp_compositor::settings, comp_compositor::shaders, render_resources::view_count, and comp_base::vk.
Referenced by comp_renderer::comp_renderer_create().
|
inlinestatic |
With shared presentable images there is only one image shared between the presentation layer and the compositor,
We only need to wait on the first "acquire image", subsueqent frames waiting is redundant.
References comp_renderer::c, comp_renderer::shared_present_semaphore_wait_once, and comp_compositor::target.