c/multi: Add warm start and invalid states

This commit is contained in:
Jakob Bornecrantz 2022-09-14 00:28:01 +01:00 committed by Moses Turner
parent 4b3f97c65d
commit 6faea9224e
2 changed files with 24 additions and 1 deletions

View file

@ -235,7 +235,20 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t displa
enum multi_system_state
{
/*!
* Initial state and post stopping state.
* Invalid state, never used.
*/
MULTI_SYSTEM_STATE_INVALID,
/*!
* One of the initial states, the multi-client system compositor will
* make sure that its @ref xrt_compositor_native submits one frame.
*
* The session hasn't been started yet.
*/
MULTI_SYSTEM_STATE_INIT_WARM_START,
/*!
* One of the initial state and post stopping state.
*
* The multi-client system compositor has called @ref xrt_comp_end_session
* on its @ref xrt_compositor_native.

View file

@ -373,6 +373,14 @@ update_session_state_locked(struct multi_system_compositor *msc)
enum xrt_view_type view_type = XRT_VIEW_TYPE_STEREO;
switch (msc->sessions.state) {
case MULTI_SYSTEM_STATE_INIT_WARM_START:
U_LOG_I("Doing warm start, %u active app session(s).", (uint32_t)msc->sessions.active_count);
// Produce at least one frame on init.
msc->sessions.state = MULTI_SYSTEM_STATE_STOPPING;
xrt_comp_begin_session(xc, view_type);
break;
case MULTI_SYSTEM_STATE_STOPPED:
if (msc->sessions.active_count == 0) {
break;
@ -387,6 +395,7 @@ update_session_state_locked(struct multi_system_compositor *msc)
if (msc->sessions.active_count > 0) {
break;
}
U_LOG_I("Stopping main session, %u active app session(s).", (uint32_t)msc->sessions.active_count);
msc->sessions.state = MULTI_SYSTEM_STATE_STOPPING;
break;
@ -405,6 +414,7 @@ update_session_state_locked(struct multi_system_compositor *msc)
xrt_comp_end_session(xc);
break;
case MULTI_SYSTEM_STATE_INVALID:
default:
U_LOG_E("Got invalid state %u", msc->sessions.state);
msc->sessions.state = MULTI_SYSTEM_STATE_STOPPING;