mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +00:00
ipc: Support sending sync handles on layer_commit
This commit is contained in:
parent
84d4b6aaae
commit
c191c9a466
|
@ -28,6 +28,10 @@
|
|||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -616,7 +620,7 @@ ipc_compositor_layer_commit(struct xrt_compositor *xc,
|
|||
{
|
||||
struct ipc_client_compositor *icc = ipc_client_compositor(xc);
|
||||
|
||||
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
|
||||
bool valid_sync = 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];
|
||||
|
@ -624,12 +628,27 @@ ipc_compositor_layer_commit(struct xrt_compositor *xc,
|
|||
// Last bit of data to put in the shared memory area.
|
||||
slot->num_layers = icc->layers.num_layers;
|
||||
|
||||
IPC_CALL_CHK(ipc_call_compositor_layer_sync(
|
||||
icc->ipc_c, frame_id, icc->layers.slot_id, &icc->layers.slot_id));
|
||||
IPC_CALL_CHK(ipc_call_compositor_layer_sync( //
|
||||
icc->ipc_c, //
|
||||
frame_id, //
|
||||
icc->layers.slot_id, //
|
||||
&sync_handle, //
|
||||
valid_sync ? 1 : 0, //
|
||||
&icc->layers.slot_id)); //
|
||||
|
||||
// Reset.
|
||||
icc->layers.num_layers = 0;
|
||||
|
||||
#ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD
|
||||
// Need to consume this handle.
|
||||
if (valid_sync) {
|
||||
close(sync_handle);
|
||||
sync_handle = XRT_GRAPHICS_SYNC_HANDLE_INVALID;
|
||||
}
|
||||
#else
|
||||
#error "Not yet implemented for this platform"
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "server/ipc_server.h"
|
||||
#include "ipc_server_generated.h"
|
||||
|
||||
#ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -183,11 +187,24 @@ xrt_result_t
|
|||
ipc_handle_compositor_layer_sync(volatile struct ipc_client_state *ics,
|
||||
int64_t frame_id,
|
||||
uint32_t slot_id,
|
||||
uint32_t *out_free_slot_id)
|
||||
uint32_t *out_free_slot_id,
|
||||
const xrt_graphics_sync_handle_t *handles,
|
||||
const uint32_t num_handles)
|
||||
{
|
||||
struct ipc_shared_memory *ism = ics->server->ism;
|
||||
struct ipc_layer_slot *slot = &ism->slots[slot_id];
|
||||
|
||||
for (uint32_t i = 0; i < num_handles; i++) {
|
||||
if (!xrt_graphics_sync_handle_is_valid(handles[i])) {
|
||||
continue;
|
||||
}
|
||||
#ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD
|
||||
close(handles[i]);
|
||||
#else
|
||||
#error "Need port to transport these graphics buffers"
|
||||
#endif
|
||||
}
|
||||
|
||||
// Copy current slot data to our state.
|
||||
ics->render_state = *slot;
|
||||
ics->rendering_state = true;
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
{"name": "frame_id", "type": "int64_t"},
|
||||
{"name": "slot_id", "type": "uint32_t"}
|
||||
],
|
||||
"in_handles": {"type": "xrt_graphics_sync_handle_t"},
|
||||
"out": [
|
||||
{"name": "free_slot_id", "type": "uint32_t"}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue