Monado OpenXR Runtime
Loading...
Searching...
No Matches
comp_mirror_to_debug_gui.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// Copyright 2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Compositor mirroring code.
7 * @author Moshi Turner <moshiturner@protonmail.com>
8 * @author Jakob Bornecrantz <jakob@collabora.com>
9 * @ingroup comp_main
10 */
11#pragma once
12
13#include "xrt/xrt_compiler.h"
14#include "xrt/xrt_results.h"
15#include "util/u_sink.h"
17
19
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct render_blit_pipeline_cache;
26
27
28/*!
29 * Helper struct for mirroring the compositors rendering to the debug ui,
30 * which also enables recording. Currently embedded in @ref comp_renderer.
31 *
32 * @ingroup comp_main
33 */
35{
36 /*
37 * Hint: enable/disable is in c->mirroring_to_debug_gui. It is there
38 * because the ccomp_renderer struct is just a forward decl in the
39 * header and then defined properly in the comp_renderer.c file.
40 */
41
42 struct u_frame_times_widget push_frame_times;
43
44 float target_frame_time_ms;
45 uint64_t last_push_ts_ns;
46 int push_every_frame_out_of_X;
47
48 struct u_sink_debug debug_sink;
49 VkExtent2D image_extent;
50
52
53 struct
54 {
55 VkImage image;
56 VkImageView unorm_view;
57 VkDeviceMemory mem;
58 } bounce;
59
60 struct
61 {
62 //! Vulkan pipeline cache object passed to vkCreateComputePipelines.
63 VkPipelineCache driver_pipeline_cache;
64
65 //! Get-or-create cache for blit.comp specialization variants.
66 struct render_blit_pipeline_cache *pipeline_cache;
67
68 //! Descriptor pool for blit.
69 VkDescriptorPool descriptor_pool;
70
71 //! Descriptor set layout for compute.
72 VkDescriptorSetLayout descriptor_set_layout;
73
74 //! Pipeline layout used for compute distortion.
75 VkPipelineLayout pipeline_layout;
76
77 //! Doesn't depend on target so is static.
78 VkPipeline pipeline;
79 } blit;
80
81 struct vk_cmd_pool cmd_pool;
82};
83
84/*!
85 * Initialise the struct.
86 *
87 * @public @memberof comp_mirror_to_debug_gui
88 */
89VkResult
90comp_mirror_init(struct comp_mirror_to_debug_gui *m,
91 struct vk_bundle *vk,
92 struct render_shaders *shaders,
93 VkExtent2D extent);
94
95/*!
96 * One time adding of the debug variables.
97 *
98 * @public @memberof comp_mirror_to_debug_gui
99 */
100void
101comp_mirror_add_debug_vars(struct comp_mirror_to_debug_gui *m, struct comp_compositor *c);
102
103/*!
104 * Fixup various timing state.
105 *
106 * @public @memberof comp_mirror_to_debug_gui
107 */
108void
109comp_mirror_fixup_ui_state(struct comp_mirror_to_debug_gui *m, struct comp_compositor *c);
110
111/*!
112 * Is this struct ready and capable of mirroring the image, can only
113 * call @ref comp_mirror_do_blit if this function has returned true.
114 *
115 * @public @memberof comp_mirror_to_debug_gui
116 */
117bool
118comp_mirror_is_ready_and_active(struct comp_mirror_to_debug_gui *m,
119 struct comp_compositor *c,
120 uint64_t predicted_display_time_ns);
121
122/*!
123 * Do the blit.
124 *
125 * @public @memberof comp_mirror_to_debug_gui
126 */
127XRT_CHECK_RESULT xrt_result_t
129 struct vk_bundle *vk,
130 uint64_t frame_id,
131 uint64_t predicted_display_time_ns,
132 VkImage from_image,
133 VkImageView from_view,
134 VkSampler from_sampler,
135 VkExtent2D from_extent,
136 struct xrt_normalized_rect from_rect);
137
138/*!
139 * Finalise the struct, frees and resources.
140 *
141 * @public @memberof comp_mirror_to_debug_gui
142 */
143void
144comp_mirror_fini(struct comp_mirror_to_debug_gui *m, struct vk_bundle *vk);
145
146
147#ifdef __cplusplus
148}
149#endif
Main compositor written using Vulkan header.
XRT_CHECK_RESULT xrt_result_t comp_mirror_do_blit(struct comp_mirror_to_debug_gui *m, struct vk_bundle *vk, uint64_t frame_id, uint64_t predicted_display_time_ns, VkImage from_image, VkImageView from_view, VkSampler from_sampler, VkExtent2D from_extent, struct xrt_normalized_rect from_rect)
Definition comp_mirror_to_debug_gui.c:444
enum xrt_result xrt_result_t
Result type used across Monado.
Main compositor struct tying everything in the compositor together.
Definition comp_compositor.h:89
Helper struct for mirroring the compositors rendering to the debug ui, which also enables recording.
Definition comp_mirror_to_debug_gui.h:35
VkDescriptorPool descriptor_pool
Descriptor pool for blit.
Definition comp_mirror_to_debug_gui.h:69
VkPipelineLayout pipeline_layout
Pipeline layout used for compute distortion.
Definition comp_mirror_to_debug_gui.h:75
struct render_blit_pipeline_cache * pipeline_cache
Get-or-create cache for blit.comp specialization variants.
Definition comp_mirror_to_debug_gui.h:66
VkPipelineCache driver_pipeline_cache
Vulkan pipeline cache object passed to vkCreateComputePipelines.
Definition comp_mirror_to_debug_gui.h:63
VkPipeline pipeline
Doesn't depend on target so is static.
Definition comp_mirror_to_debug_gui.h:78
VkDescriptorSetLayout descriptor_set_layout
Descriptor set layout for compute.
Definition comp_mirror_to_debug_gui.h:72
Definition t_rift_blobwatch.c:112
Definition u_worker.c:50
Holds all shaders.
Definition render_shaders_interface.h:26
Definition u_frame_times_widget.h:24
Allows more safely to debug sink inputs and outputs.
Definition u_sink.h:214
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code.
Definition vk_helpers.h:81
Small helper to manage lock around a command pool.
Definition vk_cmd_pool.h:33
Definition vk_image_readback_to_xf_pool.c:18
Normalized image rectangle, coordinates and size in 0 .
Definition xrt_defines.h:501
xrt_frame_sink converters and other helpers.
Pool to read back VkImages from the gpu.
Header holding common defines.
Internal result type for XRT.