···165 /*!
166 * The next which the next frames to be picked up will be displayed.
167 */
168- uint64_t slot_next_frame_display;
169170 /*!
171 * Currently being transferred or waited on.
···225 * @private @memberof multi_compositor
226 */
227void
228-multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t display_time_ns);
229230/*!
231 * Makes the current delivered frame as latched, called by the render thread.
···235 * @private @memberof multi_compositor
236 */
237void
238-multi_compositor_latch_frame_locked(struct multi_compositor *mc, uint64_t when_ns, int64_t system_frame_id);
239240/*!
241 * Clears and retires the delivered frame, called by the render thread.
···245 * @private @memberof multi_compositor
246 */
247void
248-multi_compositor_retire_delivered_locked(struct multi_compositor *mc, uint64_t when_ns);
249250251/*
···358359 struct
360 {
361- uint64_t predicted_display_time_ns;
362- uint64_t predicted_display_period_ns;
363- uint64_t diff_ns;
364 } last_timings;
365366 //! List of active clients.
···165 /*!
166 * The next which the next frames to be picked up will be displayed.
167 */
168+ int64_t slot_next_frame_display;
169170 /*!
171 * Currently being transferred or waited on.
···225 * @private @memberof multi_compositor
226 */
227void
228+multi_compositor_deliver_any_frames(struct multi_compositor *mc, int64_t display_time_ns);
229230/*!
231 * Makes the current delivered frame as latched, called by the render thread.
···235 * @private @memberof multi_compositor
236 */
237void
238+multi_compositor_latch_frame_locked(struct multi_compositor *mc, int64_t when_ns, int64_t system_frame_id);
239240/*!
241 * Clears and retires the delivered frame, called by the render thread.
···245 * @private @memberof multi_compositor
246 */
247void
248+multi_compositor_retire_delivered_locked(struct multi_compositor *mc, int64_t when_ns);
249250251/*
···358359 struct
360 {
361+ int64_t predicted_display_time_ns;
362+ int64_t predicted_display_period_ns;
363+ int64_t diff_ns;
364 } last_timings;
365366 //! List of active clients.
+15-15
src/xrt/compositor/multi/comp_multi_system.c
···251}
252253static void
254-transfer_layers_locked(struct multi_system_compositor *msc, uint64_t display_time_ns, int64_t system_frame_id)
255{
256 COMP_TRACE_MARKER();
257···260 struct multi_compositor *array[MULTI_MAX_CLIENTS] = {0};
261262 // To mark latching.
263- uint64_t now_ns = os_monotonic_get_ns();
264265 size_t count = 0;
266 for (size_t k = 0; k < ARRAY_SIZE(array); k++) {
···337}
338339static void
340-broadcast_timings_to_clients(struct multi_system_compositor *msc, uint64_t predicted_display_time_ns)
341{
342 COMP_TRACE_MARKER();
343···359360static void
361broadcast_timings_to_pacers(struct multi_system_compositor *msc,
362- uint64_t predicted_display_time_ns,
363- uint64_t predicted_display_period_ns,
364- uint64_t diff_ns)
365{
366 COMP_TRACE_MARKER();
367···392}
393394static void
395-wait_frame(struct os_precise_sleeper *sleeper, struct xrt_compositor *xc, int64_t frame_id, uint64_t wake_up_time_ns)
396{
397 COMP_TRACE_MARKER();
398399 // Wait until the given wake up time.
400 u_wait_until(sleeper, wake_up_time_ns);
401402- uint64_t now_ns = os_monotonic_get_ns();
403404 // Signal that we woke up.
405 xrt_comp_mark_frame(xc, frame_id, XRT_COMPOSITOR_FRAME_POINT_WOKE, now_ns);
···507 os_thread_helper_unlock(&msc->oth);
508509 int64_t frame_id = -1;
510- uint64_t wake_up_time_ns = 0;
511- uint64_t predicted_gpu_time_ns = 0;
512- uint64_t predicted_display_time_ns = 0;
513- uint64_t predicted_display_period_ns = 0;
514515 // Get the information for the next frame.
516 xrt_comp_predict_frame( //
···527 // Now we can wait.
528 wait_frame(&sleeper, xc, frame_id, wake_up_time_ns);
529530- uint64_t now_ns = os_monotonic_get_ns();
531- uint64_t diff_ns = predicted_display_time_ns - now_ns;
532533 // Now we know the diff, broadcast to pacers.
534 broadcast_timings_to_pacers(msc, predicted_display_time_ns, predicted_display_period_ns, diff_ns);
···630static xrt_result_t
631system_compositor_notify_loss_pending(struct xrt_system_compositor *xsc,
632 struct xrt_compositor *xc,
633- uint64_t loss_time_ns)
634{
635 struct multi_system_compositor *msc = multi_system_compositor(xsc);
636 struct multi_compositor *mc = multi_compositor(xc);
···251}
252253static void
254+transfer_layers_locked(struct multi_system_compositor *msc, int64_t display_time_ns, int64_t system_frame_id)
255{
256 COMP_TRACE_MARKER();
257···260 struct multi_compositor *array[MULTI_MAX_CLIENTS] = {0};
261262 // To mark latching.
263+ int64_t now_ns = os_monotonic_get_ns();
264265 size_t count = 0;
266 for (size_t k = 0; k < ARRAY_SIZE(array); k++) {
···337}
338339static void
340+broadcast_timings_to_clients(struct multi_system_compositor *msc, int64_t predicted_display_time_ns)
341{
342 COMP_TRACE_MARKER();
343···359360static void
361broadcast_timings_to_pacers(struct multi_system_compositor *msc,
362+ int64_t predicted_display_time_ns,
363+ int64_t predicted_display_period_ns,
364+ int64_t diff_ns)
365{
366 COMP_TRACE_MARKER();
367···392}
393394static void
395+wait_frame(struct os_precise_sleeper *sleeper, struct xrt_compositor *xc, int64_t frame_id, int64_t wake_up_time_ns)
396{
397 COMP_TRACE_MARKER();
398399 // Wait until the given wake up time.
400 u_wait_until(sleeper, wake_up_time_ns);
401402+ int64_t now_ns = os_monotonic_get_ns();
403404 // Signal that we woke up.
405 xrt_comp_mark_frame(xc, frame_id, XRT_COMPOSITOR_FRAME_POINT_WOKE, now_ns);
···507 os_thread_helper_unlock(&msc->oth);
508509 int64_t frame_id = -1;
510+ int64_t wake_up_time_ns = 0;
511+ int64_t predicted_gpu_time_ns = 0;
512+ int64_t predicted_display_time_ns = 0;
513+ int64_t predicted_display_period_ns = 0;
514515 // Get the information for the next frame.
516 xrt_comp_predict_frame( //
···527 // Now we can wait.
528 wait_frame(&sleeper, xc, frame_id, wake_up_time_ns);
529530+ int64_t now_ns = os_monotonic_get_ns();
531+ int64_t diff_ns = predicted_display_time_ns - now_ns;
532533 // Now we know the diff, broadcast to pacers.
534 broadcast_timings_to_pacers(msc, predicted_display_time_ns, predicted_display_period_ns, diff_ns);
···630static xrt_result_t
631system_compositor_notify_loss_pending(struct xrt_system_compositor *xsc,
632 struct xrt_compositor *xc,
633+ int64_t loss_time_ns)
634{
635 struct multi_system_compositor *msc = multi_system_compositor(xsc);
636 struct multi_compositor *mc = multi_compositor(xc);