c/multi: Make sure to retire delivered frames once the session goes invisible or non-active

Launching two instances of hello_xr will cause an assert in the app pacer.
This commit is contained in:
Jakob Bornecrantz 2022-09-29 01:25:41 +01:00
parent 88ce42dbf9
commit 5fc30a4e22
3 changed files with 21 additions and 0 deletions

View file

@ -942,6 +942,12 @@ multi_compositor_latch_frame_locked(struct multi_compositor *mc, uint64_t when_n
u_pa_latched(mc->upa, mc->delivered.frame_id, when_ns, system_frame_id);
}
void
multi_compositor_retire_delivered_locked(struct multi_compositor *mc, uint64_t when_ns)
{
slot_clear_locked(mc, &mc->delivered);
}
xrt_result_t
multi_compositor_create(struct multi_system_compositor *msc,
const struct xrt_session_info *xsi,

View file

@ -228,6 +228,16 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t displa
void
multi_compositor_latch_frame_locked(struct multi_compositor *mc, uint64_t when_ns, int64_t system_frame_id);
/*!
* Clears and retires the delivered frame, called by the render thread.
* The list_and_timing_lock is held when this function is called.
*
* @ingroup comp_multi
* @private @memberof multi_compositor
*/
void
multi_compositor_retire_delivered_locked(struct multi_compositor *mc, uint64_t when_ns);
/*
*

View file

@ -257,12 +257,17 @@ transfer_layers_locked(struct multi_system_compositor *msc, uint64_t display_tim
// The client isn't visible, do not submit it's layers.
if (!mc->state.visible) {
// Need to drop delivered frame as it shouldn't be reused.
multi_compositor_retire_delivered_locked(mc, now_ns);
continue;
}
// Just in case.
if (!mc->state.session_active) {
U_LOG_W("Session is visible but not active.");
// Need to drop delivered frame as it shouldn't be reused.
multi_compositor_retire_delivered_locked(mc, now_ns);
continue;
}