53 COMP_TARGET_FORCE_FAKE_DISPLAY_TIMING = 0,
54 COMP_TARGET_USE_DISPLAY_IF_AVAILABLE = 1,
83 uint32_t format_count;
92 VkPresentModeKHR present_mode;
246 uint64_t timeline_semaphore_value,
247 int64_t desired_present_time_ns,
248 int64_t present_slop_ns);
275 int64_t *out_frame_id,
276 int64_t *out_wake_up_time_ns,
277 int64_t *out_desired_present_time_ns,
278 int64_t *out_present_slop_ns,
279 int64_t *out_predicted_display_time_ns);
313 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns);
336 float *out_display_refresh_rates_hz);
364 VkBool32 *out_supported);
464static inline VkResult
469 return ct->
acquire(ct, out_index);
478static inline VkResult
482 uint64_t timeline_semaphore_value,
483 int64_t desired_present_time_ns,
484 int64_t present_slop_ns)
493 timeline_semaphore_value,
494 desired_present_time_ns,
504static inline VkResult
536 int64_t *out_frame_id,
537 int64_t *out_wake_up_time_ns,
538 int64_t *out_desired_present_time_ns,
539 int64_t *out_present_slop_ns,
540 int64_t *out_predicted_display_time_ns)
548 out_desired_present_time_ns,
550 out_predicted_display_time_ns);
619static inline VkResult
635 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
639 ct->
info_gpu(ct, frame_id, gpu_start_ns, gpu_end_ns, when_ns);
704static inline VkResult
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition u_time.h:88
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:561
static VkResult comp_target_wait_for_present(struct comp_target *ct, time_duration_ns timeout)
Wait for the latest presented image to be displayed to the user.
Definition comp_target.h:505
static void comp_target_destroy(struct comp_target **ct_ptr)
Destroys this target.
Definition comp_target.h:721
comp_target_display_timing_usage
If the target should use the display timing information.
Definition comp_target.h:52
static VkResult comp_target_acquire(struct comp_target *ct, uint32_t *out_index)
Acquire the next image for rendering.
Definition comp_target.h:465
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:591
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:620
static void comp_target_flush(struct comp_target *ct)
Flush any WSI state before rendering.
Definition comp_target.h:521
static VkResult comp_target_queue_supports_present(struct comp_target *ct, struct vk_bundle_queue *queue, VkBool32 *out_supported)
Queries if a particular queue supports presentation ops/cmds for the compositor target.
Definition comp_target.h:705
static bool comp_target_has_images(struct comp_target *ct)
Has this target successfully had images created?
Definition comp_target.h:451
static xrt_result_t comp_target_get_current_refresh_rate(struct comp_target *ct, float *out_display_refresh_rate_hz)
Get the current refresh rate for the compositor target.
Definition comp_target.h:677
static bool comp_target_is_shared_presentable_image(struct comp_target *ct)
Is this target shared presentable image?
Definition comp_target.h:421
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:649
static VkResult comp_target_present(struct comp_target *ct, struct vk_bundle_queue *present_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:479
static xrt_result_t comp_target_get_refresh_rates(struct comp_target *ct, uint32_t *count, float *rates)
Get the available refresh rates for the compositor target.
Definition comp_target.h:663
static bool comp_target_check_ready(struct comp_target *ct)
Is this target ready for image creation?
Definition comp_target.h:407
static void comp_target_create_images(struct comp_target *ct, const struct comp_target_create_images_info *create_info, struct vk_bundle_queue *present_queue)
Create or recreate the image(s) of the target, for swapchain based targets this will (re)create the s...
Definition comp_target.h:435
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:535
comp_target_timing_point
For marking timepoints on a frame's lifetime, not a async event.
Definition comp_target.h:32
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:576
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:798
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:606
static xrt_result_t comp_target_request_refresh_rate(struct comp_target *ct, float ratedisplay_refresh_rate_hz)
Get the current refresh rate for the compositor target.
Definition comp_target.h:691
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:812
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:379
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:634
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:393
@ COMP_TARGET_TIMING_POINT_SUBMIT_BEGIN
Just before submitting work to the GPU.
Definition comp_target.h:40
@ COMP_TARGET_TIMING_POINT_BEGIN
Began CPU side work for GPU.
Definition comp_target.h:37
@ COMP_TARGET_TIMING_POINT_WAKE_UP
Woke up after sleeping in wait frame.
Definition comp_target.h:34
@ COMP_TARGET_TIMING_POINT_SUBMIT_END
Just after submitting work to the GPU.
Definition comp_target.h:43
enum xrt_result xrt_result_t
Result type used across Monado.
#define XRT_MAX_SWAPCHAIN_FORMATS
Max formats supported by a compositor, artificial limit.
Definition xrt_limits.h:58
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:75
VkColorSpaceKHR color_space
Preferred color space, can be ignored by the target.
Definition comp_target.h:89
VkExtent2D extent
Preferred extent, can be ignored by the target.
Definition comp_target.h:86
VkImageUsageFlags image_usage
Image usage for the images, must be followed.
Definition comp_target.h:77
VkFormat formats[XRT_MAX_SWAPCHAIN_FORMATS]
Acceptable formats for the images, must be followed.
Definition comp_target.h:80
A factory of targets.
Definition comp_target.h:738
const char ** required_instance_extensions
Required instance extensions.
Definition comp_target.h:761
bool requires_vulkan_for_create
Does this factory require Vulkan to have been initialized.
Definition comp_target.h:746
size_t required_instance_extension_count
Required instance extension count.
Definition comp_target.h:764
const char * identifier
Short all lowercase identifier for target type.
Definition comp_target.h:743
size_t optional_device_extension_count
Optional device extension count.
Definition comp_target.h:770
const char ** optional_device_extensions
Optional device extensions.
Definition comp_target.h:767
const char * name
Pretty loggable name of target type.
Definition comp_target.h:740
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:780
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:758
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:752
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:786
Image and view pair for comp_target.
Definition comp_target.h:63
Collection of semaphores needed for a target.
Definition comp_target.h:101
VkSemaphore render_complete
Semaphore the renderer (consuming this target) should signal when rendering is complete.
Definition comp_target.h:111
VkSemaphore present_complete
Optional semaphore the target should signal when present is complete.
Definition comp_target.h:105
bool render_complete_is_timeline
If true, render_complete is a timeline semaphore instead of a binary semaphore.
Definition comp_target.h:117
A compositor target: where the compositor renders to.
Definition comp_target.h:133
bool(* has_images)(struct comp_target *ct)
Has this target successfully had images created?
Definition comp_target.h:218
void(* create_images)(struct comp_target *ct, const struct comp_target_create_images_info *create_info, struct vk_bundle_queue *present_queue)
Create or recreate the image(s) of the target, for swapchain based targets this will (re)create the s...
Definition comp_target.h:208
bool(* check_ready)(struct comp_target *ct)
Is this target ready for image creation?
Definition comp_target.h:189
xrt_result_t(* request_refresh_rate)(struct comp_target *ct, float display_refresh_rate_hz)
Get the current refresh rate for the compositor target.
Definition comp_target.h:352
void(* flush)(struct comp_target *ct)
Flush any WSI state before rendering.
Definition comp_target.h:261
VkResult(* present)(struct comp_target *ct, struct vk_bundle_queue *present_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:243
uint32_t width
Current dimensions of the target.
Definition comp_target.h:141
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:324
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:182
void(* destroy)(struct comp_target *ct)
Destroys this target.
Definition comp_target.h:369
bool(* is_shared_presentable_image)(struct comp_target *ct)
Is this target shared presentable image?
Definition comp_target.h:196
struct comp_target_image * images
Array of images and image views for rendering.
Definition comp_target.h:155
VkResult(* wait_for_present)(struct comp_target *ct, time_duration_ns timeout_ns)
Wait for the latest presented image to be displayed to the user.
Definition comp_target.h:256
uint32_t image_count
Number of images that this target has.
Definition comp_target.h:153
VkResult(* acquire)(struct comp_target *ct, uint32_t *out_index)
Acquire the next image for rendering.
Definition comp_target.h:228
VkAttachmentLoadOp present_load_op
Load ops required for present.
Definition comp_target.h:150
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:285
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:312
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:176
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:295
const char * name
Name of the backing system.
Definition comp_target.h:138
struct comp_target_semaphores semaphores
Holds semaphore information.
Definition comp_target.h:161
VkSurfaceTransformFlagBitsKHR surface_transform
Transformation of the current surface, required for pre-rotation.
Definition comp_target.h:158
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:274
VkResult(* queue_supports_present)(struct comp_target *ct, struct vk_bundle_queue *queue, VkBool32 *out_supported)
Queries if a particular queue supports presentation ops/cmds for the compositor target.
Definition comp_target.h:362
xrt_result_t(* get_refresh_rates)(struct comp_target *ct, uint32_t *out_count, float *out_display_refresh_rates_hz)
Get the available refresh rates for the compositor target.
Definition comp_target.h:334
struct comp_compositor * c
Owning compositor.
Definition comp_target.h:135
bool wait_for_present_supported
Whether wait_for_present is supported by this comp_target.
Definition comp_target.h:164
VkFormat format
The format that the renderpass targeting this target should use.
Definition comp_target.h:144
xrt_result_t(* get_current_refresh_rate)(struct comp_target *ct, float *out_display_refresh_rate_hz)
Get the current refresh rate for the compositor target.
Definition comp_target.h:344
VkImageLayout final_layout
The final layout that the renderpass should leave this target in.
Definition comp_target.h:147
Definition vk_helpers.h:62
Tracing support code, see Tracing support.
Common Vulkan code header.
Header holding common defines.
Common defines and enums for XRT.