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);
301 int64_t *out_wake_up_time_ns,
302 int64_t *out_desired_present_time_ns,
303 int64_t *out_present_slop_ns,
304 int64_t *out_predicted_display_time_ns);
338 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns);
361 float *out_display_refresh_rates_hz);
389 VkBool32 *out_supported);
489static inline VkResult
494 return ct->
acquire(ct, out_index);
503static inline VkResult
507 uint64_t timeline_semaphore_value,
508 int64_t desired_present_time_ns,
509 int64_t present_slop_ns)
518 timeline_semaphore_value,
519 desired_present_time_ns,
529static inline VkResult
590 int64_t *out_wake_up_time_ns,
591 int64_t *out_desired_present_time_ns,
592 int64_t *out_present_slop_ns,
593 int64_t *out_predicted_display_time_ns)
601 out_desired_present_time_ns,
603 out_predicted_display_time_ns);
672static inline VkResult
688 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
692 ct->
info_gpu(ct, frame_id, gpu_start_ns, gpu_end_ns, when_ns);
757static inline VkResult
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition u_time.h:88
static void comp_target_calc_frame_pacing(struct comp_target *ct, int64_t 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 a frame previously allocated with allocate_frame should be started and when it will be t...
Definition comp_target.h:588
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:614
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:530
static void comp_target_destroy(struct comp_target **ct_ptr)
Destroys this target.
Definition comp_target.h:774
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:490
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:644
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:673
static void comp_target_flush(struct comp_target *ct)
Flush any WSI state before rendering.
Definition comp_target.h:546
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:758
static bool comp_target_has_images(struct comp_target *ct)
Has this target successfully had images created?
Definition comp_target.h:476
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:730
static bool comp_target_is_shared_presentable_image(struct comp_target *ct)
Is this target shared presentable image?
Definition comp_target.h:446
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:702
static void comp_target_allocate_frame(struct comp_target *ct, int64_t *out_frame_id)
Allocate a new frame ID, this does not make any predictions.
Definition comp_target.h:560
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:504
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:716
static bool comp_target_check_ready(struct comp_target *ct)
Is this target ready for image creation?
Definition comp_target.h:432
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:460
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:629
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:851
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:659
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:744
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:865
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:404
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:687
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:418
static void comp_target_update_present_offset(struct comp_target *ct, int64_t frame_id, int64_t present_to_display_offset_ns)
Update the target's estimate of the time between present (first pixel scanned out) and photons,...
Definition comp_target.h:574
@ 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:791
const char ** required_instance_extensions
Required instance extensions.
Definition comp_target.h:814
bool requires_vulkan_for_create
Does this factory require Vulkan to have been initialized.
Definition comp_target.h:799
size_t required_instance_extension_count
Required instance extension count.
Definition comp_target.h:817
const char * identifier
Short all lowercase identifier for target type.
Definition comp_target.h:796
size_t optional_device_extension_count
Optional device extension count.
Definition comp_target.h:823
const char ** optional_device_extensions
Optional device extensions.
Definition comp_target.h:820
const char * name
Pretty loggable name of target type.
Definition comp_target.h:793
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:833
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:811
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:805
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:839
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
void(* calc_frame_pacing)(struct comp_target *ct, int64_t 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 a frame previously allocated with allocate_frame should be started and when it will be t...
Definition comp_target.h:299
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:377
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:349
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:394
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:310
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:337
void(* allocate_frame)(struct comp_target *ct, int64_t *out_frame_id)
Allocate a new frame ID, this does not make any predictions.
Definition comp_target.h:279
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:320
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
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:387
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:359
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:369
VkImageLayout final_layout
The final layout that the renderpass should leave this target in.
Definition comp_target.h:147
void(* update_present_offset)(struct comp_target *ct, int64_t frame_id, int64_t present_to_display_offset_ns)
Update the target's estimate of the time between present (first pixel scanned out) and photons,...
Definition comp_target.h:290
Definition vk_helpers.h:63
Tracing support code, see Tracing support.
Common Vulkan code header.
Header holding common defines.
Common defines and enums for XRT.