Monado OpenXR Runtime
u_pacing_compositor Struct Reference

Compositor pacing helper interface. More...

#include <util/u_pacing.h>

Collaboration diagram for u_pacing_compositor:

Public Member Functions

static void u_pc_predict (struct u_pacing_compositor *upc, uint64_t now_ns, int64_t *out_frame_id, uint64_t *out_wake_up_time_ns, uint64_t *out_desired_present_time_ns, uint64_t *out_present_slop_ns, uint64_t *out_predicted_display_time_ns, uint64_t *out_predicted_display_period_ns, uint64_t *out_min_display_period_ns)
 Predict the next frame. More...
 
static void u_pc_mark_point (struct u_pacing_compositor *upc, enum u_timing_point point, int64_t frame_id, uint64_t when_ns)
 Mark a point on the frame's lifetime. More...
 
static void u_pc_info (struct u_pacing_compositor *upc, int64_t frame_id, uint64_t desired_present_time_ns, uint64_t actual_present_time_ns, uint64_t earliest_present_time_ns, uint64_t present_margin_ns, uint64_t when_ns)
 Provide frame timing information about a delivered frame. More...
 
static void u_pc_info_gpu (struct u_pacing_compositor *upc, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns)
 Provide frame timing information about GPU start and stop time. More...
 
static void u_pc_update_vblank_from_display_control (struct u_pacing_compositor *upc, uint64_t last_vblank_ns)
 Provide a vblank timing information, derived from the VK_EXT_display_control extension. More...
 
static void u_pc_update_present_offset (struct u_pacing_compositor *upc, int64_t frame_id, uint64_t present_to_display_offset_ns)
 Provide an updated estimate of the present offset. More...
 
static void u_pc_destroy (struct u_pacing_compositor **upc_ptr)
 Destroy this u_pacing_compositor. More...
 

Data Fields

void(* predict )(struct u_pacing_compositor *upc, uint64_t now_ns, int64_t *out_frame_id, uint64_t *out_wake_up_time_ns, uint64_t *out_desired_present_time_ns, uint64_t *out_present_slop_ns, uint64_t *out_predicted_display_time_ns, uint64_t *out_predicted_display_period_ns, uint64_t *out_min_display_period_ns)
 Predict the next frame. More...
 
void(* mark_point )(struct u_pacing_compositor *upc, enum u_timing_point point, int64_t frame_id, uint64_t when_ns)
 Mark a point on the frame's lifetime. More...
 
void(* info )(struct u_pacing_compositor *upc, int64_t frame_id, uint64_t desired_present_time_ns, uint64_t actual_present_time_ns, uint64_t earliest_present_time_ns, uint64_t present_margin_ns, uint64_t when_ns)
 Provide frame timing information about a delivered frame. More...
 
void(* info_gpu )(struct u_pacing_compositor *upc, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns)
 Provide frame timing information about GPU start and stop time. More...
 
void(* update_vblank_from_display_control )(struct u_pacing_compositor *upc, uint64_t last_vblank_ns)
 Provide a vblank timing information, derived from the VK_EXT_display_control extension. More...
 
void(* update_present_offset )(struct u_pacing_compositor *upc, int64_t frame_id, uint64_t present_to_display_offset_ns)
 Provide an updated estimate of the present offset. More...
 
void(* destroy )(struct u_pacing_compositor *upc)
 Destroy this u_pacing_compositor. More...
 

Detailed Description

Compositor pacing helper interface.

This is used for the compositor's own frame timing/pacing. It is not responsible for getting the timing data from the graphics API, etc: instead it consumes timing data from the graphics API (if available) and from "markers" in the compositor's CPU code, and produces predictions that are used to guide the compositor.

Pacing of the underlying app/client is handled by u_pacing_app

Field Documentation

◆ destroy

void(* u_pacing_compositor::destroy) (struct u_pacing_compositor *upc)

Destroy this u_pacing_compositor.

Referenced by u_pc_destroy().

◆ info

void(* u_pacing_compositor::info) (struct u_pacing_compositor *upc, int64_t frame_id, uint64_t desired_present_time_ns, uint64_t actual_present_time_ns, uint64_t earliest_present_time_ns, uint64_t present_margin_ns, uint64_t when_ns)

Provide frame timing information about a delivered frame.

This is usually provided after-the-fact by the display system. These arguments currently matches 1-to-1 what VK_GOOGLE_display_timing provides, see https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPastPresentationTimingGOOGLE.html

