xrt: Add xrt_result_t return type to many functions

Many functions returned void and were assumed to always succeed, and some functions
returned only a bool to indicate vague success/failure.

Now that these functions get piped over IPC all of them have to be able to indicate
an IPC failure like for example an unreachable service.

With the xrt_result_t return type they now have the opportunity to report various
types of failures.
This commit is contained in:
Christoph Haag 2020-06-04 14:31:01 +02:00
parent db5db10a19
commit cc9b415a8f
9 changed files with 205 additions and 156 deletions

View file

@ -55,7 +55,7 @@ client_gl_swapchain_destroy(struct xrt_swapchain *xsc)
free(sc); free(sc);
} }
static bool static xrt_result_t
client_gl_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index) client_gl_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
{ {
struct client_gl_swapchain *sc = client_gl_swapchain(xsc); struct client_gl_swapchain *sc = client_gl_swapchain(xsc);
@ -64,7 +64,7 @@ client_gl_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
return xrt_swapchain_acquire_image(&sc->xscfd->base, index); return xrt_swapchain_acquire_image(&sc->xscfd->base, index);
} }
static bool static xrt_result_t
client_gl_swapchain_wait_image(struct xrt_swapchain *xsc, client_gl_swapchain_wait_image(struct xrt_swapchain *xsc,
uint64_t timeout, uint64_t timeout,
uint32_t index) uint32_t index)
@ -75,7 +75,7 @@ client_gl_swapchain_wait_image(struct xrt_swapchain *xsc,
return xrt_swapchain_wait_image(&sc->xscfd->base, timeout, index); return xrt_swapchain_wait_image(&sc->xscfd->base, timeout, index);
} }
static bool static xrt_result_t
client_gl_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index) client_gl_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
{ {
struct client_gl_swapchain *sc = client_gl_swapchain(xsc); struct client_gl_swapchain *sc = client_gl_swapchain(xsc);
@ -91,60 +91,60 @@ client_gl_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
* *
*/ */
static void static xrt_result_t
client_gl_compositor_begin_session(struct xrt_compositor *xc, client_gl_compositor_begin_session(struct xrt_compositor *xc,
enum xrt_view_type type) enum xrt_view_type type)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_begin_session(&c->xcfd->base, type); return xrt_comp_begin_session(&c->xcfd->base, type);
} }
static void static xrt_result_t
client_gl_compositor_end_session(struct xrt_compositor *xc) client_gl_compositor_end_session(struct xrt_compositor *xc)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_end_session(&c->xcfd->base); return xrt_comp_end_session(&c->xcfd->base);
} }
static void static xrt_result_t
client_gl_compositor_wait_frame(struct xrt_compositor *xc, client_gl_compositor_wait_frame(struct xrt_compositor *xc,
uint64_t *predicted_display_time, uint64_t *predicted_display_time,
uint64_t *predicted_display_period) uint64_t *predicted_display_period)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_wait_frame(&c->xcfd->base, predicted_display_time, return xrt_comp_wait_frame(&c->xcfd->base, predicted_display_time,
predicted_display_period); predicted_display_period);
} }
static void static xrt_result_t
client_gl_compositor_begin_frame(struct xrt_compositor *xc) client_gl_compositor_begin_frame(struct xrt_compositor *xc)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_begin_frame(&c->xcfd->base); return xrt_comp_begin_frame(&c->xcfd->base);
} }
static void static xrt_result_t
client_gl_compositor_discard_frame(struct xrt_compositor *xc) client_gl_compositor_discard_frame(struct xrt_compositor *xc)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_discard_frame(&c->xcfd->base); return xrt_comp_discard_frame(&c->xcfd->base);
} }
static void static xrt_result_t
client_gl_compositor_layer_begin(struct xrt_compositor *xc, client_gl_compositor_layer_begin(struct xrt_compositor *xc,
enum xrt_blend_mode env_blend_mode) enum xrt_blend_mode env_blend_mode)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
xrt_comp_layer_begin(&c->xcfd->base, env_blend_mode); return xrt_comp_layer_begin(&c->xcfd->base, env_blend_mode);
} }
static void static xrt_result_t
client_gl_compositor_layer_stereo_projection( client_gl_compositor_layer_stereo_projection(
struct xrt_compositor *xc, struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
@ -171,13 +171,13 @@ client_gl_compositor_layer_stereo_projection(
l_xscfd = &client_gl_swapchain(l_sc)->xscfd->base; l_xscfd = &client_gl_swapchain(l_sc)->xscfd->base;
r_xscfd = &client_gl_swapchain(r_sc)->xscfd->base; r_xscfd = &client_gl_swapchain(r_sc)->xscfd->base;
xrt_comp_layer_stereo_projection( return xrt_comp_layer_stereo_projection(
&c->xcfd->base, timestamp, xdev, name, layer_flags, l_xscfd, &c->xcfd->base, timestamp, xdev, name, layer_flags, l_xscfd,
l_image_index, l_rect, l_array_index, l_fov, l_pose, r_xscfd, l_image_index, l_rect, l_array_index, l_fov, l_pose, r_xscfd,
r_image_index, r_rect, r_array_index, r_fov, r_pose, true); r_image_index, r_rect, r_array_index, r_fov, r_pose, true);
} }
static void static xrt_result_t
client_gl_compositor_layer_quad(struct xrt_compositor *xc, client_gl_compositor_layer_quad(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -197,17 +197,17 @@ client_gl_compositor_layer_quad(struct xrt_compositor *xc,
xscfb = &client_gl_swapchain(sc)->xscfd->base; xscfb = &client_gl_swapchain(sc)->xscfd->base;
xrt_comp_layer_quad(&c->xcfd->base, timestamp, xdev, name, layer_flags, return xrt_comp_layer_quad(&c->xcfd->base, timestamp, xdev, name,
visibility, xscfb, image_index, rect, array_index, layer_flags, visibility, xscfb, image_index,
pose, size, true); rect, array_index, pose, size, true);
} }
static void static xrt_result_t
client_gl_compositor_layer_commit(struct xrt_compositor *xc) client_gl_compositor_layer_commit(struct xrt_compositor *xc)
{ {
struct client_gl_compositor *c = client_gl_compositor(xc); struct client_gl_compositor *c = client_gl_compositor(xc);
xrt_comp_layer_commit(&c->xcfd->base); return xrt_comp_layer_commit(&c->xcfd->base);
} }
static int64_t static int64_t

View file

@ -69,7 +69,7 @@ client_vk_swapchain_destroy(struct xrt_swapchain *xsc)
free(sc); free(sc);
} }
static bool static xrt_result_t
client_vk_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index) client_vk_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
{ {
struct client_vk_swapchain *sc = client_vk_swapchain(xsc); struct client_vk_swapchain *sc = client_vk_swapchain(xsc);
@ -78,7 +78,7 @@ client_vk_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
return xrt_swapchain_acquire_image(&sc->xscfd->base, index); return xrt_swapchain_acquire_image(&sc->xscfd->base, index);
} }
static bool static xrt_result_t
client_vk_swapchain_wait_image(struct xrt_swapchain *xsc, client_vk_swapchain_wait_image(struct xrt_swapchain *xsc,
uint64_t timeout, uint64_t timeout,
uint32_t index) uint32_t index)
@ -89,7 +89,7 @@ client_vk_swapchain_wait_image(struct xrt_swapchain *xsc,
return xrt_swapchain_wait_image(&sc->xscfd->base, timeout, index); return xrt_swapchain_wait_image(&sc->xscfd->base, timeout, index);
} }
static bool static xrt_result_t
client_vk_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index) client_vk_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
{ {
struct client_vk_swapchain *sc = client_vk_swapchain(xsc); struct client_vk_swapchain *sc = client_vk_swapchain(xsc);
@ -120,60 +120,60 @@ client_vk_compositor_destroy(struct xrt_compositor *xc)
free(c); free(c);
} }
static void static xrt_result_t
client_vk_compositor_begin_session(struct xrt_compositor *xc, client_vk_compositor_begin_session(struct xrt_compositor *xc,
enum xrt_view_type type) enum xrt_view_type type)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_begin_session(&c->xcfd->base, type); return xrt_comp_begin_session(&c->xcfd->base, type);
} }
static void static xrt_result_t
client_vk_compositor_end_session(struct xrt_compositor *xc) client_vk_compositor_end_session(struct xrt_compositor *xc)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_end_session(&c->xcfd->base); return xrt_comp_end_session(&c->xcfd->base);
} }
static void static xrt_result_t
client_vk_compositor_wait_frame(struct xrt_compositor *xc, client_vk_compositor_wait_frame(struct xrt_compositor *xc,
uint64_t *predicted_display_time, uint64_t *predicted_display_time,
uint64_t *predicted_display_period) uint64_t *predicted_display_period)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_wait_frame(&c->xcfd->base, predicted_display_time, return xrt_comp_wait_frame(&c->xcfd->base, predicted_display_time,
predicted_display_period); predicted_display_period);
} }
static void static xrt_result_t
client_vk_compositor_begin_frame(struct xrt_compositor *xc) client_vk_compositor_begin_frame(struct xrt_compositor *xc)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_begin_frame(&c->xcfd->base); return xrt_comp_begin_frame(&c->xcfd->base);
} }
static void static xrt_result_t
client_vk_compositor_discard_frame(struct xrt_compositor *xc) client_vk_compositor_discard_frame(struct xrt_compositor *xc)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
// Pipe down call into fd compositor. // Pipe down call into fd compositor.
xrt_comp_discard_frame(&c->xcfd->base); return xrt_comp_discard_frame(&c->xcfd->base);
} }
static void static xrt_result_t
client_vk_compositor_layer_begin(struct xrt_compositor *xc, client_vk_compositor_layer_begin(struct xrt_compositor *xc,
enum xrt_blend_mode env_blend_mode) enum xrt_blend_mode env_blend_mode)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
xrt_comp_layer_begin(&c->xcfd->base, env_blend_mode); return xrt_comp_layer_begin(&c->xcfd->base, env_blend_mode);
} }
static void static xrt_result_t
client_vk_compositor_layer_stereo_projection( client_vk_compositor_layer_stereo_projection(
struct xrt_compositor *xc, struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
@ -200,13 +200,13 @@ client_vk_compositor_layer_stereo_projection(
l_xscfd = &client_vk_swapchain(l_sc)->xscfd->base; l_xscfd = &client_vk_swapchain(l_sc)->xscfd->base;
r_xscfd = &client_vk_swapchain(r_sc)->xscfd->base; r_xscfd = &client_vk_swapchain(r_sc)->xscfd->base;
xrt_comp_layer_stereo_projection( return xrt_comp_layer_stereo_projection(
&c->xcfd->base, timestamp, xdev, name, layer_flags, l_xscfd, &c->xcfd->base, timestamp, xdev, name, layer_flags, l_xscfd,
l_image_index, l_rect, l_array_index, l_fov, l_pose, r_xscfd, l_image_index, l_rect, l_array_index, l_fov, l_pose, r_xscfd,
r_image_index, r_rect, r_array_index, r_fov, r_pose, false); r_image_index, r_rect, r_array_index, r_fov, r_pose, false);
} }
static void static xrt_result_t
client_vk_compositor_layer_quad(struct xrt_compositor *xc, client_vk_compositor_layer_quad(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -226,17 +226,17 @@ client_vk_compositor_layer_quad(struct xrt_compositor *xc,
xscfb = &client_vk_swapchain(sc)->xscfd->base; xscfb = &client_vk_swapchain(sc)->xscfd->base;
xrt_comp_layer_quad(&c->xcfd->base, timestamp, xdev, name, layer_flags, return xrt_comp_layer_quad(&c->xcfd->base, timestamp, xdev, name,
visibility, xscfb, image_index, rect, array_index, layer_flags, visibility, xscfb, image_index,
pose, size, false); rect, array_index, pose, size, false);
} }
static void static xrt_result_t
client_vk_compositor_layer_commit(struct xrt_compositor *xc) client_vk_compositor_layer_commit(struct xrt_compositor *xc)
{ {
struct client_vk_compositor *c = client_vk_compositor(xc); struct client_vk_compositor *c = client_vk_compositor(xc);
xrt_comp_layer_commit(&c->xcfd->base); return xrt_comp_layer_commit(&c->xcfd->base);
} }
static struct xrt_swapchain * static struct xrt_swapchain *

View file

@ -109,18 +109,20 @@ compositor_destroy(struct xrt_compositor *xc)
free(c); free(c);
} }
static void static xrt_result_t
compositor_begin_session(struct xrt_compositor *xc, enum xrt_view_type type) compositor_begin_session(struct xrt_compositor *xc, enum xrt_view_type type)
{ {
struct comp_compositor *c = comp_compositor(xc); struct comp_compositor *c = comp_compositor(xc);
COMP_DEBUG(c, "BEGIN_SESSION"); COMP_DEBUG(c, "BEGIN_SESSION");
return XRT_SUCCESS;
} }
static void static xrt_result_t
compositor_end_session(struct xrt_compositor *xc) compositor_end_session(struct xrt_compositor *xc)
{ {
struct comp_compositor *c = comp_compositor(xc); struct comp_compositor *c = comp_compositor(xc);
COMP_DEBUG(c, "END_SESSION"); COMP_DEBUG(c, "END_SESSION");
return XRT_SUCCESS;
} }
/*! /*!
@ -168,7 +170,7 @@ compositor_wait_vsync_or_time(struct comp_compositor *c, int64_t wake_up_time)
return ret; return ret;
} }
static void static xrt_result_t
compositor_wait_frame(struct xrt_compositor *xc, compositor_wait_frame(struct xrt_compositor *xc,
uint64_t *predicted_display_time, uint64_t *predicted_display_time,
uint64_t *predicted_display_period) uint64_t *predicted_display_period)
@ -186,7 +188,7 @@ compositor_wait_frame(struct xrt_compositor *xc,
*predicted_display_period = interval_ns; *predicted_display_period = interval_ns;
c->last_next_display_time = now_ns + interval_ns; c->last_next_display_time = now_ns + interval_ns;
*predicted_display_time = c->last_next_display_time; *predicted_display_time = c->last_next_display_time;
return; return XRT_SUCCESS;
} }
// First estimate of next display time. // First estimate of next display time.
@ -217,24 +219,26 @@ compositor_wait_frame(struct xrt_compositor *xc,
*predicted_display_time = next_display_time; *predicted_display_time = next_display_time;
c->last_next_display_time = next_display_time; c->last_next_display_time = next_display_time;
return; return XRT_SUCCESS;
} }
} }
} }
static void static xrt_result_t
compositor_begin_frame(struct xrt_compositor *xc) compositor_begin_frame(struct xrt_compositor *xc)
{ {
struct comp_compositor *c = comp_compositor(xc); struct comp_compositor *c = comp_compositor(xc);
COMP_SPEW(c, "BEGIN_FRAME"); COMP_SPEW(c, "BEGIN_FRAME");
c->app_profiling.last_begin = os_monotonic_get_ns(); c->app_profiling.last_begin = os_monotonic_get_ns();
return XRT_SUCCESS;
} }
static void static xrt_result_t
compositor_discard_frame(struct xrt_compositor *xc) compositor_discard_frame(struct xrt_compositor *xc)
{ {
struct comp_compositor *c = comp_compositor(xc); struct comp_compositor *c = comp_compositor(xc);
COMP_SPEW(c, "DISCARD_FRAME"); COMP_SPEW(c, "DISCARD_FRAME");
return XRT_SUCCESS;
} }
static void static void
@ -274,7 +278,7 @@ compositor_add_frame_timing(struct comp_compositor *c)
(float)diff * 1. / 1000. * 1. / 1000.; (float)diff * 1. / 1000. * 1. / 1000.;
} }
static void static xrt_result_t
compositor_layer_begin(struct xrt_compositor *xc, compositor_layer_begin(struct xrt_compositor *xc,
enum xrt_blend_mode env_blend_mode) enum xrt_blend_mode env_blend_mode)
{ {
@ -285,9 +289,10 @@ compositor_layer_begin(struct xrt_compositor *xc,
c->slots[slot_id].env_blend_mode = env_blend_mode; c->slots[slot_id].env_blend_mode = env_blend_mode;
c->slots[slot_id].num_layers = 0; c->slots[slot_id].num_layers = 0;
return XRT_SUCCESS;
} }
static void static xrt_result_t
compositor_layer_stereo_projection(struct xrt_compositor *xc, compositor_layer_stereo_projection(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -326,9 +331,10 @@ compositor_layer_stereo_projection(struct xrt_compositor *xc,
layer->type = COMP_LAYER_STEREO_PROJECTION; layer->type = COMP_LAYER_STEREO_PROJECTION;
c->slots[slot_id].num_layers++; c->slots[slot_id].num_layers++;
return XRT_SUCCESS;
} }
static void static xrt_result_t
compositor_layer_quad(struct xrt_compositor *xc, compositor_layer_quad(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -363,9 +369,10 @@ compositor_layer_quad(struct xrt_compositor *xc,
layer->type = COMP_LAYER_QUAD; layer->type = COMP_LAYER_QUAD;
c->slots[slot_id].num_layers++; c->slots[slot_id].num_layers++;
return XRT_SUCCESS;
} }
static void static xrt_result_t
compositor_layer_commit(struct xrt_compositor *xc) compositor_layer_commit(struct xrt_compositor *xc)
{ {
struct comp_compositor *c = comp_compositor(xc); struct comp_compositor *c = comp_compositor(xc);
@ -418,6 +425,7 @@ compositor_layer_commit(struct xrt_compositor *xc)
// Now is a good point to garbage collect. // Now is a good point to garbage collect.
comp_compositor_garbage_collect(c); comp_compositor_garbage_collect(c);
return XRT_SUCCESS;
} }

View file

@ -26,7 +26,7 @@ swapchain_destroy(struct xrt_swapchain *xsc)
u_threading_stack_push(&sc->c->threading.destroy_swapchains, sc); u_threading_stack_push(&sc->c->threading.destroy_swapchains, sc);
} }
static bool static xrt_result_t
swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index) swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
{ {
struct comp_swapchain *sc = comp_swapchain(xsc); struct comp_swapchain *sc = comp_swapchain(xsc);
@ -34,10 +34,15 @@ swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
COMP_SPEW(sc->c, "ACQUIRE_IMAGE"); COMP_SPEW(sc->c, "ACQUIRE_IMAGE");
// Returns negative on empty fifo. // Returns negative on empty fifo.
return u_index_fifo_pop(&sc->fifo, index) >= 0; int res = u_index_fifo_pop(&sc->fifo, index);
if (res >= 0) {
return XRT_SUCCESS;
} else {
return XRT_ERROR_NO_IMAGE_AVAILABLE;
}
} }
static bool static xrt_result_t
swapchain_wait_image(struct xrt_swapchain *xsc, swapchain_wait_image(struct xrt_swapchain *xsc,
uint64_t timeout, uint64_t timeout,
uint32_t index) uint32_t index)
@ -45,19 +50,24 @@ swapchain_wait_image(struct xrt_swapchain *xsc,
struct comp_swapchain *sc = comp_swapchain(xsc); struct comp_swapchain *sc = comp_swapchain(xsc);
COMP_SPEW(sc->c, "WAIT_IMAGE"); COMP_SPEW(sc->c, "WAIT_IMAGE");
return true; return XRT_SUCCESS;
} }
static bool static xrt_result_t
swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index) swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
{ {
struct comp_swapchain *sc = comp_swapchain(xsc); struct comp_swapchain *sc = comp_swapchain(xsc);
COMP_SPEW(sc->c, "RELEASE_IMAGE"); COMP_SPEW(sc->c, "RELEASE_IMAGE");
u_index_fifo_push(&sc->fifo, index); int res = u_index_fifo_push(&sc->fifo, index);
return true; if (res >= 0) {
return XRT_SUCCESS;
} else {
// FIFO full
return XRT_ERROR_NO_IMAGE_AVAILABLE;
}
} }
static VkResult static VkResult

View file

@ -91,19 +91,21 @@ struct xrt_swapchain
* See xrWaitSwapchainImage, must make sure that no image is acquired * See xrWaitSwapchainImage, must make sure that no image is acquired
* before calling acquire_image. * before calling acquire_image.
*/ */
bool (*acquire_image)(struct xrt_swapchain *xsc, uint32_t *index); xrt_result_t (*acquire_image)(struct xrt_swapchain *xsc,
uint32_t *index);
/*! /*!
* See xrWaitSwapchainImage, state tracker needs to track index. * See xrWaitSwapchainImage, state tracker needs to track index.
*/ */
bool (*wait_image)(struct xrt_swapchain *xsc, xrt_result_t (*wait_image)(struct xrt_swapchain *xsc,
uint64_t timeout, uint64_t timeout,
uint32_t index); uint32_t index);
/*! /*!
* See xrReleaseSwapchainImage, state tracker needs to track index. * See xrReleaseSwapchainImage, state tracker needs to track index.
*/ */
bool (*release_image)(struct xrt_swapchain *xsc, uint32_t index); xrt_result_t (*release_image)(struct xrt_swapchain *xsc,
uint32_t index);
}; };
/*! /*!
@ -113,7 +115,7 @@ struct xrt_swapchain
* *
* @public @memberof xrt_swapchain * @public @memberof xrt_swapchain
*/ */
static inline bool static inline xrt_result_t
xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index) xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
{ {
return xsc->acquire_image(xsc, index); return xsc->acquire_image(xsc, index);
@ -126,7 +128,7 @@ xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *index)
* *
* @public @memberof xrt_swapchain * @public @memberof xrt_swapchain
*/ */
static inline bool static inline xrt_result_t
xrt_swapchain_wait_image(struct xrt_swapchain *xsc, xrt_swapchain_wait_image(struct xrt_swapchain *xsc,
uint64_t timeout, uint64_t timeout,
uint32_t index) uint32_t index)
@ -141,7 +143,7 @@ xrt_swapchain_wait_image(struct xrt_swapchain *xsc,
* *
* @public @memberof xrt_swapchain * @public @memberof xrt_swapchain
*/ */
static inline bool static inline xrt_result_t
xrt_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index) xrt_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
{ {
return xsc->release_image(xsc, index); return xsc->release_image(xsc, index);
@ -216,27 +218,27 @@ struct xrt_compositor
/*! /*!
* See xrBeginSession. * See xrBeginSession.
*/ */
void (*begin_session)(struct xrt_compositor *xc, xrt_result_t (*begin_session)(struct xrt_compositor *xc,
enum xrt_view_type view_type); enum xrt_view_type view_type);
/*! /*!
* See xrEndSession, unlike the OpenXR one the state tracker is * See xrEndSession, unlike the OpenXR one the state tracker is
* responsible to call discard frame before calling this function. See * responsible to call discard frame before calling this function. See
* discard_frame. * discard_frame.
*/ */
void (*end_session)(struct xrt_compositor *xc); xrt_result_t (*end_session)(struct xrt_compositor *xc);
/*! /*!
* See xrWaitFrame. * See xrWaitFrame.
*/ */
void (*wait_frame)(struct xrt_compositor *xc, xrt_result_t (*wait_frame)(struct xrt_compositor *xc,
uint64_t *predicted_display_time, uint64_t *predicted_display_time,
uint64_t *predicted_display_period); uint64_t *predicted_display_period);
/*! /*!
* See xrBeginFrame. * See xrBeginFrame.
*/ */
void (*begin_frame)(struct xrt_compositor *xc); xrt_result_t (*begin_frame)(struct xrt_compositor *xc);
/*! /*!
* This isn't in the OpenXR API but is explicit in the XRT interfaces. * This isn't in the OpenXR API but is explicit in the XRT interfaces.
@ -249,7 +251,7 @@ struct xrt_compositor
* xc->begin_frame(xc) * xc->begin_frame(xc)
* ``` * ```
*/ */
void (*discard_frame)(struct xrt_compositor *xc); xrt_result_t (*discard_frame)(struct xrt_compositor *xc);
/*! /*!
* Begins layer submission, this and the other layer_* calls are * Begins layer submission, this and the other layer_* calls are
@ -257,8 +259,8 @@ struct xrt_compositor
* @p layer_commit that layers will be displayed. From the point of view * @p layer_commit that layers will be displayed. From the point of view
* of the swapchain the image is used as soon as it's given in a call. * of the swapchain the image is used as soon as it's given in a call.
*/ */
void (*layer_begin)(struct xrt_compositor *xc, xrt_result_t (*layer_begin)(struct xrt_compositor *xc,
enum xrt_blend_mode env_blend_mode); enum xrt_blend_mode env_blend_mode);
/*! /*!
* Adds a stereo projection layer for submissions. * Adds a stereo projection layer for submissions.
@ -282,7 +284,7 @@ struct xrt_compositor
* @param r_pose Right pose the left projection rendered with. * @param r_pose Right pose the left projection rendered with.
* @param flip_y Flip Y texture coordinates. * @param flip_y Flip Y texture coordinates.
*/ */
void (*layer_stereo_projection)( xrt_result_t (*layer_stereo_projection)(
struct xrt_compositor *xc, struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -320,25 +322,25 @@ struct xrt_compositor
* @param size Size of the quad in meters. * @param size Size of the quad in meters.
* @param flip_y Flip Y texture coordinates. * @param flip_y Flip Y texture coordinates.
*/ */
void (*layer_quad)(struct xrt_compositor *xc, xrt_result_t (*layer_quad)(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
enum xrt_layer_composition_flags layer_flags, enum xrt_layer_composition_flags layer_flags,
enum xrt_layer_eye_visibility visibility, enum xrt_layer_eye_visibility visibility,
struct xrt_swapchain *sc, struct xrt_swapchain *sc,
uint32_t image_index, uint32_t image_index,
struct xrt_rect *rect, struct xrt_rect *rect,
uint32_t array_index, uint32_t array_index,
struct xrt_pose *pose, struct xrt_pose *pose,
struct xrt_vec2 *size, struct xrt_vec2 *size,
bool flip_y); bool flip_y);
/*! /*!
* Commits all of the submitted layers, it's from this on that the * Commits all of the submitted layers, it's from this on that the
* compositor will use the layers. * compositor will use the layers.
*/ */
void (*layer_commit)(struct xrt_compositor *xc); xrt_result_t (*layer_commit)(struct xrt_compositor *xc);
/*! /*!
* Teardown the compositor. * Teardown the compositor.
@ -406,10 +408,10 @@ xrt_comp_prepare_session(struct xrt_compositor *xc)
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_begin_session(struct xrt_compositor *xc, enum xrt_view_type view_type) xrt_comp_begin_session(struct xrt_compositor *xc, enum xrt_view_type view_type)
{ {
xc->begin_session(xc, view_type); return xc->begin_session(xc, view_type);
} }
/*! /*!
@ -419,10 +421,10 @@ xrt_comp_begin_session(struct xrt_compositor *xc, enum xrt_view_type view_type)
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_end_session(struct xrt_compositor *xc) xrt_comp_end_session(struct xrt_compositor *xc)
{ {
xc->end_session(xc); return xc->end_session(xc);
} }
/*! /*!
@ -432,12 +434,13 @@ xrt_comp_end_session(struct xrt_compositor *xc)
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_wait_frame(struct xrt_compositor *xc, xrt_comp_wait_frame(struct xrt_compositor *xc,
uint64_t *predicted_display_time, uint64_t *predicted_display_time,
uint64_t *predicted_display_period) uint64_t *predicted_display_period)
{ {
xc->wait_frame(xc, predicted_display_time, predicted_display_period); return xc->wait_frame(xc, predicted_display_time,
predicted_display_period);
} }
/*! /*!
@ -447,10 +450,10 @@ xrt_comp_wait_frame(struct xrt_compositor *xc,
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_begin_frame(struct xrt_compositor *xc) xrt_comp_begin_frame(struct xrt_compositor *xc)
{ {
xc->begin_frame(xc); return xc->begin_frame(xc);
} }
/*! /*!
@ -460,10 +463,10 @@ xrt_comp_begin_frame(struct xrt_compositor *xc)
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_discard_frame(struct xrt_compositor *xc) xrt_comp_discard_frame(struct xrt_compositor *xc)
{ {
xc->discard_frame(xc); return xc->discard_frame(xc);
} }
/*! /*!
@ -473,11 +476,11 @@ xrt_comp_discard_frame(struct xrt_compositor *xc)
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_layer_begin(struct xrt_compositor *xc, xrt_comp_layer_begin(struct xrt_compositor *xc,
enum xrt_blend_mode env_blend_mode) enum xrt_blend_mode env_blend_mode)
{ {
xc->layer_begin(xc, env_blend_mode); return xc->layer_begin(xc, env_blend_mode);
} }
/*! /*!
@ -487,7 +490,7 @@ xrt_comp_layer_begin(struct xrt_compositor *xc,
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_layer_stereo_projection(struct xrt_compositor *xc, xrt_comp_layer_stereo_projection(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -507,10 +510,10 @@ xrt_comp_layer_stereo_projection(struct xrt_compositor *xc,
struct xrt_pose *r_pose, struct xrt_pose *r_pose,
bool flip_y) bool flip_y)
{ {
xc->layer_stereo_projection(xc, timestamp, xdev, name, layer_flags, return xc->layer_stereo_projection(
l_sc, l_image_index, l_rect, l_array_index, xc, timestamp, xdev, name, layer_flags, l_sc, l_image_index, l_rect,
l_fov, l_pose, r_sc, r_image_index, r_rect, l_array_index, l_fov, l_pose, r_sc, r_image_index, r_rect,
r_array_index, r_fov, r_pose, flip_y); r_array_index, r_fov, r_pose, flip_y);
} }
/*! /*!
@ -520,7 +523,7 @@ xrt_comp_layer_stereo_projection(struct xrt_compositor *xc,
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_layer_quad(struct xrt_compositor *xc, xrt_comp_layer_quad(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -535,8 +538,9 @@ xrt_comp_layer_quad(struct xrt_compositor *xc,
struct xrt_vec2 *size, struct xrt_vec2 *size,
bool flip_y) bool flip_y)
{ {
xc->layer_quad(xc, timestamp, xdev, name, layer_flags, visibility, sc, return xc->layer_quad(xc, timestamp, xdev, name, layer_flags,
image_index, rect, array_index, pose, size, flip_y); visibility, sc, image_index, rect, array_index,
pose, size, flip_y);
} }
/*! /*!
@ -546,10 +550,10 @@ xrt_comp_layer_quad(struct xrt_compositor *xc,
* *
* @public @memberof xrt_compositor * @public @memberof xrt_compositor
*/ */
static inline void static inline xrt_result_t
xrt_comp_layer_commit(struct xrt_compositor *xc) xrt_comp_layer_commit(struct xrt_compositor *xc)
{ {
xc->layer_commit(xc); return xc->layer_commit(xc);
} }
/*! /*!

View file

@ -12,6 +12,8 @@
#include "xrt/xrt_compiler.h" #include "xrt/xrt_compiler.h"
#include "util/u_time.h" #include "util/u_time.h"
#include "xrt/xrt_results.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -13,4 +13,5 @@ typedef enum xrt_result
{ {
XRT_SUCCESS = 0, XRT_SUCCESS = 0,
XRT_ERROR_IPC_FAILURE = -1, XRT_ERROR_IPC_FAILURE = -1,
XRT_ERROR_NO_IMAGE_AVAILABLE = -2
} xrt_result_t; } xrt_result_t;

View file

@ -96,8 +96,9 @@ compositor_disconnect(ipc_connection_t *ipc_c)
ipc_c->socket_fd = -1; ipc_c->socket_fd = -1;
} }
#define CALL_CHK(call) \ #define IPC_CALL_CHK(call) \
if ((call) != XRT_SUCCESS) { \ xrt_result_t res = (call); \
if (res == XRT_ERROR_IPC_FAILURE) { \
IPC_ERROR(icc->ipc_c, "IPC: %s call error!", __func__); \ IPC_ERROR(icc->ipc_c, "IPC: %s call error!", __func__); \
} }
@ -114,12 +115,12 @@ ipc_compositor_swapchain_destroy(struct xrt_swapchain *xsc)
struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc); struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc);
struct ipc_client_compositor *icc = ics->icc; struct ipc_client_compositor *icc = ics->icc;
CALL_CHK(ipc_call_swapchain_destroy(icc->ipc_c, ics->id)); IPC_CALL_CHK(ipc_call_swapchain_destroy(icc->ipc_c, ics->id));
free(xsc); free(xsc);
} }
static bool static xrt_result_t
ipc_compositor_swapchain_wait_image(struct xrt_swapchain *xsc, ipc_compositor_swapchain_wait_image(struct xrt_swapchain *xsc,
uint64_t timeout, uint64_t timeout,
uint32_t index) uint32_t index)
@ -127,35 +128,36 @@ ipc_compositor_swapchain_wait_image(struct xrt_swapchain *xsc,
struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc); struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc);
struct ipc_client_compositor *icc = ics->icc; struct ipc_client_compositor *icc = ics->icc;
CALL_CHK( IPC_CALL_CHK(
ipc_call_swapchain_wait_image(icc->ipc_c, ics->id, timeout, index)); ipc_call_swapchain_wait_image(icc->ipc_c, ics->id, timeout, index));
return true; return res;
} }
static bool static xrt_result_t
ipc_compositor_swapchain_acquire_image(struct xrt_swapchain *xsc, ipc_compositor_swapchain_acquire_image(struct xrt_swapchain *xsc,
uint32_t *out_index) uint32_t *out_index)
{ {
struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc); struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc);
struct ipc_client_compositor *icc = ics->icc; struct ipc_client_compositor *icc = ics->icc;
CALL_CHK( IPC_CALL_CHK(
ipc_call_swapchain_acquire_image(icc->ipc_c, ics->id, out_index)); ipc_call_swapchain_acquire_image(icc->ipc_c, ics->id, out_index));
return true; return res;
} }
static bool static xrt_result_t
ipc_compositor_swapchain_release_image(struct xrt_swapchain *xsc, ipc_compositor_swapchain_release_image(struct xrt_swapchain *xsc,
uint32_t index) uint32_t index)
{ {
struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc); struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc);
struct ipc_client_compositor *icc = ics->icc; struct ipc_client_compositor *icc = ics->icc;
CALL_CHK(ipc_call_swapchain_release_image(icc->ipc_c, ics->id, index)); IPC_CALL_CHK(
ipc_call_swapchain_release_image(icc->ipc_c, ics->id, index));
return true; return res;
} }
@ -222,7 +224,7 @@ ipc_compositor_swapchain_create(struct xrt_compositor *xc,
return &ics->base.base; return &ics->base.base;
} }
static void static xrt_result_t
ipc_compositor_begin_session(struct xrt_compositor *xc, ipc_compositor_begin_session(struct xrt_compositor *xc,
enum xrt_view_type view_type) enum xrt_view_type view_type)
{ {
@ -230,20 +232,24 @@ ipc_compositor_begin_session(struct xrt_compositor *xc,
IPC_SPEW(icc->ipc_c, "IPC: compositor begin session"); IPC_SPEW(icc->ipc_c, "IPC: compositor begin session");
CALL_CHK(ipc_call_session_begin(icc->ipc_c)); IPC_CALL_CHK(ipc_call_session_begin(icc->ipc_c));
return res;
} }
static void static xrt_result_t
ipc_compositor_end_session(struct xrt_compositor *xc) ipc_compositor_end_session(struct xrt_compositor *xc)
{ {
struct ipc_client_compositor *icc = ipc_client_compositor(xc); struct ipc_client_compositor *icc = ipc_client_compositor(xc);
IPC_SPEW(icc->ipc_c, "IPC: compositor end session"); IPC_SPEW(icc->ipc_c, "IPC: compositor end session");
CALL_CHK(ipc_call_session_end(icc->ipc_c)); IPC_CALL_CHK(ipc_call_session_end(icc->ipc_c));
return res;
} }
static void static xrt_result_t
ipc_compositor_get_formats(struct xrt_compositor *xc, ipc_compositor_get_formats(struct xrt_compositor *xc,
uint32_t *num_formats, uint32_t *num_formats,
int64_t *formats) int64_t *formats)
@ -253,19 +259,21 @@ ipc_compositor_get_formats(struct xrt_compositor *xc,
IPC_SPEW(icc->ipc_c, "IPC: compositor get_formats"); IPC_SPEW(icc->ipc_c, "IPC: compositor get_formats");
struct ipc_formats_info info; struct ipc_formats_info info;
CALL_CHK(ipc_call_compositor_get_formats(icc->ipc_c, &info)); IPC_CALL_CHK(ipc_call_compositor_get_formats(icc->ipc_c, &info));
*num_formats = info.num_formats; *num_formats = info.num_formats;
memcpy(formats, info.formats, sizeof(int64_t) * (*num_formats)); memcpy(formats, info.formats, sizeof(int64_t) * (*num_formats));
return res;
} }
static void static bool
wait_semaphore(struct ipc_client_compositor *icc, struct ipc_shared_memory *ism) wait_semaphore(struct ipc_client_compositor *icc, struct ipc_shared_memory *ism)
{ {
struct timespec ts; struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
IPC_ERROR(icc->ipc_c, "Error getting CLOCK_REALTIME\n"); IPC_ERROR(icc->ipc_c, "Error getting CLOCK_REALTIME\n");
return; return false;
} }
int s; int s;
@ -284,18 +292,20 @@ wait_semaphore(struct ipc_client_compositor *icc, struct ipc_shared_memory *ism)
} else { } else {
IPC_ERROR(icc->ipc_c, IPC_ERROR(icc->ipc_c,
"Error sem_timedwait() error '%i'\n", errno); "Error sem_timedwait() error '%i'\n", errno);
return false;
} }
} }
return true;
} }
static void static xrt_result_t
ipc_compositor_wait_frame(struct xrt_compositor *xc, ipc_compositor_wait_frame(struct xrt_compositor *xc,
uint64_t *out_predicted_display_time, uint64_t *out_predicted_display_time,
uint64_t *out_predicted_display_period) uint64_t *out_predicted_display_period)
{ {
struct ipc_client_compositor *icc = ipc_client_compositor(xc); struct ipc_client_compositor *icc = ipc_client_compositor(xc);
CALL_CHK(ipc_call_compositor_wait_frame(icc->ipc_c)); IPC_CALL_CHK(ipc_call_compositor_wait_frame(icc->ipc_c));
wait_semaphore(icc, icc->ipc_c->ism); wait_semaphore(icc, icc->ipc_c->ism);
@ -303,26 +313,32 @@ ipc_compositor_wait_frame(struct xrt_compositor *xc,
icc->ipc_c->ism->wait_frame.predicted_display_time; icc->ipc_c->ism->wait_frame.predicted_display_time;
*out_predicted_display_period = *out_predicted_display_period =
icc->ipc_c->ism->wait_frame.predicted_display_period; icc->ipc_c->ism->wait_frame.predicted_display_period;
return res;
} }
static void static xrt_result_t
ipc_compositor_begin_frame(struct xrt_compositor *xc) ipc_compositor_begin_frame(struct xrt_compositor *xc)
{ {
struct ipc_client_compositor *icc = ipc_client_compositor(xc); struct ipc_client_compositor *icc = ipc_client_compositor(xc);
CALL_CHK(ipc_call_compositor_begin_frame(icc->ipc_c)); IPC_CALL_CHK(ipc_call_compositor_begin_frame(icc->ipc_c));
return res;
} }
static void static xrt_result_t
ipc_compositor_layer_begin(struct xrt_compositor *xc, ipc_compositor_layer_begin(struct xrt_compositor *xc,
enum xrt_blend_mode env_blend_mode) enum xrt_blend_mode env_blend_mode)
{ {
struct ipc_client_compositor *icc = ipc_client_compositor(xc); struct ipc_client_compositor *icc = ipc_client_compositor(xc);
icc->layers.env_blend_mode = env_blend_mode; icc->layers.env_blend_mode = env_blend_mode;
return XRT_SUCCESS;
} }
static void static xrt_result_t
ipc_compositor_layer_stereo_projection( ipc_compositor_layer_stereo_projection(
struct xrt_compositor *xc, struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
@ -375,9 +391,11 @@ ipc_compositor_layer_stereo_projection(
// Increment the number of layers. // Increment the number of layers.
icc->layers.num_layers++; icc->layers.num_layers++;
return XRT_SUCCESS;
} }
static void static xrt_result_t
ipc_compositor_layer_quad(struct xrt_compositor *xc, ipc_compositor_layer_quad(struct xrt_compositor *xc,
uint64_t timestamp, uint64_t timestamp,
struct xrt_device *xdev, struct xrt_device *xdev,
@ -416,9 +434,11 @@ ipc_compositor_layer_quad(struct xrt_compositor *xc,
// Increment the number of layers. // Increment the number of layers.
icc->layers.num_layers++; icc->layers.num_layers++;
return XRT_SUCCESS;
} }
static void static xrt_result_t
ipc_compositor_layer_commit(struct xrt_compositor *xc) ipc_compositor_layer_commit(struct xrt_compositor *xc)
{ {
struct ipc_client_compositor *icc = ipc_client_compositor(xc); struct ipc_client_compositor *icc = ipc_client_compositor(xc);
@ -429,19 +449,23 @@ ipc_compositor_layer_commit(struct xrt_compositor *xc)
// Last bit of data to put in the shared memory area. // Last bit of data to put in the shared memory area.
slot->num_layers = icc->layers.num_layers; slot->num_layers = icc->layers.num_layers;
CALL_CHK(ipc_call_compositor_layer_sync(icc->ipc_c, icc->layers.slot_id, IPC_CALL_CHK(ipc_call_compositor_layer_sync(
&icc->layers.slot_id)); icc->ipc_c, icc->layers.slot_id, &icc->layers.slot_id));
// Reset. // Reset.
icc->layers.num_layers = 0; icc->layers.num_layers = 0;
return res;
} }
static void static xrt_result_t
ipc_compositor_discard_frame(struct xrt_compositor *xc) ipc_compositor_discard_frame(struct xrt_compositor *xc)
{ {
struct ipc_client_compositor *icc = ipc_client_compositor(xc); struct ipc_client_compositor *icc = ipc_client_compositor(xc);
CALL_CHK(ipc_call_compositor_discard_frame(icc->ipc_c)); IPC_CALL_CHK(ipc_call_compositor_discard_frame(icc->ipc_c));
return res;
} }
static void static void

View file

@ -37,7 +37,7 @@ oxr_swapchain_acquire_image(struct oxr_logger *log,
} }
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
if (!xsc->acquire_image(xsc, &index)) { if (xsc->acquire_image(xsc, &index) != XRT_SUCCESS) {
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
"Call to xsc->acquire_image failed"); "Call to xsc->acquire_image failed");
} }
@ -84,7 +84,7 @@ oxr_swapchain_wait_image(struct oxr_logger *log,
u_index_fifo_pop(&sc->acquired.fifo, &index); u_index_fifo_pop(&sc->acquired.fifo, &index);
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
if (!xsc->wait_image(xsc, waitInfo->timeout, index)) { if (xsc->wait_image(xsc, waitInfo->timeout, index) != XRT_SUCCESS) {
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
"Call to xsc->wait_image failed"); "Call to xsc->wait_image failed");
} }
@ -111,7 +111,7 @@ oxr_swapchain_release_image(struct oxr_logger *log,
uint32_t index = sc->waited.index; uint32_t index = sc->waited.index;
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
if (!xsc->release_image(xsc, index)) { if (xsc->release_image(xsc, index) != XRT_SUCCESS) {
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
"Call to xsc->release_image failed"); "Call to xsc->release_image failed");
} }