The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/pacing: Track when the app wants the frame to be displayed

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
47649f56 8e8a0b38

+16 -8
+7 -6
src/xrt/auxiliary/util/u_pacing.h
··· 319 319 * A frame has been delivered from the client, see `xrEndFrame`. The GPU might 320 320 * still be rendering the work. 321 321 * 322 - * @param upa Render timing helper. 323 - * @param[in] frame_id The frame ID to mark as delivered. 324 - * @param[in] when_ns The time when it was delivered, nominally from @ref os_monotonic_get_ns 322 + * @param upa Render timing helper. 323 + * @param[in] frame_id The frame ID to mark as delivered. 324 + * @param[in] when_ns The time when it was delivered, nominally from @ref os_monotonic_get_ns 325 + * @param[in] display_time_ns The time the frame is to be displayed. 325 326 */ 326 - void (*mark_delivered)(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns); 327 + void (*mark_delivered)(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns, uint64_t display_time_ns); 327 328 328 329 /*! 329 330 * A frame has been completed rendered by the GPU, this can happen after `xrEndFrame` has returned. ··· 420 421 * @ingroup aux_pacing 421 422 */ 422 423 static inline void 423 - u_pa_mark_delivered(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns) 424 + u_pa_mark_delivered(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns, uint64_t display_time_ns) 424 425 { 425 - upa->mark_delivered(upa, frame_id, when_ns); 426 + upa->mark_delivered(upa, frame_id, when_ns, display_time_ns); 426 427 } 427 428 428 429 /*!
+8 -1
src/xrt/auxiliary/util/u_pacing_app.c
··· 59 59 //! When the client should have delivered the frame. 60 60 uint64_t predicted_delivery_time_ns; 61 61 62 + /*! 63 + * When the app told us to display this frame, can be different 64 + * then the predicted display time so we track that separately. 65 + */ 66 + uint64_t display_time_ns; 67 + 62 68 //! When something happened. 63 69 struct 64 70 { ··· 309 315 } 310 316 311 317 static void 312 - pa_mark_delivered(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns) 318 + pa_mark_delivered(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns, uint64_t display_time_ns) 313 319 { 314 320 struct pacing_app *pa = pacing_app(upa); 315 321 ··· 321 327 assert(f->state == U_RT_BEGUN); 322 328 323 329 f->when.delivered_ns = when_ns; 330 + f->display_time_ns = display_time_ns; 324 331 f->state = U_RT_DELIVERED; 325 332 } 326 333
+1 -1
src/xrt/compositor/multi/comp_multi_compositor.c
··· 327 327 // As early as possible. 328 328 uint64_t now_ns = os_monotonic_get_ns(); 329 329 os_mutex_lock(&mc->msc->list_and_timing_lock); 330 - u_pa_mark_delivered(mc->upa, frame_id, now_ns); 330 + u_pa_mark_delivered(mc->upa, frame_id, now_ns, display_time_ns); 331 331 os_mutex_unlock(&mc->msc->list_and_timing_lock); 332 332 333 333 assert(mc->progress.layer_count == 0);