mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-27 18:16:55 +00:00
st/oxr: Return correct value
When the timeout expires: 1. Don't change the swapchain image index. 2. Return XR_TIMEOUT_EXPIRED. Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2256>
This commit is contained in:
parent
da80ac3f71
commit
9e46337a6a
|
@ -222,14 +222,23 @@ XrResult
|
|||
oxr_swapchain_common_wait(struct oxr_logger *log, struct oxr_swapchain *sc, XrDuration timeout)
|
||||
{
|
||||
uint32_t index = UINT32_MAX;
|
||||
if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!");
|
||||
if (u_index_fifo_peek(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_peek: failed!");
|
||||
}
|
||||
assert(index < INT32_MAX);
|
||||
|
||||
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
|
||||
|
||||
xrt_result_t xret = xrt_swapchain_wait_image(xsc, timeout, index);
|
||||
if (xret == XRT_TIMEOUT) {
|
||||
oxr_warn(log, "call to xrt_swapchain_wait_image timeout");
|
||||
return XR_TIMEOUT_EXPIRED;
|
||||
}
|
||||
|
||||
if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!");
|
||||
}
|
||||
|
||||
OXR_CHECK_XRET(log, sc->sess, xret, xrt_swapchain_wait_image);
|
||||
|
||||
// The app can only wait on one image.
|
||||
|
|
|
@ -61,9 +61,16 @@ vk_implicit_wait_image(struct oxr_logger *log, struct oxr_swapchain *sc, const X
|
|||
CHECK_OXR_RET(oxr_swapchain_verify_wait_state(log, sc));
|
||||
|
||||
uint32_t index = UINT32_MAX;
|
||||
if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!");
|
||||
if (!WAIT_IN_ACQUIRE) {
|
||||
if (u_index_fifo_peek(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_peek: failed!");
|
||||
}
|
||||
} else {
|
||||
if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!");
|
||||
}
|
||||
}
|
||||
|
||||
assert(index < INT32_MAX);
|
||||
|
||||
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
|
||||
|
@ -73,6 +80,15 @@ vk_implicit_wait_image(struct oxr_logger *log, struct oxr_swapchain *sc, const X
|
|||
|
||||
// We have already waited in acquire.
|
||||
xrt_result_t xret = xrt_swapchain_wait_image(xsc, timeout, index);
|
||||
if (xret == XRT_TIMEOUT) {
|
||||
oxr_warn(log, "call to xrt_swapchain_wait_image timeout");
|
||||
return XR_TIMEOUT_EXPIRED;
|
||||
}
|
||||
|
||||
if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!");
|
||||
}
|
||||
|
||||
OXR_CHECK_XRET(log, sc->sess, xret, xrt_swapchain_wait_image);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue