The open source OpenXR runtime
0
fork

Configure Feed

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

ipc: Add support for xrt_device::get_view_poses

+95
+14
src/xrt/ipc/client/ipc_client_device.c
··· 130 130 } 131 131 132 132 static void 133 + ipc_client_device_get_view_poses(struct xrt_device *xdev, 134 + const struct xrt_vec3 *default_eye_relation, 135 + uint64_t at_timestamp_ns, 136 + uint32_t view_count, 137 + struct xrt_space_relation *out_head_relation, 138 + struct xrt_fov *out_fovs, 139 + struct xrt_pose *out_poses) 140 + { 141 + // Empty 142 + assert(false); 143 + } 144 + 145 + static void 133 146 ipc_client_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, union xrt_output_value *value) 134 147 { 135 148 struct ipc_client_device *icd = ipc_client_device(xdev); ··· 158 171 icd->base.get_tracked_pose = ipc_client_device_get_tracked_pose; 159 172 icd->base.get_hand_tracking = ipc_client_device_get_hand_tracking; 160 173 icd->base.get_view_pose = ipc_client_device_get_view_pose; 174 + icd->base.get_view_poses = ipc_client_device_get_view_poses; 161 175 icd->base.set_output = ipc_client_device_set_output; 162 176 icd->base.destroy = ipc_client_device_destroy; 163 177
+37
src/xrt/ipc/client/ipc_client_hmd.c
··· 118 118 } 119 119 } 120 120 121 + static void 122 + ipc_client_hmd_get_view_poses(struct xrt_device *xdev, 123 + const struct xrt_vec3 *default_eye_relation, 124 + uint64_t at_timestamp_ns, 125 + uint32_t view_count, 126 + struct xrt_space_relation *out_head_relation, 127 + struct xrt_fov *out_fovs, 128 + struct xrt_pose *out_poses) 129 + { 130 + struct ipc_client_hmd *ich = ipc_client_hmd(xdev); 131 + 132 + struct ipc_info_get_view_poses_2 info = {0}; 133 + 134 + if (view_count == 2) { 135 + xrt_result_t r = ipc_call_device_get_view_poses_2( // 136 + ich->ipc_c, // 137 + ich->device_id, // 138 + default_eye_relation, // 139 + at_timestamp_ns, // 140 + &info); // 141 + if (r != XRT_SUCCESS) { 142 + IPC_ERROR(ich->ipc_c, "Error calling view poses!"); 143 + } 144 + 145 + *out_head_relation = info.head_relation; 146 + for (int i = 0; i < 2; i++) { 147 + out_fovs[i] = info.fovs[i]; 148 + out_poses[i] = info.poses[i]; 149 + } 150 + } else { 151 + IPC_ERROR(ich->ipc_c, "Can not handle %u view_count, only 2 supported.", view_count); 152 + assert(false && !"Can only handle view_count of 2."); 153 + } 154 + } 155 + 156 + 121 157 /*! 122 158 * @public @memberof ipc_client_hmd 123 159 */ ··· 136 172 ich->base.update_inputs = ipc_client_hmd_update_inputs; 137 173 ich->base.get_tracked_pose = ipc_client_hmd_get_tracked_pose; 138 174 ich->base.get_view_pose = ipc_client_hmd_get_view_pose; 175 + ich->base.get_view_poses = ipc_client_hmd_get_view_poses; 139 176 ich->base.destroy = ipc_client_hmd_destroy; 140 177 141 178 // Start copying the information from the isdev.
+23
src/xrt/ipc/server/ipc_server_handler.c
··· 972 972 } 973 973 974 974 xrt_result_t 975 + ipc_handle_device_get_view_poses_2(volatile struct ipc_client_state *ics, 976 + uint32_t id, 977 + const struct xrt_vec3 *default_eye_relation, 978 + uint64_t at_timestamp_ns, 979 + struct ipc_info_get_view_poses_2 *out_info) 980 + { 981 + // To make the code a bit more readable. 982 + uint32_t device_id = id; 983 + struct xrt_device *xdev = get_xdev(ics, device_id); 984 + 985 + xrt_device_get_view_poses( // 986 + xdev, // 987 + default_eye_relation, // 988 + at_timestamp_ns, // 989 + 2, // 990 + &out_info->head_relation, // 991 + out_info->fovs, // 992 + out_info->poses); // 993 + 994 + return XRT_SUCCESS; 995 + } 996 + 997 + xrt_result_t 975 998 ipc_handle_device_set_output(volatile struct ipc_client_state *ics, 976 999 uint32_t id, 977 1000 enum xrt_output_name name,
+10
src/xrt/ipc/shared/ipc_protocol.h
··· 278 278 { 279 279 size_t sizes[IPC_MAX_SWAPCHAIN_HANDLES]; 280 280 }; 281 + 282 + /*! 283 + * Arguments for xrt_device::get_view_poses with two views. 284 + */ 285 + struct ipc_info_get_view_poses_2 286 + { 287 + struct xrt_fov fovs[2]; 288 + struct xrt_pose poses[2]; 289 + struct xrt_space_relation head_relation; 290 + };
+11
src/xrt/ipc/shared/proto.json
··· 212 212 ] 213 213 }, 214 214 215 + "device_get_view_poses_2": { 216 + "in": [ 217 + {"name": "id", "type": "uint32_t"}, 218 + {"name": "fallback_eye_relation", "type": "const struct xrt_vec3"}, 219 + {"name": "at_timestamp_ns", "type": "uint64_t"} 220 + ], 221 + "out": [ 222 + {"name": "info", "type": "struct ipc_info_get_view_poses_2"} 223 + ] 224 + }, 225 + 215 226 "device_set_output": { 216 227 "in": [ 217 228 {"name": "id", "type": "uint32_t"},