The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipc/shared: Support sending graphics sync handles

+104
+44
src/xrt/ipc/shared/ipc_utils.c
··· 329 329 #else 330 330 #error "Need port to transport these graphics buffers" 331 331 #endif 332 + 333 + 334 + /* 335 + * 336 + * FD graphics sync functions. 337 + * 338 + */ 339 + 340 + #if defined(XRT_GRAPHICS_SYNC_HANDLE_IS_FD) 341 + 342 + xrt_result_t 343 + ipc_receive_handles_graphics_sync(struct ipc_message_channel *imc, 344 + void *out_data, 345 + size_t size, 346 + xrt_graphics_sync_handle_t *out_handles, 347 + uint32_t num_handles) 348 + { 349 + //! @todo Temporary hack to send no handles. 350 + if (num_handles == 0) { 351 + return ipc_receive(imc, out_data, size); 352 + } else { 353 + return ipc_receive_fds(imc, out_data, size, out_handles, 354 + num_handles); 355 + } 356 + } 357 + 358 + xrt_result_t 359 + ipc_send_handles_graphics_sync(struct ipc_message_channel *imc, 360 + const void *data, 361 + size_t size, 362 + const xrt_graphics_sync_handle_t *handles, 363 + uint32_t num_handles) 364 + { 365 + //! @todo Temporary hack to send no handles. 366 + if (num_handles == 0) { 367 + return ipc_send(imc, data, size); 368 + } else { 369 + return ipc_send_fds(imc, data, size, handles, num_handles); 370 + } 371 + } 372 + 373 + #else 374 + #error "Need port to transport these graphics buffers" 375 + #endif
+60
src/xrt/ipc/shared/ipc_utils.h
··· 181 181 * @} 182 182 */ 183 183 184 + 184 185 /*! 185 186 * @name Graphics buffer handle utilities 186 187 * @brief Send/receive graphics buffer handles along with scalar/aggregate 187 188 * message data. 188 189 * @{ 189 190 */ 191 + 190 192 /*! 191 193 * Receive a message along with a known number of graphics buffer handles over 192 194 * the IPC channel. ··· 234 236 size_t size, 235 237 const xrt_graphics_buffer_handle_t *handles, 236 238 uint32_t num_handles); 239 + 240 + /*! 241 + * @} 242 + */ 243 + 244 + 245 + /*! 246 + * @name Graphics buffer handle utilities 247 + * @brief Send/receive graphics buffer handles along with scalar/aggregate 248 + * message data. 249 + * @{ 250 + */ 251 + 252 + /*! 253 + * Receive a message along with a known number of graphics sync handles over 254 + * the IPC channel. 255 + * 256 + * @param imc Message channel to use 257 + * @param[out] out_data Pointer to the sync to fill with data. Must not be null. 258 + * @param[in] size Maximum size to read, must be greater than 0 259 + * @param[out] out_handles Array of graphics sync handles to populate. Must not 260 + * be null. 261 + * @param[in] num_handles Number of elements to receive into @p out_handles, 262 + * must be greater than 0 and must match the value provided at the other end. 263 + * 264 + * @public @memberof ipc_message_channel 265 + * @relatesalso xrt_graphics_sync_handle_t 266 + */ 267 + xrt_result_t 268 + ipc_receive_handles_graphics_sync(struct ipc_message_channel *imc, 269 + void *out_data, 270 + size_t size, 271 + xrt_graphics_sync_handle_t *out_handles, 272 + uint32_t num_handles); 273 + 274 + /*! 275 + * Send a message along with native graphics sync handles over the IPC channel. 276 + * 277 + * @param imc Message channel to use 278 + * @param[in] data Pointer to the data sync to send. Must not be null: use a 279 + * filler message if necessary. 280 + * @param[in] size Size of data pointed-to by @p data, must be greater than 0 281 + * @param[out] handles Array of graphics sync handles to send. Must not be 282 + * null. 283 + * @param[in] num_handles Number of elements in @p handles, must be greater than 284 + * 0. If this is variable, it must also be separately transmitted ahead of time, 285 + * because the receiver must have the same value in its receive call. 286 + * 287 + * @public @memberof ipc_message_channel 288 + * @relatesalso xrt_graphics_sync_handle_t 289 + */ 290 + xrt_result_t 291 + ipc_send_handles_graphics_sync(struct ipc_message_channel *imc, 292 + const void *data, 293 + size_t size, 294 + const xrt_graphics_sync_handle_t *handles, 295 + uint32_t num_handles); 296 + 237 297 /*! 238 298 * @} 239 299 */