···329329#else
330330#error "Need port to transport these graphics buffers"
331331#endif
332332+333333+334334+/*
335335+ *
336336+ * FD graphics sync functions.
337337+ *
338338+ */
339339+340340+#if defined(XRT_GRAPHICS_SYNC_HANDLE_IS_FD)
341341+342342+xrt_result_t
343343+ipc_receive_handles_graphics_sync(struct ipc_message_channel *imc,
344344+ void *out_data,
345345+ size_t size,
346346+ xrt_graphics_sync_handle_t *out_handles,
347347+ uint32_t num_handles)
348348+{
349349+ //! @todo Temporary hack to send no handles.
350350+ if (num_handles == 0) {
351351+ return ipc_receive(imc, out_data, size);
352352+ } else {
353353+ return ipc_receive_fds(imc, out_data, size, out_handles,
354354+ num_handles);
355355+ }
356356+}
357357+358358+xrt_result_t
359359+ipc_send_handles_graphics_sync(struct ipc_message_channel *imc,
360360+ const void *data,
361361+ size_t size,
362362+ const xrt_graphics_sync_handle_t *handles,
363363+ uint32_t num_handles)
364364+{
365365+ //! @todo Temporary hack to send no handles.
366366+ if (num_handles == 0) {
367367+ return ipc_send(imc, data, size);
368368+ } else {
369369+ return ipc_send_fds(imc, data, size, handles, num_handles);
370370+ }
371371+}
372372+373373+#else
374374+#error "Need port to transport these graphics buffers"
375375+#endif
+60
src/xrt/ipc/shared/ipc_utils.h
···181181 * @}
182182 */
183183184184+184185/*!
185186 * @name Graphics buffer handle utilities
186187 * @brief Send/receive graphics buffer handles along with scalar/aggregate
187188 * message data.
188189 * @{
189190 */
191191+190192/*!
191193 * Receive a message along with a known number of graphics buffer handles over
192194 * the IPC channel.
···234236 size_t size,
235237 const xrt_graphics_buffer_handle_t *handles,
236238 uint32_t num_handles);
239239+240240+/*!
241241+ * @}
242242+ */
243243+244244+245245+/*!
246246+ * @name Graphics buffer handle utilities
247247+ * @brief Send/receive graphics buffer handles along with scalar/aggregate
248248+ * message data.
249249+ * @{
250250+ */
251251+252252+/*!
253253+ * Receive a message along with a known number of graphics sync handles over
254254+ * the IPC channel.
255255+ *
256256+ * @param imc Message channel to use
257257+ * @param[out] out_data Pointer to the sync to fill with data. Must not be null.
258258+ * @param[in] size Maximum size to read, must be greater than 0
259259+ * @param[out] out_handles Array of graphics sync handles to populate. Must not
260260+ * be null.
261261+ * @param[in] num_handles Number of elements to receive into @p out_handles,
262262+ * must be greater than 0 and must match the value provided at the other end.
263263+ *
264264+ * @public @memberof ipc_message_channel
265265+ * @relatesalso xrt_graphics_sync_handle_t
266266+ */
267267+xrt_result_t
268268+ipc_receive_handles_graphics_sync(struct ipc_message_channel *imc,
269269+ void *out_data,
270270+ size_t size,
271271+ xrt_graphics_sync_handle_t *out_handles,
272272+ uint32_t num_handles);
273273+274274+/*!
275275+ * Send a message along with native graphics sync handles over the IPC channel.
276276+ *
277277+ * @param imc Message channel to use
278278+ * @param[in] data Pointer to the data sync to send. Must not be null: use a
279279+ * filler message if necessary.
280280+ * @param[in] size Size of data pointed-to by @p data, must be greater than 0
281281+ * @param[out] handles Array of graphics sync handles to send. Must not be
282282+ * null.
283283+ * @param[in] num_handles Number of elements in @p handles, must be greater than
284284+ * 0. If this is variable, it must also be separately transmitted ahead of time,
285285+ * because the receiver must have the same value in its receive call.
286286+ *
287287+ * @public @memberof ipc_message_channel
288288+ * @relatesalso xrt_graphics_sync_handle_t
289289+ */
290290+xrt_result_t
291291+ipc_send_handles_graphics_sync(struct ipc_message_channel *imc,
292292+ const void *data,
293293+ size_t size,
294294+ const xrt_graphics_sync_handle_t *handles,
295295+ uint32_t num_handles);
296296+237297/*!
238298 * @}
239299 */