From 772b6256d6bc8076b1d0018674e390954a6d1828 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz <jakob@collabora.com> Date: Wed, 2 Mar 2022 10:55:40 +0000 Subject: [PATCH] c/multi: Handle fence timeouts --- .../compositor/multi/comp_multi_compositor.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/xrt/compositor/multi/comp_multi_compositor.c b/src/xrt/compositor/multi/comp_multi_compositor.c index ea9991616..354d85864 100644 --- a/src/xrt/compositor/multi/comp_multi_compositor.c +++ b/src/xrt/compositor/multi/comp_multi_compositor.c @@ -445,8 +445,25 @@ static void wait_fence(struct xrt_compositor_fence **xcf_ptr) { COMP_TRACE_MARKER(); - xrt_compositor_fence_wait(*xcf_ptr, UINT64_MAX); + xrt_result_t ret = XRT_SUCCESS; + + // 100ms + uint64_t timeout_ns = 100 * U_TIME_1MS_IN_NS; + + do { + ret = xrt_compositor_fence_wait(*xcf_ptr, timeout_ns); + if (ret != XRT_TIMEOUT) { + break; + } + + U_LOG_W("Waiting on client fence timed out > 100ms!"); + } while (true); + xrt_compositor_fence_destroy(xcf_ptr); + + if (ret != XRT_SUCCESS) { + U_LOG_E("Fence waiting failed!"); + } } static void