Depend on when the information is delivered this can be called at any point of the following frames.

Parameters
[in]upcThe compositor pacing helper.
[in]frame_idThe frame ID to record for.
[in]desired_present_time_nsThe time that we indicated the GPU should start scanning out at, or zero if we didn't provide such a time.
[in]actual_present_time_nsThe time that the GPU actually started scanning out.
[in]earliest_present_time_nsThe earliest the GPU could have presented - might be before actual_present_time_ns if a desired_present_time_ns was passed.
[in]present_margin_nsHow "early" present happened compared to when it needed to happen in order to finish at earliestPresentTime.
[in]when_nsThe time when we got the info, nominally from os_monotonic_get_ns
See also
Frame Pacing/Timing.

Referenced by u_pc_info().

◆ info_gpu

void(* u_pacing_compositor::info_gpu) (struct u_pacing_compositor *upc, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns)

Provide frame timing information about GPU start and stop time.

Depend on when the information is delivered this can be called at any point of the following frames.

Parameters
[in]upcThe compositor pacing helper.
[in]frame_idThe frame ID to record for.
[in]gpu_start_nsWhen the GPU work startred.
[in]gpu_end_nsWhen the GPU work stopped.
[in]when_nsWhen the informatioon collected, nominally from os_monotonic_get_ns.
See also
Frame Pacing/Timing.

Referenced by u_pc_info_gpu().

◆ mark_point

void(* u_pacing_compositor::mark_point) (struct u_pacing_compositor *upc, enum u_timing_point point, int64_t frame_id, uint64_t when_ns)

Mark a point on the frame's lifetime.

This is usually provided "when it happens" because the points to mark are steps in the CPU workload of the compositor.

Parameters
[in]upcThe compositor pacing helper.
[in]pointThe point to record for a frame.
[in]frame_idThe frame ID to record for.
[in]when_nsThe timestamp of the event.
See also
Frame Pacing/Timing.

Referenced by u_pc_mark_point().

◆ predict

void(* u_pacing_compositor::predict) (struct u_pacing_compositor *upc, uint64_t now_ns, int64_t *out_frame_id, uint64_t *out_wake_up_time_ns, uint64_t *out_desired_present_time_ns, uint64_t *out_present_slop_ns, uint64_t *out_predicted_display_time_ns, uint64_t *out_predicted_display_period_ns, uint64_t *out_min_display_period_ns)

Predict the next frame.

Parameters
[in]upcThe compositor pacing helper.
[in]now_nsThe current timestamp in nanoseconds, nominally from os_monotonic_get_ns
[out]out_frame_idId used to refer to this frame again.
[out]out_wake_up_time_nsWhen should the compositor wake up.
[out]out_desired_present_time_nsThe GPU should start scanning out at this time.
[out]out_present_slop_nsAny looseness to the desired present timing.
[out]out_predicted_display_time_nsAt what time have we predicted that pixels turns to photons.
[out]out_predicted_display_period_nsDisplay period that we are running on.
[out]out_min_display_period_nsThe fastest theoretical display period.
See also
Frame Pacing/Timing.

Referenced by u_pc_display_timing_create(), u_pc_fake_create(), and u_pc_predict().

◆ update_present_offset

void(* u_pacing_compositor::update_present_offset) (struct u_pacing_compositor *upc, int64_t frame_id, uint64_t present_to_display_offset_ns)

Provide an updated estimate of the present offset.

This is usually used only for more complicated display systems.

Parameters
[in]upcThe compositor pacing helper.
[in]frame_idThe frame ID to record for.
[in]present_to_display_offset_nsThe improved estimate of the time between "present" and photons.
See also
Frame Pacing/Timing.

Referenced by u_pc_update_present_offset().

◆ update_vblank_from_display_control

void(* u_pacing_compositor::update_vblank_from_display_control) (struct u_pacing_compositor *upc, uint64_t last_vblank_ns)

Provide a vblank timing information, derived from the VK_EXT_display_control extension.

Since the extension only says when a vblank happened (somewhat inaccurate as well) but not if a specific present happened at that time no frame_id is given.

Parameters
[in]upcThe compositor pacing helper.
[in]last_vblank_nsThe last time that the GPU started scanning out.
See also
Frame Pacing/Timing.

Referenced by u_pc_update_vblank_from_display_control().


The documentation for this struct was generated from the following file: