From 6faea9224e3a0481d77da0bf0317626dbb277565 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz <jakob@collabora.com> Date: Wed, 14 Sep 2022 00:28:01 +0100 Subject: [PATCH] c/multi: Add warm start and invalid states --- src/xrt/compositor/multi/comp_multi_private.h | 15 ++++++++++++++- src/xrt/compositor/multi/comp_multi_system.c | 10 ++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/xrt/compositor/multi/comp_multi_private.h b/src/xrt/compositor/multi/comp_multi_private.h index f9babac0f..12dfd553b 100644 --- a/src/xrt/compositor/multi/comp_multi_private.h +++ b/src/xrt/compositor/multi/comp_multi_private.h @@ -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. diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c index f68068011..db6bffd93 100644 --- a/src/xrt/compositor/multi/comp_multi_system.c +++ b/src/xrt/compositor/multi/comp_multi_system.c @@ -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;