xrt: Add sync_handle argument to layer_commit

This commit is contained in:
Jakob Bornecrantz 2020-12-18 13:27:33 +00:00
parent 8e5f952d55
commit 1302b07d68
7 changed files with 36 additions and 11 deletions

View file

@ -301,14 +301,20 @@ client_gl_compositor_layer_equirect2(struct xrt_compositor *xc,
}
static xrt_result_t
client_gl_compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
client_gl_compositor_layer_commit(struct xrt_compositor *xc,
int64_t frame_id,
xrt_graphics_sync_handle_t sync_handle)
{
//! @hack: The swapchain images should have been externally synchronized
glFlush();
struct client_gl_compositor *c = client_gl_compositor(xc);
return xrt_comp_layer_commit(&c->xcn->base, frame_id);
//! @todo We should be creating the handle ourselves in the future.
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
return xrt_comp_layer_commit(&c->xcn->base, frame_id,
XRT_GRAPHICS_SYNC_HANDLE_INVALID);
}
static int64_t

View file

@ -362,11 +362,17 @@ client_vk_compositor_layer_equirect2(struct xrt_compositor *xc,
}
static xrt_result_t
client_vk_compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
client_vk_compositor_layer_commit(struct xrt_compositor *xc,
int64_t frame_id,
xrt_graphics_sync_handle_t sync_handle)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
return xrt_comp_layer_commit(&c->xcn->base, frame_id);
//! @todo We should be creating the handle ourselves in the future.
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
return xrt_comp_layer_commit(&c->xcn->base, frame_id,
XRT_GRAPHICS_SYNC_HANDLE_INVALID);
}
static xrt_result_t

View file

@ -459,10 +459,14 @@ compositor_layer_equirect2(struct xrt_compositor *xc,
}
static xrt_result_t
compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
compositor_layer_commit(struct xrt_compositor *xc,
int64_t frame_id,
xrt_graphics_sync_handle_t sync_handle)
{
struct comp_compositor *c = comp_compositor(xc);
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
COMP_SPEW(c, "LAYER_COMMIT at %8.3fms", ts_ms());
// Always zero for now.

View file

@ -774,7 +774,8 @@ struct xrt_compositor
* compositor will use the layers.
*/
xrt_result_t (*layer_commit)(struct xrt_compositor *xc,
int64_t frame_id);
int64_t frame_id,
xrt_graphics_sync_handle_t sync_handle);
/*!
* Teardown the compositor.
@ -1056,9 +1057,11 @@ xrt_comp_layer_equirect2(struct xrt_compositor *xc,
* @public @memberof xrt_compositor
*/
static inline xrt_result_t
xrt_comp_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
xrt_comp_layer_commit(struct xrt_compositor *xc,
int64_t frame_id,
xrt_graphics_sync_handle_t sync_handle)
{
return xc->layer_commit(xc, frame_id);
return xc->layer_commit(xc, frame_id, sync_handle);
}
/*!

View file

@ -610,10 +610,14 @@ ipc_compositor_layer_equirect2(struct xrt_compositor *xc,
}
static xrt_result_t
ipc_compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
ipc_compositor_layer_commit(struct xrt_compositor *xc,
int64_t frame_id,
xrt_graphics_sync_handle_t sync_handle)
{
struct ipc_client_compositor *icc = ipc_client_compositor(xc);
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
struct ipc_shared_memory *ism = icc->ipc_c->ism;
struct ipc_layer_slot *slot = &ism->slots[icc->layers.slot_id];

View file

@ -1055,7 +1055,8 @@ main_loop(struct ipc_server *s)
_update_layers(s, xc);
xrt_comp_layer_commit(xc, frame_id);
xrt_comp_layer_commit(xc, frame_id,
XRT_GRAPHICS_SYNC_HANDLE_INVALID);
#ifndef XRT_OS_ANDROID
// Check polling last, so we know we have valid timing data.

View file

@ -2135,7 +2135,8 @@ oxr_session_frame_end(struct oxr_logger *log,
}
}
CALL_CHK(xrt_comp_layer_commit(xc, sess->frame_id.begun));
CALL_CHK(xrt_comp_layer_commit(xc, sess->frame_id.begun,
XRT_GRAPHICS_SYNC_HANDLE_INVALID));
sess->frame_id.begun = -1;
sess->frame_started = false;