diff --git a/src/xrt/ipc/CMakeLists.txt b/src/xrt/ipc/CMakeLists.txt index 25a26a8ad..0dbfb583f 100644 --- a/src/xrt/ipc/CMakeLists.txt +++ b/src/xrt/ipc/CMakeLists.txt @@ -29,6 +29,7 @@ endforeach() set(IPC_COMMON_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h + shared/ipc_message_channel.h shared/ipc_shmem.c shared/ipc_shmem.h shared/ipc_utils.c @@ -41,9 +42,9 @@ target_include_directories( ) if(WIN32) - target_sources(ipc_shared PRIVATE shared/ipc_utils_windows.cpp) + target_sources(ipc_shared PRIVATE shared/ipc_message_channel_windows.cpp) else() - target_sources(ipc_shared PRIVATE shared/ipc_utils_unix.c) + target_sources(ipc_shared PRIVATE shared/ipc_message_channel_unix.c) endif() target_link_libraries(ipc_shared PRIVATE aux_util) diff --git a/src/xrt/ipc/client/ipc_client.h b/src/xrt/ipc/client/ipc_client.h index 82e3742f5..ed239a008 100644 --- a/src/xrt/ipc/client/ipc_client.h +++ b/src/xrt/ipc/client/ipc_client.h @@ -18,7 +18,7 @@ #include "util/u_logging.h" #include "shared/ipc_protocol.h" -#include "shared/ipc_utils.h" +#include "shared/ipc_message_channel.h" #include diff --git a/src/xrt/ipc/client/ipc_client_connection.c b/src/xrt/ipc/client/ipc_client_connection.c index 7b88fa05e..87045416a 100644 --- a/src/xrt/ipc/client/ipc_client_connection.c +++ b/src/xrt/ipc/client/ipc_client_connection.c @@ -26,6 +26,7 @@ #include "util/u_git_tag.h" #include "util/u_system_helpers.h" +#include "shared/ipc_utils.h" #include "shared/ipc_protocol.h" #include "client/ipc_client_connection.h" diff --git a/src/xrt/ipc/server/ipc_server.h b/src/xrt/ipc/server/ipc_server.h index 8433d4c69..c5d0d6bcb 100644 --- a/src/xrt/ipc/server/ipc_server.h +++ b/src/xrt/ipc/server/ipc_server.h @@ -15,15 +15,16 @@ #include "xrt/xrt_system.h" #include "xrt/xrt_space.h" -#include "util/u_logging.h" - #include "os/os_threading.h" +#include "util/u_logging.h" + #include "shared/ipc_protocol.h" -#include "shared/ipc_utils.h" +#include "shared/ipc_message_channel.h" #include + #ifdef __cplusplus extern "C" { #endif diff --git a/src/xrt/ipc/server/ipc_server_mainloop_windows.cpp b/src/xrt/ipc/server/ipc_server_mainloop_windows.cpp index 0766a81df..25a44f420 100644 --- a/src/xrt/ipc/server/ipc_server_mainloop_windows.cpp +++ b/src/xrt/ipc/server/ipc_server_mainloop_windows.cpp @@ -28,6 +28,7 @@ #include "util/u_file.h" #include "util/u_windows.h" +#include "shared/ipc_utils.h" #include "shared/ipc_shmem.h" #include "server/ipc_server.h" diff --git a/src/xrt/ipc/server/ipc_server_per_client_thread.c b/src/xrt/ipc/server/ipc_server_per_client_thread.c index c2d954a99..ecffd2d14 100644 --- a/src/xrt/ipc/server/ipc_server_per_client_thread.c +++ b/src/xrt/ipc/server/ipc_server_per_client_thread.c @@ -11,6 +11,7 @@ #include "util/u_misc.h" #include "util/u_trace_marker.h" +#include "shared/ipc_utils.h" #include "server/ipc_server.h" #include "ipc_server_generated.h" diff --git a/src/xrt/ipc/shared/ipc_message_channel.h b/src/xrt/ipc/shared/ipc_message_channel.h new file mode 100644 index 000000000..2da911653 --- /dev/null +++ b/src/xrt/ipc/shared/ipc_message_channel.h @@ -0,0 +1,340 @@ +// Copyright 2020-2023, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief IPC message channel functions. + * @author Ryan Pavlik + * @ingroup ipc_shared + */ + +#pragma once + +#include +#include + +#include +#include +#include + +#include "util/u_logging.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * Wrapper for a socket and flags. + */ +struct ipc_message_channel +{ + xrt_ipc_handle_t ipc_handle; + enum u_logging_level log_level; +}; + +/*! + * Close an IPC message channel + * + * @public @memberof ipc_message_channel + */ +void +ipc_message_channel_close(struct ipc_message_channel *imc); + +/*! + * Send a bare message over the IPC channel. + * + * There are other functions if you have handles, not just scalar/aggregate + * data. + * + * @param imc Message channel to use + * @param[in] data Pointer to the data buffer to send. Must not be + * null: use a filler message if necessary. + * @param[in] size Size of data pointed-to by @p data, must be greater than 0 + * + * @public @memberof ipc_message_channel + */ +xrt_result_t +ipc_send(struct ipc_message_channel *imc, const void *data, size_t size); + +/*! + * Receive a bare message over the IPC channel. + * + * There are other functions if you have handles, not just scalar/aggregate + * data. + * + * @param imc Message channel to use + * @param[out] out_data Pointer to the buffer to fill with data. Must not be + * null. + * @param[in] size Maximum size to read, must be greater than 0 + * + * @public @memberof ipc_message_channel + */ +xrt_result_t +ipc_receive(struct ipc_message_channel *imc, void *out_data, size_t size); + +/*! + * @name File Descriptor or HANDLE utilities + * @brief These are typically called from within the send/receive_handles + * functions. + * @{ + */ +#ifdef XRT_OS_UNIX + +/*! + * Receive a message along with a known number of file descriptors over the IPC + * channel. + * + * @param imc Message channel to use + * @param[out] out_data Pointer to the buffer to fill with data. Must not be + * null. + * @param[in] size Maximum size to read, must be greater than 0 + * @param[out] out_fds Array of file descriptors to populate. Must not be null. + * @param[in] fd_count Number of elements to receive into @p out_fds, must be + * greater than 0 and must match the value provided at the + * other end. + * + * @public @memberof ipc_message_channel + */ +xrt_result_t +ipc_receive_fds(struct ipc_message_channel *imc, void *out_data, size_t size, int *out_fds, uint32_t fd_count); + +/*! + * Send a message along with file descriptors over the IPC channel. + * + * @param imc Message channel to use + * @param[in] data Pointer to the data buffer to send. Must not be + * null: use a filler message if necessary. + * @param[in] size Size of data pointed-to by @p data, must be greater than 0. + * @param[out] fds Array of file descriptors to send. Must not benull. + * @param[in] fd_count Number of elements in @p fds, must be greater than 0. If + * this is variable, it must also be separately transmitted + * ahead of time, because the receiver must have the same + * value in its receive call. + * + * @public @memberof ipc_message_channel + */ +xrt_result_t +ipc_send_fds(struct ipc_message_channel *imc, const void *data, size_t size, const int *fds, uint32_t fd_count); + +#elif defined(XRT_OS_WINDOWS) + +/*! + * Receive a message along with a known number of file HANDLEs over the IPC + * channel. + * + * @param imc Message channel to use + * @param[out] out_data Pointer to the buffer to fill with data. Must not be + * null. + * @param[in] size Maximum size to read, must be greater than 0 + * @param[out] out_handles Array of file HANDLEs to populate. Must not be + * null. + * @param[in] handle_count Number of elements to receive into @p out_handles, + * must be greater than 0 and must match the value provided at the other end. + * + * @public @memberof ipc_message_channel + */ +xrt_result_t +ipc_receive_handles( + struct ipc_message_channel *imc, void *out_data, size_t size, HANDLE *out_handles, uint32_t handle_count); + +/*! + * Send a message along with file HANDLEs over the IPC channel. + * + * @param imc Message channel to use + * @param[in] data Pointer to the data buffer to send. Must not be + * null: use a filler message if necessary. + * @param[in] size Size of data pointed-to by @p data, must be greater than 0 + * @param[out] handles Array of file HANDLEs to send. Must not be + * null. + * @param[in] handle_count Number of elements in @p handles, must be greater + * than 0. If this is variable, it must also be separately transmitted ahead of + * time, because the receiver must have the same value in its receive call. + * + * @public @memberof ipc_message_channel + */ +xrt_result_t +ipc_send_handles( + struct ipc_message_channel *imc, const void *data, size_t size, const HANDLE *handles, uint32_t handle_count); + +#endif // XRT_OS_UNIX +/*! + * @} + */ + +/*! + * @name Shared memory handle utilities + * @brief Send/receive shared memory handles along with scalar/aggregate message + * data. + * @{ + */ + +/*! + * Receive a message along with a known number of shared memory handles over the + * IPC channel. + * + * @param imc Message channel to use + * @param[out] out_data Pointer to the buffer to fill with data. Must not be + * null. + * @param[in] size Maximum size to read, must be greater than 0 + * @param[out] out_handles Array of shared memory handles to populate. Must not + * be null. + * @param[in] handle_count Number of elements to receive into @p out_handles, + * must be greater than 0 and must match the value provided at the other end. + * + * @public @memberof ipc_message_channel + * @see xrt_shmem_handle_t + */ +xrt_result_t +ipc_receive_handles_shmem(struct ipc_message_channel *imc, + void *out_data, + size_t size, + xrt_shmem_handle_t *out_handles, + uint32_t handle_count); + + +/*! + * Send a message along with shared memory handles over the IPC channel. + * + * @param imc Message channel to use + * @param[in] data Pointer to the data buffer to send. Must not be + * null: use a filler message if necessary. + * @param[in] size Size of data pointed-to by @p data, must be greater than 0 + * @param[out] handles Array of shared memory handles to send. Must not be + * null. + * @param[in] handle_count Number of elements in @p handles, must be greater + * than 0. If this is variable, it must also be separately transmitted ahead of + * time, because the receiver must have the same value in its receive call. + * + * @public @memberof ipc_message_channel + * @see xrt_shmem_handle_t + */ +xrt_result_t +ipc_send_handles_shmem(struct ipc_message_channel *imc, + const void *data, + size_t size, + const xrt_shmem_handle_t *handles, + uint32_t handle_count); +/*! + * @} + */ + + +/*! + * @name Graphics buffer handle utilities + * @brief Send/receive graphics buffer handles along with scalar/aggregate + * message data. + * @{ + */ + +/*! + * Receive a message along with a known number of graphics buffer handles over + * the IPC channel. + * + * @param imc Message channel to use + * @param[out] out_data Pointer to the buffer to fill with data. Must not be + * null. + * @param[in] size Maximum size to read, must be greater than 0 + * @param[out] out_handles Array of graphics buffer handles to populate. Must + * not be null. + * @param[in] handle_count Number of elements to receive into @p out_handles, + * must be greater than 0 and must match the value provided at the other end. + * + * @public @memberof ipc_message_channel + * @see xrt_graphics_buffer_handle_t + */ +xrt_result_t +ipc_receive_handles_graphics_buffer(struct ipc_message_channel *imc, + void *out_data, + size_t size, + xrt_graphics_buffer_handle_t *out_handles, + uint32_t handle_count); + + +/*! + * Send a message along with native graphics buffer handles over the IPC + * channel. + * + * @param imc Message channel to use + * @param[in] data Pointer to the data buffer to send. Must not be + * null: use a filler message if necessary. + * @param[in] size Size of data pointed-to by @p data, must be greater than 0 + * @param[out] handles Array of graphics buffer handles to send. Must not be + * null. + * @param[in] handle_count Number of elements in @p handles, must be greater + * than 0. If this is variable, it must also be separately transmitted ahead of + * time, because the receiver must have the same value in its receive call. + * + * @public @memberof ipc_message_channel + * @see xrt_graphics_buffer_handle_t + */ +xrt_result_t +ipc_send_handles_graphics_buffer(struct ipc_message_channel *imc, + const void *data, + size_t size, + const xrt_graphics_buffer_handle_t *handles, + uint32_t handle_count); + +/*! + * @} + */ + + +/*! + * @name Graphics buffer handle utilities + * @brief Send/receive graphics buffer handles along with scalar/aggregate + * message data. + * @{ + */ + +/*! + * Receive a message along with a known number of graphics sync handles over + * the IPC channel. + * + * @param imc Message channel to use + * @param[out] out_data Pointer to the sync to fill with data. Must not be null. + * @param[in] size Maximum size to read, must be greater than 0 + * @param[out] out_handles Array of graphics sync handles to populate. Must not + * be null. + * @param[in] handle_count Number of elements to receive into @p out_handles, + * must be greater than 0 and must match the value provided at the other end. + * + * @public @memberof ipc_message_channel + * @see xrt_graphics_sync_handle_t + */ +xrt_result_t +ipc_receive_handles_graphics_sync(struct ipc_message_channel *imc, + void *out_data, + size_t size, + xrt_graphics_sync_handle_t *out_handles, + uint32_t handle_count); + +/*! + * Send a message along with native graphics sync handles over the IPC channel. + * + * @param imc Message channel to use + * @param[in] data Pointer to the data sync to send. Must not be null: use a + * filler message if necessary. + * @param[in] size Size of data pointed-to by @p data, must be greater than 0 + * @param[out] handles Array of graphics sync handles to send. Must not be + * null. + * @param[in] handle_count Number of elements in @p handles, must be greater than + * 0. If this is variable, it must also be separately transmitted ahead of time, + * because the receiver must have the same value in its receive call. + * + * @public @memberof ipc_message_channel + * @see xrt_graphics_sync_handle_t + */ +xrt_result_t +ipc_send_handles_graphics_sync(struct ipc_message_channel *imc, + const void *data, + size_t size, + const xrt_graphics_sync_handle_t *handles, + uint32_t handle_count); + +/*! + * @} + */ + +#ifdef __cplusplus +} +#endif diff --git a/src/xrt/ipc/shared/ipc_utils_unix.c b/src/xrt/ipc/shared/ipc_message_channel_unix.c similarity index 98% rename from src/xrt/ipc/shared/ipc_utils_unix.c rename to src/xrt/ipc/shared/ipc_message_channel_unix.c index 8521690d7..7d172bd67 100644 --- a/src/xrt/ipc/shared/ipc_utils_unix.c +++ b/src/xrt/ipc/shared/ipc_message_channel_unix.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BSL-1.0 /*! * @file - * @brief IPC util helpers, for internal use only + * @brief IPC message channel functions for UNIX platforms. * @author Ryan Pavlik * @author Pete Black * @author Jakob Bornecrantz @@ -18,8 +18,8 @@ #include "util/u_logging.h" #include "util/u_pretty_print.h" -#include "shared/ipc_utils.h" #include "shared/ipc_protocol.h" +#include "shared/ipc_message_channel.h" #include #include diff --git a/src/xrt/ipc/shared/ipc_utils_windows.cpp b/src/xrt/ipc/shared/ipc_message_channel_windows.cpp similarity index 98% rename from src/xrt/ipc/shared/ipc_utils_windows.cpp rename to src/xrt/ipc/shared/ipc_message_channel_windows.cpp index cd2319123..b14c98949 100644 --- a/src/xrt/ipc/shared/ipc_utils_windows.cpp +++ b/src/xrt/ipc/shared/ipc_message_channel_windows.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: BSL-1.0 /*! * @file - * @brief IPC util helpers on Windows, for internal use only + * @brief IPC message channel functions for Windows. * @author Julian Petrov * @author Ryan Pavlik * @author Pete Black @@ -22,6 +22,7 @@ #include "shared/ipc_utils.h" #include "shared/ipc_protocol.h" +#include "shared/ipc_message_channel.h" #include #include diff --git a/src/xrt/ipc/shared/ipc_utils.h b/src/xrt/ipc/shared/ipc_utils.h index ce2c85f3e..e168f1de6 100644 --- a/src/xrt/ipc/shared/ipc_utils.h +++ b/src/xrt/ipc/shared/ipc_utils.h @@ -1,22 +1,22 @@ -// Copyright 2020, Collabora, Ltd. +// Copyright 2020-2023, Collabora, Ltd. +// Copyright 2022, Magic Leap, Inc. // SPDX-License-Identifier: BSL-1.0 /*! * @file * @brief IPC util helpers, for internal use only - * @author Ryan Pavlik + * @author Julian Petrov + * @author Jakob Bornecrantz * @ingroup ipc_shared */ #pragma once -#include -#include +#include "xrt/xrt_config_os.h" -#include -#include -#include +#ifdef XRT_OS_WINDOWS +#include "util/u_windows.h" +#endif -#include "util/u_logging.h" #ifdef __cplusplus extern "C" { @@ -44,324 +44,6 @@ ipc_winerror(DWORD err); #endif -/* - * - * Channel functions. - * - */ - -/*! - * Wrapper for a socket and flags. - */ -struct ipc_message_channel -{ - xrt_ipc_handle_t ipc_handle; - enum u_logging_level log_level; -}; - -/*! - * Close an IPC message channel - * - * @public @memberof ipc_message_channel - */ -void -ipc_message_channel_close(struct ipc_message_channel *imc); - -/*! - * Send a bare message over the IPC channel. - * - * There are other functions if you have handles, not just scalar/aggregate - * data. - * - * @param imc Message channel to use - * @param[in] data Pointer to the data buffer to send. Must not be - * null: use a filler message if necessary. - * @param[in] size Size of data pointed-to by @p data, must be greater than 0 - * - * @public @memberof ipc_message_channel - */ -xrt_result_t -ipc_send(struct ipc_message_channel *imc, const void *data, size_t size); - -/*! - * Receive a bare message over the IPC channel. - * - * There are other functions if you have handles, not just scalar/aggregate - * data. - * - * @param imc Message channel to use - * @param[out] out_data Pointer to the buffer to fill with data. Must not be - * null. - * @param[in] size Maximum size to read, must be greater than 0 - * - * @public @memberof ipc_message_channel - */ -xrt_result_t -ipc_receive(struct ipc_message_channel *imc, void *out_data, size_t size); - -/*! - * @name File Descriptor or HANDLE utilities - * @brief These are typically called from within the send/receive_handles - * functions. - * @{ - */ -#ifdef XRT_OS_UNIX - -/*! - * Receive a message along with a known number of file descriptors over the IPC - * channel. - * - * @param imc Message channel to use - * @param[out] out_data Pointer to the buffer to fill with data. Must not be - * null. - * @param[in] size Maximum size to read, must be greater than 0 - * @param[out] out_fds Array of file descriptors to populate. Must not be null. - * @param[in] fd_count Number of elements to receive into @p out_fds, must be - * greater than 0 and must match the value provided at the - * other end. - * - * @public @memberof ipc_message_channel - */ -xrt_result_t -ipc_receive_fds(struct ipc_message_channel *imc, void *out_data, size_t size, int *out_fds, uint32_t fd_count); - -/*! - * Send a message along with file descriptors over the IPC channel. - * - * @param imc Message channel to use - * @param[in] data Pointer to the data buffer to send. Must not be - * null: use a filler message if necessary. - * @param[in] size Size of data pointed-to by @p data, must be greater than 0. - * @param[out] fds Array of file descriptors to send. Must not benull. - * @param[in] fd_count Number of elements in @p fds, must be greater than 0. If - * this is variable, it must also be separately transmitted - * ahead of time, because the receiver must have the same - * value in its receive call. - * - * @public @memberof ipc_message_channel - */ -xrt_result_t -ipc_send_fds(struct ipc_message_channel *imc, const void *data, size_t size, const int *fds, uint32_t fd_count); - -#elif defined(XRT_OS_WINDOWS) - -/*! - * Receive a message along with a known number of file HANDLEs over the IPC - * channel. - * - * @param imc Message channel to use - * @param[out] out_data Pointer to the buffer to fill with data. Must not be - * null. - * @param[in] size Maximum size to read, must be greater than 0 - * @param[out] out_handles Array of file HANDLEs to populate. Must not be - * null. - * @param[in] handle_count Number of elements to receive into @p out_handles, - * must be greater than 0 and must match the value provided at the other end. - * - * @public @memberof ipc_message_channel - */ -xrt_result_t -ipc_receive_handles( - struct ipc_message_channel *imc, void *out_data, size_t size, HANDLE *out_handles, uint32_t handle_count); - -/*! - * Send a message along with file HANDLEs over the IPC channel. - * - * @param imc Message channel to use - * @param[in] data Pointer to the data buffer to send. Must not be - * null: use a filler message if necessary. - * @param[in] size Size of data pointed-to by @p data, must be greater than 0 - * @param[out] handles Array of file HANDLEs to send. Must not be - * null. - * @param[in] handle_count Number of elements in @p handles, must be greater - * than 0. If this is variable, it must also be separately transmitted ahead of - * time, because the receiver must have the same value in its receive call. - * - * @public @memberof ipc_message_channel - */ -xrt_result_t -ipc_send_handles( - struct ipc_message_channel *imc, const void *data, size_t size, const HANDLE *handles, uint32_t handle_count); - -#endif // XRT_OS_UNIX -/*! - * @} - */ - -/*! - * @name Shared memory handle utilities - * @brief Send/receive shared memory handles along with scalar/aggregate message - * data. - * @{ - */ - -/*! - * Receive a message along with a known number of shared memory handles over the - * IPC channel. - * - * @param imc Message channel to use - * @param[out] out_data Pointer to the buffer to fill with data. Must not be - * null. - * @param[in] size Maximum size to read, must be greater than 0 - * @param[out] out_handles Array of shared memory handles to populate. Must not - * be null. - * @param[in] handle_count Number of elements to receive into @p out_handles, - * must be greater than 0 and must match the value provided at the other end. - * - * @public @memberof ipc_message_channel - * @see xrt_shmem_handle_t - */ -xrt_result_t -ipc_receive_handles_shmem(struct ipc_message_channel *imc, - void *out_data, - size_t size, - xrt_shmem_handle_t *out_handles, - uint32_t handle_count); - - -/*! - * Send a message along with shared memory handles over the IPC channel. - * - * @param imc Message channel to use - * @param[in] data Pointer to the data buffer to send. Must not be - * null: use a filler message if necessary. - * @param[in] size Size of data pointed-to by @p data, must be greater than 0 - * @param[out] handles Array of shared memory handles to send. Must not be - * null. - * @param[in] handle_count Number of elements in @p handles, must be greater - * than 0. If this is variable, it must also be separately transmitted ahead of - * time, because the receiver must have the same value in its receive call. - * - * @public @memberof ipc_message_channel - * @see xrt_shmem_handle_t - */ -xrt_result_t -ipc_send_handles_shmem(struct ipc_message_channel *imc, - const void *data, - size_t size, - const xrt_shmem_handle_t *handles, - uint32_t handle_count); -/*! - * @} - */ - - -/*! - * @name Graphics buffer handle utilities - * @brief Send/receive graphics buffer handles along with scalar/aggregate - * message data. - * @{ - */ - -/*! - * Receive a message along with a known number of graphics buffer handles over - * the IPC channel. - * - * @param imc Message channel to use - * @param[out] out_data Pointer to the buffer to fill with data. Must not be - * null. - * @param[in] size Maximum size to read, must be greater than 0 - * @param[out] out_handles Array of graphics buffer handles to populate. Must - * not be null. - * @param[in] handle_count Number of elements to receive into @p out_handles, - * must be greater than 0 and must match the value provided at the other end. - * - * @public @memberof ipc_message_channel - * @see xrt_graphics_buffer_handle_t - */ -xrt_result_t -ipc_receive_handles_graphics_buffer(struct ipc_message_channel *imc, - void *out_data, - size_t size, - xrt_graphics_buffer_handle_t *out_handles, - uint32_t handle_count); - - -/*! - * Send a message along with native graphics buffer handles over the IPC - * channel. - * - * @param imc Message channel to use - * @param[in] data Pointer to the data buffer to send. Must not be - * null: use a filler message if necessary. - * @param[in] size Size of data pointed-to by @p data, must be greater than 0 - * @param[out] handles Array of graphics buffer handles to send. Must not be - * null. - * @param[in] handle_count Number of elements in @p handles, must be greater - * than 0. If this is variable, it must also be separately transmitted ahead of - * time, because the receiver must have the same value in its receive call. - * - * @public @memberof ipc_message_channel - * @see xrt_graphics_buffer_handle_t - */ -xrt_result_t -ipc_send_handles_graphics_buffer(struct ipc_message_channel *imc, - const void *data, - size_t size, - const xrt_graphics_buffer_handle_t *handles, - uint32_t handle_count); - -/*! - * @} - */ - - -/*! - * @name Graphics buffer handle utilities - * @brief Send/receive graphics buffer handles along with scalar/aggregate - * message data. - * @{ - */ - -/*! - * Receive a message along with a known number of graphics sync handles over - * the IPC channel. - * - * @param imc Message channel to use - * @param[out] out_data Pointer to the sync to fill with data. Must not be null. - * @param[in] size Maximum size to read, must be greater than 0 - * @param[out] out_handles Array of graphics sync handles to populate. Must not - * be null. - * @param[in] handle_count Number of elements to receive into @p out_handles, - * must be greater than 0 and must match the value provided at the other end. - * - * @public @memberof ipc_message_channel - * @see xrt_graphics_sync_handle_t - */ -xrt_result_t -ipc_receive_handles_graphics_sync(struct ipc_message_channel *imc, - void *out_data, - size_t size, - xrt_graphics_sync_handle_t *out_handles, - uint32_t handle_count); - -/*! - * Send a message along with native graphics sync handles over the IPC channel. - * - * @param imc Message channel to use - * @param[in] data Pointer to the data sync to send. Must not be null: use a - * filler message if necessary. - * @param[in] size Size of data pointed-to by @p data, must be greater than 0 - * @param[out] handles Array of graphics sync handles to send. Must not be - * null. - * @param[in] handle_count Number of elements in @p handles, must be greater than - * 0. If this is variable, it must also be separately transmitted ahead of time, - * because the receiver must have the same value in its receive call. - * - * @public @memberof ipc_message_channel - * @see xrt_graphics_sync_handle_t - */ -xrt_result_t -ipc_send_handles_graphics_sync(struct ipc_message_channel *imc, - const void *data, - size_t size, - const xrt_graphics_sync_handle_t *handles, - uint32_t handle_count); - -/*! - * @} - */ - #ifdef __cplusplus } #endif