From eaa4c186ce6207fbada2e5b10632a784965e71e3 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 9 Jun 2020 16:26:01 -0500 Subject: [PATCH] ipc: Port to using xrt_sub_image where possible. This highlighted several places where we are not considering an image rect, but possibly should be. --- src/xrt/ipc/ipc_server.h | 11 ++++++----- src/xrt/ipc/ipc_server_client.c | 23 +++++++++-------------- src/xrt/ipc/ipc_server_process.c | 14 ++++++++------ 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/xrt/ipc/ipc_server.h b/src/xrt/ipc/ipc_server.h index 6e95ed2ed..af0ebfeed 100644 --- a/src/xrt/ipc/ipc_server.h +++ b/src/xrt/ipc/ipc_server.h @@ -89,13 +89,11 @@ struct ipc_quad_render_state { uint32_t swapchain_index; - uint32_t image_index; - uint32_t array_index; + struct xrt_sub_image sub; enum xrt_layer_eye_visibility visibility; struct xrt_pose pose; struct xrt_vec2 size; - struct xrt_rect rect; }; struct ipc_stereo_projection_render_state @@ -103,8 +101,7 @@ struct ipc_stereo_projection_render_state struct { uint32_t swapchain_index; - uint32_t image_index; - uint32_t array_index; + struct xrt_sub_image sub; } l, r; }; @@ -231,6 +228,8 @@ ipc_server_client_thread(void *_cs); * Create a single wait thread. * * @ingroup ipc_server + * @public @memberof ipc_server + * @relatesalso ipc_wait */ int ipc_server_wait_alloc(struct ipc_server *s, struct ipc_wait **out_iw); @@ -239,6 +238,7 @@ ipc_server_wait_alloc(struct ipc_server *s, struct ipc_wait **out_iw); * Destroy a wait thread, checks for NULL and sets to NULL. * * @ingroup ipc_server + * @public @memberof ipc_wait */ void ipc_server_wait_free(struct ipc_wait **out_iw); @@ -248,6 +248,7 @@ ipc_server_wait_free(struct ipc_wait **out_iw); * wait frame. * * @ingroup ipc_server + * @public @memberof ipc_wait */ void ipc_server_wait_add_frame(struct ipc_wait *iw, diff --git a/src/xrt/ipc/ipc_server_client.c b/src/xrt/ipc/ipc_server_client.c index 1f513221f..91254e4de 100644 --- a/src/xrt/ipc/ipc_server_client.c +++ b/src/xrt/ipc/ipc_server_client.c @@ -114,23 +114,16 @@ ipc_handle_compositor_layer_sync(volatile struct ipc_client_state *cs, switch (slot->layers[i].data.type) { case XRT_LAYER_STEREO_PROJECTION: rl->stereo.l.swapchain_index = sl->swapchain_ids[0]; - rl->stereo.l.image_index = - sl->data.stereo.l.sub.image_index; - rl->stereo.r.swapchain_index = sl->swapchain_ids[1]; - rl->stereo.r.image_index = - sl->data.stereo.r.sub.image_index; - rl->stereo.l.array_index = - sl->data.stereo.l.sub.array_index; - rl->stereo.r.array_index = - sl->data.stereo.r.sub.array_index; + rl->stereo.l.sub = sl->data.stereo.l.sub; + rl->stereo.r.swapchain_index = sl->swapchain_ids[1]; + rl->stereo.r.sub = sl->data.stereo.r.sub; break; case XRT_LAYER_QUAD: rl->quad.swapchain_index = sl->swapchain_ids[0]; - rl->quad.image_index = sl->data.quad.sub.image_index; + rl->quad.sub = sl->data.quad.sub; rl->quad.pose = sl->data.quad.pose; rl->quad.size = sl->data.quad.size; - rl->quad.array_index = sl->data.quad.sub.array_index; break; } } @@ -465,11 +458,13 @@ client_loop(volatile struct ipc_client_state *cs) rl->flip_y = false; rl->stereo.l.swapchain_index = 0; - rl->stereo.l.image_index = 0; + rl->stereo.l.sub.image_index = 0; rl->stereo.r.swapchain_index = 0; - rl->stereo.r.image_index = 0; + rl->stereo.r.sub.image_index = 0; rl->quad.swapchain_index = 0; - rl->quad.image_index = 0; + rl->quad.sub.image_index = 0; + + //! @todo set rects? } // Destroy all swapchains now. diff --git a/src/xrt/ipc/ipc_server_process.c b/src/xrt/ipc/ipc_server_process.c index f8f6865f6..a14fafa75 100644 --- a/src/xrt/ipc/ipc_server_process.c +++ b/src/xrt/ipc/ipc_server_process.c @@ -535,12 +535,13 @@ _update_projection_layer(struct comp_compositor *c, struct comp_swapchain_image *l = NULL; struct comp_swapchain_image *r = NULL; - l = &cl->images[layer->stereo.l.image_index]; - r = &cr->images[layer->stereo.r.image_index]; + l = &cl->images[layer->stereo.l.sub.image_index]; + r = &cr->images[layer->stereo.r.sub.image_index]; + //! @todo we are ignoring subrect here! comp_renderer_set_projection_layer(c->r, l, r, layer->flip_y, i, - layer->stereo.l.array_index, - layer->stereo.r.array_index); + layer->stereo.l.sub.array_index, + layer->stereo.r.sub.array_index); return true; } @@ -560,13 +561,14 @@ _update_quad_layer(struct comp_compositor *c, struct comp_swapchain *sc = comp_swapchain(active_client->xscs[sci]); struct comp_swapchain_image *image = NULL; - image = &sc->images[layer->quad.image_index]; + image = &sc->images[layer->quad.sub.image_index]; struct xrt_pose pose = layer->quad.pose; struct xrt_vec2 size = layer->quad.size; + //! @todo we are ignoring subrect here! comp_renderer_set_quad_layer(c->r, image, &pose, &size, layer->flip_y, - i, layer->quad.array_index); + i, layer->quad.sub.array_index); return true; }