u/pacing: Add gpu_info to u_pacing_compositor

This commit is contained in:
Jakob Bornecrantz 2022-09-22 23:47:44 +01:00 committed by Jakob Bornecrantz
parent da542e3f5e
commit f63c786ac9
3 changed files with 53 additions and 0 deletions

View file

@ -134,6 +134,27 @@ struct u_pacing_compositor
uint64_t present_margin_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.
*
* @param[in] upc The compositor pacing helper.
* @param[in] frame_id The frame ID to record for.
* @param[in] gpu_start_ns When the GPU work startred.
* @param[in] gpu_end_ns When the GPU work stopped.
* @param[in] when_ns When the informatioon collected, nominally
* from @ref os_monotonic_get_ns.
*
* @see @ref frame-pacing.
*/
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 a vblank timing information, derived from the
* VK_EXT_display_control extension. Since the extension only says when
@ -233,6 +254,22 @@ u_pc_info(struct u_pacing_compositor *upc,
present_margin_ns, when_ns);
}
/*!
* @copydoc u_pacing_compositor::info_gpu
*
* Helper for calling through the function pointer.
*
* @public @memberof u_pacing_compositor
* @ingroup aux_pacing
*/
static inline 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)
{
upc->info_gpu(upc, frame_id, gpu_start_ns, gpu_end_ns, when_ns);
}
/*!
* @copydoc u_pacing_compositor::update_vblank_from_display_control
*

View file

@ -641,6 +641,13 @@ pc_info(struct u_pacing_compositor *upc,
#undef TE_END
}
static void
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)
{
// No-op
}
static void
pc_update_vblank_from_display_control(struct u_pacing_compositor *upc, uint64_t last_vblank_ns)
{
@ -690,6 +697,7 @@ u_pc_display_timing_create(uint64_t estimated_frame_period_ns,
pc->base.predict = pc_predict;
pc->base.mark_point = pc_mark_point;
pc->base.info = pc_info;
pc->base.info_gpu = pc_info_gpu;
pc->base.update_vblank_from_display_control = pc_update_vblank_from_display_control;
pc->base.update_present_offset = pc_update_present_offset;
pc->base.destroy = pc_destroy;

View file

@ -152,6 +152,13 @@ pc_info(struct u_pacing_compositor *upc,
*/
}
static void
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)
{
// No-op
}
static void
pc_update_vblank_from_display_control(struct u_pacing_compositor *upc, uint64_t last_vblank_ns)
{
@ -193,6 +200,7 @@ u_pc_fake_create(uint64_t estimated_frame_period_ns, uint64_t now_ns, struct u_p
ft->base.predict = pc_predict;
ft->base.mark_point = pc_mark_point;
ft->base.info = pc_info;
ft->base.info_gpu = pc_info_gpu;
ft->base.update_vblank_from_display_control = pc_update_vblank_from_display_control;
ft->base.update_present_offset = pc_update_present_offset;
ft->base.destroy = pc_destroy;