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