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;
227 uint64_t timeline_semaphore_value,
228 int64_t desired_present_time_ns,
229 int64_t present_slop_ns);
248 int64_t *out_frame_id,
249 int64_t *out_wake_up_time_ns,
250 int64_t *out_desired_present_time_ns,
251 int64_t *out_present_slop_ns,
252 int64_t *out_predicted_display_time_ns);
286 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns);
309 float *out_display_refresh_rates_hz);
410static inline VkResult
415 return ct->
acquire(ct, out_index);
424static inline VkResult
428 uint64_t timeline_semaphore_value,
429 int64_t desired_present_time_ns,
430 int64_t present_slop_ns)
439 timeline_semaphore_value,
440 desired_present_time_ns,
466 int64_t *out_frame_id,
467 int64_t *out_wake_up_time_ns,
468 int64_t *out_desired_present_time_ns,
469 int64_t *out_present_slop_ns,
470 int64_t *out_predicted_display_time_ns)
478 out_desired_present_time_ns,
480 out_predicted_display_time_ns);
549static inline VkResult
565 struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
569 ct->
info_gpu(ct, frame_id, gpu_start_ns, gpu_end_ns, when_ns);
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:491
static void comp_target_destroy(struct comp_target **ct_ptr)
Destroys this target.
Definition: comp_target.h:638
comp_target_display_timing_usage
If the target should use the display timing information.
Definition: comp_target.h:52
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:425
static VkResult comp_target_acquire(struct comp_target *ct, uint32_t *out_index)
Acquire the next image for rendering.
Definition: comp_target.h:411
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:521
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:550
static void comp_target_flush(struct comp_target *ct)
Flush any WSI state before rendering.
Definition: comp_target.h:451
static bool comp_target_has_images(struct comp_target *ct)
Has this target successfully had images created?
Definition: comp_target.h:397
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:607
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:579
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:383
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:593
static bool comp_target_check_ready(struct comp_target *ct)
Is this target ready for image creation?
Definition: comp_target.h:369
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:465
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:506
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:715
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:536
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:621
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:729
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:341
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:564
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:355
@ 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: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: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:655
const char ** required_instance_extensions
Required instance extensions.
Definition: comp_target.h:678
bool requires_vulkan_for_create
Does this factory require Vulkan to have been initialized.
Definition: comp_target.h:663
size_t required_instance_extension_count
Required instance extension count.
Definition: comp_target.h:681
const char * identifier
Short all lowercase identifier for target type.
Definition: comp_target.h:660
size_t optional_device_extension_count
Optional device extension count.
Definition: comp_target.h:687
const char ** optional_device_extensions
Optional device extensions.
Definition: comp_target.h:684
const char * name
Pretty loggable name of target type.
Definition: comp_target.h:657
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:697
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:675
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:669
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:703
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:199
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:191
bool(* check_ready)(struct comp_target *ct)
Is this target ready for image creation?
Definition: comp_target.h:183
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:325
void(* flush)(struct comp_target *ct)
Flush any WSI state before rendering.
Definition: comp_target.h:234
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:297
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:176
void(* destroy)(struct comp_target *ct)
Destroys this target.
Definition: comp_target.h:331
struct comp_target_image * images
Array of images and image views for rendering.
Definition: comp_target.h:152
uint32_t image_count
Number of images that this target has.
Definition: comp_target.h:150
VkResult(* acquire)(struct comp_target *ct, uint32_t *out_index)
Acquire the next image for rendering.
Definition: comp_target.h:209
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:258
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:285
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:170
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:268
const char * name
Name of the backing system.
Definition: comp_target.h:138
VkSurfaceTransformFlagBitsKHR surface_transform
Transformation of the current surface, required for pre-rotation.
Definition: comp_target.h:155
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:247
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:307
struct comp_compositor * c
Owning compositor.
Definition: comp_target.h:135
VkFormat format
The format that the renderpass targeting this target should use.
Definition: comp_target.h:144
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:224
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:317
VkImageLayout final_layout
The final layout that the renderpass should leave this target in.
Definition: comp_target.h:147
Tracing support code, see Tracing support.
Common Vulkan code header.
Header holding common defines.
Common defines and enums for XRT.