Monado OpenXR Runtime
comp_target.h
Go to the documentation of this file.
1// Copyright 2020, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Abstracted compositor rendering target.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup comp_main
8 */
9
10#pragma once
11
12#include "xrt/xrt_compiler.h"
13#include "xrt/xrt_defines.h"
14
15#include "vk/vk_helpers.h"
16
17#include "util/u_trace_marker.h"
18
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24
25/*!
26 * For marking timepoints on a frame's lifetime, not a async event.
27 *
28 * @ingroup comp_main
29 */
31{
32 //! Woke up after sleeping in wait frame.
34
35 //! Began CPU side work for GPU.
37
38 //! Just before submitting work to the GPU.
40
41 //! Just after submitting work to the GPU.
43};
44
45/*!
46 * If the target should use the display timing information.
47 *
48 * @ingroup comp_main
49 */
51{
52 COMP_TARGET_FORCE_FAKE_DISPLAY_TIMING = 0,
53 COMP_TARGET_USE_DISPLAY_IF_AVAILABLE = 1,
54};
55
56/*!
57 * Image and view pair for @ref comp_target.
58 *
59 * @ingroup comp_main
60 */
62{
63 VkImage handle;
64 VkImageView view;
65};
66
67/*!
68 * Information given in when creating the swapchain images,
69 * argument to @ref comp_target_create_images.
70 *
71 * @ingroup comp_main
72 */
74{
75 //! Image usage for the images, must be followed.
76 VkImageUsageFlags image_usage;
77
78 //! Acceptable formats for the images, must be followed.
80
81 // Number of formats.
82 uint32_t format_count;
83
84 //! Preferred extent, can be ignored by the target.
85 VkExtent2D extent;
86
87 //! Preferred color space, can be ignored by the target.
88 VkColorSpaceKHR color_space;
89
90 // Preferred present_mode, can be ignored by the target.
91 VkPresentModeKHR present_mode;
92};
93
94/*!
95 * Collection of semaphores needed for a target.
96 *
97 * @ingroup comp_main
98 */
100{
101 /*!
102 * Optional semaphore the target should signal when present is complete.
103 */
104 VkSemaphore present_complete;
105
106 /*!
107 * Semaphore the renderer (consuming this target)
108 * should signal when rendering is complete.
109 */
110 VkSemaphore render_complete;
111
112 /*!
113 * If true, @ref render_complete is a timeline
114 * semaphore instead of a binary semaphore.
115 */
117};
118
119/*!
120 * @brief A compositor target: where the compositor renders to.
121 *
122 * A target is essentially a swapchain, but it is such a overloaded term so
123 * we are differentiating swapchains that the compositor provides to clients and
124 * swapchains that the compositor renders by naming the latter to target.
125 *
126 * For design purposes, when amending this interface, remember that targets may not necessarily be backed by a
127 * swapchain in all cases, for instance with remote rendering.
128 *
129 * @ingroup comp_main
130 */
132{
133 //! Owning compositor.
135
136 //! Name of the backing system.
137 const char *name;
138
139 //! Current dimensions of the target.
140 uint32_t width, height;
141
142 //! The format that the renderpass targeting this target should use.
143 VkFormat format;
144
145 //! Number of images that this target has.
146 uint32_t image_count;
147 //! Array of images and image views for rendering.
149
150 //! Transformation of the current surface, required for pre-rotation
151 VkSurfaceTransformFlagBitsKHR surface_transform;
152
153 // Holds semaphore information.
154 struct comp_target_semaphores semaphores;
155
156 /*
157 *
158 * Vulkan functions.
159 *
160 */
161
162 /*!
163 * Do any initialization that is required to happen before Vulkan has
164 * been loaded.
165 */
167
168 /*!
169 * Do any initialization that requires Vulkan to be loaded, you need to
170 * call @ref create_images after calling this function.
171 */
172 bool (*init_post_vulkan)(struct comp_target *ct, uint32_t preferred_width, uint32_t preferred_height);
173
174 /*!
175 * Is this target ready for image creation?
176 *
177 * Call before calling @ref create_images
178 */
180
181 /*!
182 * Create or recreate the image(s) of the target, for swapchain based
183 * targets this will (re)create the swapchain.
184 *
185 * @pre @ref check_ready returns true
186 */
187 void (*create_images)(struct comp_target *ct, const struct comp_target_create_images_info *create_info);
188
189 /*!
190 * Has this target successfully had images created?
191 *
192 * Call before calling @ref acquire - if false but @ref check_ready is
193 * true, you'll need to call @ref create_images.
194 */
196
197 /*!
198 * Acquire the next image for rendering.
199 *
200 * If @ref comp_target_semaphores::present_complete is not null,
201 * your use of this image should wait on it..
202 *
203 * @pre @ref has_images() returns true
204 */
205 VkResult (*acquire)(struct comp_target *ct, uint32_t *out_index);
206
207 /*!
208 * Present the image at index to the screen.
209 *
210 * @pre @ref acquire succeeded for the same @p semaphore and @p index you are passing
211 *
212 * @param ct self
213 * @param queue The Vulkan queue being used
214 * @param index The swapchain image index to present
215 * @param timeline_semaphore_value The value to await on @ref comp_target_semaphores::render_complete
216 * if @ref comp_target_semaphores::render_complete_is_timeline is true.
217 * @param desired_present_time_ns The timestamp to present at, ideally.
218 * @param present_slop_ns TODO
219 */
220 VkResult (*present)(struct comp_target *ct,
221 VkQueue queue,
222 uint32_t index,
223 uint64_t timeline_semaphore_value,
224 int64_t desired_present_time_ns,
225 int64_t present_slop_ns);
226
227 /*!
228 * Flush any WSI state before rendering.
229 */
230 void (*flush)(struct comp_target *ct);
231
232
233 /*
234 *
235 * Timing functions.
236 *
237 */
238
239 /*!
240 * Predict when the next frame should be started and when it will be
241 * turned into photons by the hardware.
242 */
243 void (*calc_frame_pacing)(struct comp_target *ct,
244 int64_t *out_frame_id,
245 int64_t *out_wake_up_time_ns,
246 int64_t *out_desired_present_time_ns,
247 int64_t *out_present_slop_ns,
248 int64_t *out_predicted_display_time_ns);
249
250 /*!
251 * The compositor tells the target a timing information about a single
252 * timing point on the frames lifecycle.
253 */
254 void (*mark_timing_point)(struct comp_target *ct,
255 enum comp_target_timing_point point,
256 int64_t frame_id,
257 int64_t when_ns);
258
259 /*!
260 * Update timing information for this target, this function should be
261 * lightweight and is called multiple times during a frame to make sure
262 * that we get the timing data as soon as possible.
263 */
264 VkResult (*update_timings)(struct comp_target *ct);
265
266 /*!
267 * Provide frame timing information about GPU start and stop time.
268 *
269 * Depend on when the information is delivered this can be called at any
270 * point of the following frames.
271 *
272 * @param[in] ct The compositor target.
273 * @param[in] frame_id The frame ID to record for.
274 * @param[in] gpu_start_ns When the GPU work startred.
275 * @param[in] gpu_end_ns When the GPU work stopped.
276 * @param[in] when_ns When the informatioon collected, nominally
277 * from @ref os_monotonic_get_ns.
278 *
279 * @see @ref frame-pacing.
280 */
281 void (*info_gpu)(
282 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns);
283
284 /*
285 *
286 * Misc functions.
287 *
288 */
289
290 /*!
291 * If the target can show a title (like a window) set the title.
292 */
293 void (*set_title)(struct comp_target *ct, const char *title);
294
295 /*!
296 * Destroys this target.
297 */
298 void (*destroy)(struct comp_target *ct);
299};
300
301/*!
302 * @copydoc comp_target::init_pre_vulkan
303 *
304 * @public @memberof comp_target
305 * @ingroup comp_main
306 */
307static inline bool
309{
310 COMP_TRACE_MARKER();
311
312 return ct->init_pre_vulkan(ct);
313}
314
315/*!
316 * @copydoc comp_target::init_post_vulkan
317 *
318 * @public @memberof comp_target
319 * @ingroup comp_main
320 */
321static inline bool
322comp_target_init_post_vulkan(struct comp_target *ct, uint32_t preferred_width, uint32_t preferred_height)
323{
324 COMP_TRACE_MARKER();
325
326 return ct->init_post_vulkan(ct, preferred_width, preferred_height);
327}
328
329/*!
330 * @copydoc comp_target::check_ready
331 *
332 * @public @memberof comp_target
333 * @ingroup comp_main
334 */
335static inline bool
337{
338 COMP_TRACE_MARKER();
339
340 return ct->check_ready(ct);
341}
342
343/*!
344 * @copydoc comp_target::create_images
345 *
346 * @public @memberof comp_target
347 * @ingroup comp_main
348 */
349static inline void
351{
352 COMP_TRACE_MARKER();
353
354 ct->create_images(ct, create_info);
355}
356
357/*!
358 * @copydoc comp_target::has_images
359 *
360 * @public @memberof comp_target
361 * @ingroup comp_main
362 */
363static inline bool
365{
366 COMP_TRACE_MARKER();
367
368 return ct->has_images(ct);
369}
370
371/*!
372 * @copydoc comp_target::acquire
373 *
374 * @public @memberof comp_target
375 * @ingroup comp_main
376 */
377static inline VkResult
378comp_target_acquire(struct comp_target *ct, uint32_t *out_index)
379{
380 COMP_TRACE_MARKER();
381
382 return ct->acquire(ct, out_index);
383}
384
385/*!
386 * @copydoc comp_target::present
387 *
388 * @public @memberof comp_target
389 * @ingroup comp_main
390 */
391static inline VkResult
393 VkQueue queue,
394 uint32_t index,
395 uint64_t timeline_semaphore_value,
396 int64_t desired_present_time_ns,
397 int64_t present_slop_ns)
398
399{
400 COMP_TRACE_MARKER();
401
402 return ct->present( //
403 ct, //
404 queue, //
405 index, //
406 timeline_semaphore_value, //
407 desired_present_time_ns, //
408 present_slop_ns); //
409}
410
411/*!
412 * @copydoc comp_target::flush
413 *
414 * @public @memberof comp_target
415 * @ingroup comp_main
416 */
417static inline void
419{
420 COMP_TRACE_MARKER();
421
422 ct->flush(ct);
423}
424
425/*!
426 * @copydoc comp_target::calc_frame_pacing
427 *
428 * @public @memberof comp_target
429 * @ingroup comp_main
430 */
431static inline void
433 int64_t *out_frame_id,
434 int64_t *out_wake_up_time_ns,
435 int64_t *out_desired_present_time_ns,
436 int64_t *out_present_slop_ns,
437 int64_t *out_predicted_display_time_ns)
438{
439 COMP_TRACE_MARKER();
440
441 ct->calc_frame_pacing( //
442 ct, //
443 out_frame_id, //
444 out_wake_up_time_ns, //
445 out_desired_present_time_ns, //
446 out_present_slop_ns, //
447 out_predicted_display_time_ns); //
448}
449
450/*!
451 * Quick helper for marking wake up.
452 * @copydoc comp_target::mark_timing_point
453 *
454 * @public @memberof comp_target
455 * @ingroup comp_main
456 */
457static inline void
458comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, int64_t when_woke_ns)
459{
460 COMP_TRACE_MARKER();
461
462 ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_WAKE_UP, frame_id, when_woke_ns);
463}
464
465/*!
466 * Quick helper for marking begin.
467 * @copydoc comp_target::mark_timing_point
468 *
469 * @public @memberof comp_target
470 * @ingroup comp_main
471 */
472static inline void
473comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, int64_t when_began_ns)
474{
475 COMP_TRACE_MARKER();
476
477 ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_BEGIN, frame_id, when_began_ns);
478}
479
480/*!
481 * Quick helper for marking submit began.
482 * @copydoc comp_target::mark_timing_point
483 *
484 * @public @memberof comp_target
485 * @ingroup comp_main
486 */
487static inline void
488comp_target_mark_submit_begin(struct comp_target *ct, int64_t frame_id, int64_t when_submit_began_ns)
489{
490 COMP_TRACE_MARKER();
491
492 ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_SUBMIT_BEGIN, frame_id, when_submit_began_ns);
493}
494
495/*!
496 * Quick helper for marking submit end.
497 * @copydoc comp_target::mark_timing_point
498 *
499 * @public @memberof comp_target
500 * @ingroup comp_main
501 */
502static inline void
503comp_target_mark_submit_end(struct comp_target *ct, int64_t frame_id, int64_t when_submit_end_ns)
504{
505 COMP_TRACE_MARKER();
506
507 ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_SUBMIT_END, frame_id, when_submit_end_ns);
508}
509
510/*!
511 * @copydoc comp_target::update_timings
512 *
513 * @public @memberof comp_target
514 * @ingroup comp_main
515 */
516static inline VkResult
518{
519 COMP_TRACE_MARKER();
520
521 return ct->update_timings(ct);
522}
523
524/*!
525 * @copydoc comp_target::info_gpu
526 *
527 * @public @memberof comp_target
528 * @ingroup comp_main
529 */
530static inline void
532 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
533{
534 COMP_TRACE_MARKER();
535
536 ct->info_gpu(ct, frame_id, gpu_start_ns, gpu_end_ns, when_ns);
537}
538
539/*!
540 * @copydoc comp_target::set_title
541 *
542 * @public @memberof comp_target
543 * @ingroup comp_main
544 */
545static inline void
546comp_target_set_title(struct comp_target *ct, const char *title)
547{
548 COMP_TRACE_MARKER();
549
550 ct->set_title(ct, title);
551}
552
553/*!
554 * @copydoc comp_target::destroy
555 *
556 * Helper for calling through the function pointer: does a null check and sets
557 * ct_ptr to null if freed.
558 *
559 * @public @memberof comp_target
560 * @ingroup comp_main
561 */
562static inline void
564{
565 struct comp_target *ct = *ct_ptr;
566 if (ct == NULL) {
567 return;
568 }
569
570 ct->destroy(ct);
571 *ct_ptr = NULL;
572}
573
574/*!
575 * A factory of targets.
576 *
577 * @ingroup comp_main
578 */
580{
581 //! Pretty loggable name of target type.
582 const char *name;
583
584 //! Short all lowercase identifier for target type.
585 const char *identifier;
586
587 //! Does this factory require Vulkan to have been initialized.
589
590 /*!
591 * Is this a deferred target that can have it's creation
592 * delayed even further then after Vulkan initialization.
593 */
595
596 /*!
597 * Vulkan version that is required or 0 if no specific
598 * requirement, equivalent to VK_MAKE_VERSION(1, 0, 0)
599 */
601
602 //! Required instance extensions.
604
605 //! Required instance extension count.
607
608 //! Optional device extensions.
610
611 //! Optional device extension count.
613
614 /*!
615 * Checks if this target can be detected, is the preferred target or
616 * some other special consideration that this target should be used over
617 * all other targets.
618 *
619 * This is needed for NVIDIA direct mode which window must be created
620 * after vulkan has initialized.
621 */
622 bool (*detect)(const struct comp_target_factory *ctf, struct comp_compositor *c);
623
624 /*!
625 * Create a target from this factory, some targets requires Vulkan to
626 * have been initialised, see @ref requires_vulkan_for_create.
627 */
629 struct comp_compositor *c,
630 struct comp_target **out_ct);
631};
632
633/*!
634 * @copydoc comp_target_factory::detect
635 *
636 * @public @memberof comp_target_factory
637 * @ingroup comp_main
638 */
639static inline bool
641{
642 COMP_TRACE_MARKER();
643
644 return ctf->detect(ctf, c);
645}
646
647/*!
648 * @copydoc comp_target_factory::create_target
649 *
650 * @public @memberof comp_target_factory
651 * @ingroup comp_main
652 */
653static inline bool
655 struct comp_compositor *c,
656 struct comp_target **out_ct)
657{
658 COMP_TRACE_MARKER();
659
660 return ctf->create_target(ctf, c, out_ct);
661}
662
663
664#ifdef __cplusplus
665}
666#endif
static void comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, int64_t when_woke_ns)
Quick helper for marking wake up.
Definition: comp_target.h:458
static void comp_target_destroy(struct comp_target **ct_ptr)
Destroys this target.
Definition: comp_target.h:563
comp_target_display_timing_usage
If the target should use the display timing information.
Definition: comp_target.h:51
static VkResult comp_target_present(struct comp_target *ct, VkQueue queue, uint32_t index, uint64_t timeline_semaphore_value, int64_t desired_present_time_ns, int64_t present_slop_ns)
Present the image at index to the screen.
Definition: comp_target.h:392
static VkResult comp_target_acquire(struct comp_target *ct, uint32_t *out_index)
Acquire the next image for rendering.
Definition: comp_target.h:378
static void comp_target_mark_submit_begin(struct comp_target *ct, int64_t frame_id, int64_t when_submit_began_ns)
Quick helper for marking submit began.
Definition: comp_target.h:488
static VkResult comp_target_update_timings(struct comp_target *ct)
Update timing information for this target, this function should be lightweight and is called multiple...
Definition: comp_target.h:517
static void comp_target_flush(struct comp_target *ct)
Flush any WSI state before rendering.
Definition: comp_target.h:418
static bool comp_target_has_images(struct comp_target *ct)
Has this target successfully had images created?
Definition: comp_target.h:364
static void comp_target_set_title(struct comp_target *ct, const char *title)
If the target can show a title (like a window) set the title.
Definition: comp_target.h:546
static void comp_target_create_images(struct comp_target *ct, const struct comp_target_create_images_info *create_info)
Create or recreate the image(s) of the target, for swapchain based targets this will (re)create the s...
Definition: comp_target.h:350
static bool comp_target_check_ready(struct comp_target *ct)
Is this target ready for image creation?
Definition: comp_target.h:336
static void comp_target_calc_frame_pacing(struct comp_target *ct, int64_t *out_frame_id, int64_t *out_wake_up_time_ns, int64_t *out_desired_present_time_ns, int64_t *out_present_slop_ns, int64_t *out_predicted_display_time_ns)
Predict when the next frame should be started and when it will be turned into photons by the hardware...
Definition: comp_target.h:432
comp_target_timing_point
For marking timepoints on a frame's lifetime, not a async event.
Definition: comp_target.h:31
static void comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, int64_t when_began_ns)
Quick helper for marking begin.
Definition: comp_target.h:473
static bool comp_target_factory_detect(const struct comp_target_factory *ctf, struct comp_compositor *c)
Checks if this target can be detected, is the preferred target or some other special consideration th...
Definition: comp_target.h:640
static void comp_target_mark_submit_end(struct comp_target *ct, int64_t frame_id, int64_t when_submit_end_ns)
Quick helper for marking submit end.
Definition: comp_target.h:503
static bool comp_target_factory_create_target(const struct comp_target_factory *ctf, struct comp_compositor *c, struct comp_target **out_ct)
Create a target from this factory, some targets requires Vulkan to have been initialised,...
Definition: comp_target.h:654
static bool comp_target_init_pre_vulkan(struct comp_target *ct)
Do any initialization that is required to happen before Vulkan has been loaded.
Definition: comp_target.h:308
static void comp_target_info_gpu(struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
Provide frame timing information about GPU start and stop time.
Definition: comp_target.h:531
static bool comp_target_init_post_vulkan(struct comp_target *ct, uint32_t preferred_width, uint32_t preferred_height)
Do any initialization that requires Vulkan to be loaded, you need to call create_images after calling...
Definition: comp_target.h:322
@ COMP_TARGET_TIMING_POINT_SUBMIT_BEGIN
Just before submitting work to the GPU.
Definition: comp_target.h:39
@ COMP_TARGET_TIMING_POINT_BEGIN
Began CPU side work for GPU.
Definition: comp_target.h:36
@ COMP_TARGET_TIMING_POINT_WAKE_UP
Woke up after sleeping in wait frame.
Definition: comp_target.h:33
@ COMP_TARGET_TIMING_POINT_SUBMIT_END
Just after submitting work to the GPU.
Definition: comp_target.h:42
#define XRT_MAX_SWAPCHAIN_FORMATS
Max formats supported by a compositor, artificial limit.
Definition: xrt_limits.h:39
Main compositor struct tying everything in the compositor together.
Definition: comp_compositor.h:89
Information given in when creating the swapchain images, argument to comp_target_create_images.
Definition: comp_target.h:74
VkColorSpaceKHR color_space
Preferred color space, can be ignored by the target.
Definition: comp_target.h:88
VkExtent2D extent
Preferred extent, can be ignored by the target.
Definition: comp_target.h:85
VkImageUsageFlags image_usage
Image usage for the images, must be followed.
Definition: comp_target.h:76
VkFormat formats[XRT_MAX_SWAPCHAIN_FORMATS]
Acceptable formats for the images, must be followed.
Definition: comp_target.h:79
A factory of targets.
Definition: comp_target.h:580
const char ** required_instance_extensions
Required instance extensions.
Definition: comp_target.h:603
bool requires_vulkan_for_create
Does this factory require Vulkan to have been initialized.
Definition: comp_target.h:588
size_t required_instance_extension_count
Required instance extension count.
Definition: comp_target.h:606
const char * identifier
Short all lowercase identifier for target type.
Definition: comp_target.h:585
size_t optional_device_extension_count
Optional device extension count.
Definition: comp_target.h:612
const char ** optional_device_extensions
Optional device extensions.
Definition: comp_target.h:609
const char * name
Pretty loggable name of target type.
Definition: comp_target.h:582
bool(* detect)(const struct comp_target_factory *ctf, struct comp_compositor *c)
Checks if this target can be detected, is the preferred target or some other special consideration th...
Definition: comp_target.h:622
uint32_t required_instance_version
Vulkan version that is required or 0 if no specific requirement, equivalent to VK_MAKE_VERSION(1,...
Definition: comp_target.h:600
bool is_deferred
Is this a deferred target that can have it's creation delayed even further then after Vulkan initiali...
Definition: comp_target.h:594
bool(* create_target)(const struct comp_target_factory *ctf, struct comp_compositor *c, struct comp_target **out_ct)
Create a target from this factory, some targets requires Vulkan to have been initialised,...
Definition: comp_target.h:628
Image and view pair for comp_target.
Definition: comp_target.h:62
Collection of semaphores needed for a target.
Definition: comp_target.h:100
VkSemaphore render_complete
Semaphore the renderer (consuming this target) should signal when rendering is complete.
Definition: comp_target.h:110
VkSemaphore present_complete
Optional semaphore the target should signal when present is complete.
Definition: comp_target.h:104
bool render_complete_is_timeline
If true, render_complete is a timeline semaphore instead of a binary semaphore.
Definition: comp_target.h:116
A compositor target: where the compositor renders to.
Definition: comp_target.h:132
bool(* has_images)(struct comp_target *ct)
Has this target successfully had images created?
Definition: comp_target.h:195
void(* create_images)(struct comp_target *ct, const struct comp_target_create_images_info *create_info)
Create or recreate the image(s) of the target, for swapchain based targets this will (re)create the s...
Definition: comp_target.h:187
bool(* check_ready)(struct comp_target *ct)
Is this target ready for image creation?
Definition: comp_target.h:179
void(* flush)(struct comp_target *ct)
Flush any WSI state before rendering.
Definition: comp_target.h:230
uint32_t width
Current dimensions of the target.
Definition: comp_target.h:140
void(* set_title)(struct comp_target *ct, const char *title)
If the target can show a title (like a window) set the title.
Definition: comp_target.h:293
bool(* init_post_vulkan)(struct comp_target *ct, uint32_t preferred_width, uint32_t preferred_height)
Do any initialization that requires Vulkan to be loaded, you need to call create_images after calling...
Definition: comp_target.h:172
void(* destroy)(struct comp_target *ct)
Destroys this target.
Definition: comp_target.h:298
struct comp_target_image * images
Array of images and image views for rendering.
Definition: comp_target.h:148
uint32_t image_count
Number of images that this target has.
Definition: comp_target.h:146
VkResult(* acquire)(struct comp_target *ct, uint32_t *out_index)
Acquire the next image for rendering.
Definition: comp_target.h:205
void(* mark_timing_point)(struct comp_target *ct, enum comp_target_timing_point point, int64_t frame_id, int64_t when_ns)
The compositor tells the target a timing information about a single timing point on the frames lifecy...
Definition: comp_target.h:254
void(* info_gpu)(struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
Provide frame timing information about GPU start and stop time.
Definition: comp_target.h:281
bool(* init_pre_vulkan)(struct comp_target *ct)
Do any initialization that is required to happen before Vulkan has been loaded.
Definition: comp_target.h:166
VkResult(* update_timings)(struct comp_target *ct)
Update timing information for this target, this function should be lightweight and is called multiple...
Definition: comp_target.h:264
const char * name
Name of the backing system.
Definition: comp_target.h:137
VkSurfaceTransformFlagBitsKHR surface_transform
Transformation of the current surface, required for pre-rotation.
Definition: comp_target.h:151
void(* calc_frame_pacing)(struct comp_target *ct, int64_t *out_frame_id, int64_t *out_wake_up_time_ns, int64_t *out_desired_present_time_ns, int64_t *out_present_slop_ns, int64_t *out_predicted_display_time_ns)
Predict when the next frame should be started and when it will be turned into photons by the hardware...
Definition: comp_target.h:243
struct comp_compositor * c
Owning compositor.
Definition: comp_target.h:134
VkFormat format
The format that the renderpass targeting this target should use.
Definition: comp_target.h:143
VkResult(* present)(struct comp_target *ct, VkQueue queue, uint32_t index, uint64_t timeline_semaphore_value, int64_t desired_present_time_ns, int64_t present_slop_ns)
Present the image at index to the screen.
Definition: comp_target.h:220
Tracing support code, see Tracing support.
Common Vulkan code header.
Header holding common defines.
Common defines and enums for XRT.