From e7643de8dbb10884736107284c2fdad56c7a6c83 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 3 Nov 2020 21:04:01 +0000 Subject: [PATCH] c/main: Revert "Transition to visible/focused after xrEndFrame, not xrWaitFrame" This reverts commit e03ee48dcea88427ac3272ccab70bb665b1618a4. --- src/xrt/compositor/main/comp_compositor.c | 15 +++++++++------ src/xrt/compositor/main/comp_compositor.h | 2 +- src/xrt/state_trackers/oxr/oxr_session.c | 5 ----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c index da39a4391..afd58c7b1 100644 --- a/src/xrt/compositor/main/comp_compositor.c +++ b/src/xrt/compositor/main/comp_compositor.c @@ -210,6 +210,9 @@ compositor_wait_frame(struct xrt_compositor *xc, *predicted_display_time = c->last_next_display_time; *out_frame_id = c->last_next_display_time; + if (c->state == COMP_STATE_PREPARED) { + c->state = COMP_STATE_WAITED; + } return XRT_SUCCESS; } @@ -242,6 +245,10 @@ compositor_wait_frame(struct xrt_compositor *xc, *out_frame_id = c->last_next_display_time; c->last_next_display_time = next_display_time; + + if (c->state == COMP_STATE_PREPARED) { + c->state = COMP_STATE_WAITED; + } return XRT_SUCCESS; } } @@ -507,10 +514,6 @@ compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id) c->expected_app_duration_ns = c->app_profiling.last_end - c->app_profiling.last_begin; - if (c->state == COMP_STATE_PREPARED) { - c->state = COMP_STATE_COMMITTED; - } - // Now is a good point to garbage collect. comp_compositor_garbage_collect(c); return XRT_SUCCESS; @@ -532,8 +535,8 @@ compositor_poll_events(struct xrt_compositor *xc, case COMP_STATE_PREPARED: out_xce->state.type = XRT_COMPOSITOR_EVENT_NONE; break; - case COMP_STATE_COMMITTED: - COMP_DEBUG(c, "COMMITTED -> VISIBLE"); + case COMP_STATE_WAITED: + COMP_DEBUG(c, "WAITED -> VISIBLE"); out_xce->state.type = XRT_COMPOSITOR_EVENT_STATE_CHANGE; out_xce->state.visible = true; c->state = COMP_STATE_VISIBLE; diff --git a/src/xrt/compositor/main/comp_compositor.h b/src/xrt/compositor/main/comp_compositor.h index daea3a23e..9448704be 100644 --- a/src/xrt/compositor/main/comp_compositor.h +++ b/src/xrt/compositor/main/comp_compositor.h @@ -129,7 +129,7 @@ enum comp_state { COMP_STATE_READY = 0, COMP_STATE_PREPARED = 1, - COMP_STATE_COMMITTED = 2, + COMP_STATE_WAITED = 2, COMP_STATE_VISIBLE = 3, COMP_STATE_FOCUSED = 4, }; diff --git a/src/xrt/state_trackers/oxr/oxr_session.c b/src/xrt/state_trackers/oxr/oxr_session.c index 6245e6a07..f9c872e2a 100644 --- a/src/xrt/state_trackers/oxr/oxr_session.c +++ b/src/xrt/state_trackers/oxr/oxr_session.c @@ -1898,11 +1898,6 @@ oxr_session_frame_end(struct oxr_logger *log, do_synchronize_state_change(log, sess); - // For emitting state changes, the compositor has to know - // whether the client is synchronized, i.e. has called - // xrEndFrame, even with 0 layers. - CALL_CHK(xrt_comp_layer_commit(xc, -1)); - return oxr_session_success_result(sess); }