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.
This commit is contained in:
Ryan Pavlik 2020-06-09 16:26:01 -05:00
parent 26ab046fba
commit eaa4c186ce
3 changed files with 23 additions and 25 deletions

View file

@ -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,

View file

@ -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.

View file

@ -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;
}