The open source OpenXR runtime
0
fork

Configure Feed

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

ipc: Support sending sync handles on layer_commit

+41 -4
+22 -3
src/xrt/ipc/client/ipc_client_compositor.c
··· 28 28 #include <errno.h> 29 29 #include <assert.h> 30 30 31 + #ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD 32 + #include <unistd.h> 33 + #endif 34 + 31 35 32 36 /* 33 37 * ··· 616 620 { 617 621 struct ipc_client_compositor *icc = ipc_client_compositor(xc); 618 622 619 - assert(!xrt_graphics_sync_handle_is_valid(sync_handle)); 623 + bool valid_sync = xrt_graphics_sync_handle_is_valid(sync_handle); 620 624 621 625 struct ipc_shared_memory *ism = icc->ipc_c->ism; 622 626 struct ipc_layer_slot *slot = &ism->slots[icc->layers.slot_id]; ··· 624 628 // Last bit of data to put in the shared memory area. 625 629 slot->num_layers = icc->layers.num_layers; 626 630 627 - IPC_CALL_CHK(ipc_call_compositor_layer_sync( 628 - icc->ipc_c, frame_id, icc->layers.slot_id, &icc->layers.slot_id)); 631 + IPC_CALL_CHK(ipc_call_compositor_layer_sync( // 632 + icc->ipc_c, // 633 + frame_id, // 634 + icc->layers.slot_id, // 635 + &sync_handle, // 636 + valid_sync ? 1 : 0, // 637 + &icc->layers.slot_id)); // 629 638 630 639 // Reset. 631 640 icc->layers.num_layers = 0; 641 + 642 + #ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD 643 + // Need to consume this handle. 644 + if (valid_sync) { 645 + close(sync_handle); 646 + sync_handle = XRT_GRAPHICS_SYNC_HANDLE_INVALID; 647 + } 648 + #else 649 + #error "Not yet implemented for this platform" 650 + #endif 632 651 633 652 return res; 634 653 }
+18 -1
src/xrt/ipc/server/ipc_server_handler.c
··· 14 14 #include "server/ipc_server.h" 15 15 #include "ipc_server_generated.h" 16 16 17 + #ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD 18 + #include <unistd.h> 19 + #endif 20 + 17 21 18 22 /* 19 23 * ··· 183 187 ipc_handle_compositor_layer_sync(volatile struct ipc_client_state *ics, 184 188 int64_t frame_id, 185 189 uint32_t slot_id, 186 - uint32_t *out_free_slot_id) 190 + uint32_t *out_free_slot_id, 191 + const xrt_graphics_sync_handle_t *handles, 192 + const uint32_t num_handles) 187 193 { 188 194 struct ipc_shared_memory *ism = ics->server->ism; 189 195 struct ipc_layer_slot *slot = &ism->slots[slot_id]; 196 + 197 + for (uint32_t i = 0; i < num_handles; i++) { 198 + if (!xrt_graphics_sync_handle_is_valid(handles[i])) { 199 + continue; 200 + } 201 + #ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD 202 + close(handles[i]); 203 + #else 204 + #error "Need port to transport these graphics buffers" 205 + #endif 206 + } 190 207 191 208 // Copy current slot data to our state. 192 209 ics->render_state = *slot;
+1
src/xrt/ipc/shared/proto.json
··· 99 99 {"name": "frame_id", "type": "int64_t"}, 100 100 {"name": "slot_id", "type": "uint32_t"} 101 101 ], 102 + "in_handles": {"type": "xrt_graphics_sync_handle_t"}, 102 103 "out": [ 103 104 {"name": "free_slot_id", "type": "uint32_t"} 104 105 ]