The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Adds framework for face-tracking xrt-devices

+133 -17
+2 -1
src/xrt/auxiliary/util/u_pretty_print.c
··· 1 - // Copyright 2022-2023, Collabora, Ltd. 1 + // Copyright 2022-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 36 36 case XRT_INPUT_TYPE_BOOLEAN: return "BOOLEAN"; 37 37 case XRT_INPUT_TYPE_POSE: return "POSE"; 38 38 case XRT_INPUT_TYPE_HAND_TRACKING: return "HAND_TRACKING"; 39 + case XRT_INPUT_TYPE_FACE_TRACKING: return "FACE_TRACKING"; 39 40 default: return "<UNKNOWN>"; 40 41 } 41 42 }
+14 -2
src/xrt/include/xrt/xrt_defines.h
··· 1 - // Copyright 2019-2023, Collabora, Ltd. 1 + // Copyright 2019-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 768 768 XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER, 769 769 XRT_DEVICE_TYPE_GENERIC_TRACKER, 770 770 XRT_DEVICE_TYPE_HAND_TRACKER, 771 - XRT_DEVICE_TYPE_EYE_TRACKER 771 + XRT_DEVICE_TYPE_EYE_TRACKER, 772 + XRT_DEVICE_TYPE_FACE_TRACKER 772 773 }; 773 774 774 775 /*! ··· 793 794 XRT_INPUT_TYPE_POSE = 0x05, 794 795 //! A tracked hand 795 796 XRT_INPUT_TYPE_HAND_TRACKING = 0x06, 797 + //! A tracked face 798 + XRT_INPUT_TYPE_FACE_TRACKING = 0x07 796 799 // clang-format on 797 800 }; 798 801 ··· 1114 1117 XRT_INPUT_OPPO_MR_THUMBSTICK_CLICK = XRT_INPUT_NAME(0x0510, BOOLEAN), 1115 1118 XRT_INPUT_OPPO_MR_THUMBSTICK_TOUCH = XRT_INPUT_NAME(0x0511, BOOLEAN), 1116 1119 XRT_INPUT_OPPO_MR_THUMBSTICK = XRT_INPUT_NAME(0x0512, VEC2_MINUS_ONE_TO_ONE), 1120 + 1121 + XRT_INPUT_GENERIC_FACE_TRACKING = XRT_INPUT_NAME(0x0600, FACE_TRACKING), 1117 1122 // clang-format on 1118 1123 }; 1119 1124 ··· 1260 1265 }; 1261 1266 1262 1267 #define XRT_OUTPUT_NAME(id, type) ((UINT32_C(id) << XRT_OUTPUT_TYPE_BITWIDTH) | (uint32_t)XRT_OUTPUT_TYPE_##type) 1268 + 1269 + struct xrt_facial_expression_set 1270 + { 1271 + union { 1272 + struct xrt_facial_expression_empty_set* placeholder; 1273 + }; 1274 + }; 1263 1275 1264 1276 /*! 1265 1277 * Name of a output with a baked in type.
+32 -2
src/xrt/include/xrt/xrt_device.h
··· 1 - // Copyright 2019-2021, Collabora, Ltd. 1 + // Copyright 2019-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Header defining an xrt display or controller device. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 7 * @author Moses Turner <mosesturner@protonmail.com> 8 + * @author Korcan Hussein <korcan.hussein@collabora.com> 8 9 * @ingroup xrt_iface 9 10 */ 10 11 ··· 265 266 bool ref_space_usage_supported; 266 267 bool form_factor_check_supported; 267 268 bool stage_supported; 268 - 269 + bool face_tracking_supported; 269 270 270 271 /* 271 272 * ··· 339 340 uint64_t *out_timestamp_ns); 340 341 341 342 /*! 343 + * @brief Get the requested blend shape properties & weights for a face tracker 344 + * 345 + * @param[in] xdev The device. 346 + * @param[in] facial_expression_type The facial expression data type (XR_FB_face_tracking, 347 + * XR_HTC_facial_tracking, etc). 348 + * @param[in] out_value Set of requested expression weights & blend shape properties. 349 + * 350 + * @see xrt_input_name 351 + */ 352 + xrt_result_t (*get_face_tracking)(struct xrt_device *xdev, 353 + enum xrt_input_name facial_expression_type, 354 + struct xrt_facial_expression_set *out_value); 355 + 356 + /*! 342 357 * Set a output value. 343 358 * 344 359 * @param[in] xdev The device. ··· 505 520 uint64_t *out_timestamp_ns) 506 521 { 507 522 xdev->get_hand_tracking(xdev, name, desired_timestamp_ns, out_value, out_timestamp_ns); 523 + } 524 + 525 + /*! 526 + * Helper function for @ref xrt_device::get_face_tracking. 527 + * 528 + * @copydoc xrt_device::get_face_tracking 529 + * 530 + * @public @memberof xrt_device 531 + */ 532 + static inline xrt_result_t 533 + xrt_device_get_face_tracking(struct xrt_device *xdev, 534 + enum xrt_input_name facial_expression_type, 535 + struct xrt_facial_expression_set *out_value) 536 + { 537 + return xdev->get_face_tracking(xdev, facial_expression_type, out_value); 508 538 } 509 539 510 540 /*!
+7 -1
src/xrt/include/xrt/xrt_system.h
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // Copyright 2023, NVIDIA CORPORATION. 3 3 // SPDX-License-Identifier: BSL-1.0 4 4 /*! ··· 251 251 * (optional). 252 252 */ 253 253 struct xrt_device *eyes; 254 + 255 + /*! 256 + * An observing pointer to the device providing face tracking 257 + * (optional). 258 + */ 259 + struct xrt_device *face; 254 260 255 261 /*! 256 262 * Devices providing optical (or otherwise more directly
+19 -1
src/xrt/ipc/client/ipc_client_device.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief IPC Client device. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Korcan Hussein <korcan.hussein@collabora.com> 7 8 * @ingroup ipc_client 8 9 */ 9 10 ··· 117 118 IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_get_hand_tracking"); 118 119 } 119 120 121 + static xrt_result_t 122 + ipc_client_device_get_face_tracking(struct xrt_device *xdev, 123 + enum xrt_input_name facial_expression_type, 124 + struct xrt_facial_expression_set *out_value) 125 + { 126 + ipc_client_device_t *icd = ipc_client_device(xdev); 127 + 128 + xrt_result_t xret = ipc_call_device_get_face_tracking( // 129 + icd->ipc_c, // 130 + icd->device_id, // 131 + facial_expression_type, // 132 + out_value); // 133 + IPC_CHK_ALWAYS_RET(icd->ipc_c, xret, "ipc_call_device_get_face_tracking"); 134 + } 135 + 120 136 static void 121 137 ipc_client_device_get_view_poses(struct xrt_device *xdev, 122 138 const struct xrt_vec3 *default_eye_relation, ··· 166 182 icd->base.update_inputs = ipc_client_device_update_inputs; 167 183 icd->base.get_tracked_pose = ipc_client_device_get_tracked_pose; 168 184 icd->base.get_hand_tracking = ipc_client_device_get_hand_tracking; 185 + icd->base.get_face_tracking = ipc_client_device_get_face_tracking; 169 186 icd->base.get_view_poses = ipc_client_device_get_view_poses; 170 187 icd->base.set_output = ipc_client_device_set_output; 171 188 icd->base.get_visibility_mask = ipc_client_device_get_visibility_mask; ··· 223 240 icd->base.position_tracking_supported = isdev->position_tracking_supported; 224 241 icd->base.hand_tracking_supported = isdev->hand_tracking_supported; 225 242 icd->base.eye_gaze_supported = isdev->eye_gaze_supported; 243 + icd->base.face_tracking_supported = isdev->face_tracking_supported; 226 244 icd->base.force_feedback_supported = isdev->force_feedback_supported; 227 245 icd->base.stage_supported = isdev->stage_supported; 228 246
+3 -1
src/xrt/ipc/client/ipc_client_hmd.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief IPC Client HMD device. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Korcan Hussein <korcan.hussein@collabora.com> 7 8 * @ingroup ipc_client 8 9 */ 9 10 ··· 370 371 ich->base.device_type = isdev->device_type; 371 372 ich->base.hand_tracking_supported = isdev->hand_tracking_supported; 372 373 ich->base.eye_gaze_supported = isdev->eye_gaze_supported; 374 + ich->base.face_tracking_supported = isdev->face_tracking_supported; 373 375 ich->base.force_feedback_supported = isdev->force_feedback_supported; 374 376 ich->base.form_factor_check_supported = isdev->form_factor_check_supported; 375 377 ich->base.stage_supported = isdev->stage_supported;
+2 -1
src/xrt/ipc/client/ipc_client_instance.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 168 168 169 169 SET_ROLE(head); 170 170 SET_ROLE(eyes); 171 + SET_ROLE(face); 171 172 SET_ROLE(hand_tracking.left); 172 173 SET_ROLE(hand_tracking.right); 173 174
+13 -1
src/xrt/ipc/server/ipc_server_handler.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 1860 1860 { 1861 1861 return xrt_system_devices_get_roles(ics->server->xsysd, out_roles); 1862 1862 } 1863 + 1864 + xrt_result_t 1865 + ipc_handle_device_get_face_tracking(volatile struct ipc_client_state *ics, 1866 + uint32_t id, 1867 + enum xrt_input_name facial_expression_type, 1868 + struct xrt_facial_expression_set *out_value) 1869 + { 1870 + const uint32_t device_id = id; 1871 + struct xrt_device *xdev = get_xdev(ics, device_id); 1872 + // Get facial expression data. 1873 + return xrt_device_get_face_tracking(xdev, facial_expression_type, out_value); 1874 + }
+4 -1
src/xrt/ipc/server/ipc_server_process.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 6 6 * @author Pete Black <pblack@collabora.com> 7 7 * @author Jakob Bornecrantz <jakob@collabora.com> 8 8 * @author Rylie Pavlik <rylie.pavlik@collabora.com> 9 + * @author Korcan Hussein <korcan.hussein@collabora.com> 9 10 * @ingroup ipc_server 10 11 */ 11 12 ··· 352 353 isdev->force_feedback_supported = xdev->force_feedback_supported; 353 354 isdev->form_factor_check_supported = xdev->form_factor_check_supported; 354 355 isdev->eye_gaze_supported = xdev->eye_gaze_supported; 356 + isdev->face_tracking_supported = xdev->face_tracking_supported; 355 357 isdev->stage_supported = xdev->stage_supported; 356 358 357 359 // Is this a HMD? ··· 429 431 // Assign all of the roles. 430 432 ism->roles.head = find_xdev_index(s, s->xsysd->static_roles.head); 431 433 ism->roles.eyes = find_xdev_index(s, s->xsysd->static_roles.eyes); 434 + ism->roles.face = find_xdev_index(s, s->xsysd->static_roles.face); 432 435 ism->roles.hand_tracking.left = find_xdev_index(s, s->xsysd->static_roles.hand_tracking.left); 433 436 ism->roles.hand_tracking.right = find_xdev_index(s, s->xsysd->static_roles.hand_tracking.right); 434 437
+4 -1
src/xrt/ipc/shared/ipc_protocol.h
··· 1 - // Copyright 2020, Collabora, Ltd. 1 + // Copyright 2020-2024 Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Common protocol definition. 6 6 * @author Pete Black <pblack@collabora.com> 7 7 * @author Jakob Bornecrantz <jakob@collabora.com> 8 + * @author Korcan Hussein <korcan.hussein@collabora.com> 8 9 * @ingroup ipc_shared 9 10 */ 10 11 ··· 131 132 bool position_tracking_supported; 132 133 bool hand_tracking_supported; 133 134 bool eye_gaze_supported; 135 + bool face_tracking_supported; 134 136 bool force_feedback_supported; 135 137 bool form_factor_check_supported; 136 138 bool stage_supported; ··· 227 229 { 228 230 int32_t head; 229 231 int32_t eyes; 232 + int32_t face; 230 233 231 234 struct 232 235 {
+11
src/xrt/ipc/shared/proto.json
··· 429 429 "out": [ 430 430 {"name": "available", "type": "bool"} 431 431 ] 432 + }, 433 + 434 + "device_get_face_tracking": { 435 + "in": [ 436 + {"name": "id", "type": "uint32_t"}, 437 + {"name": "facial_expression_type", "type": "enum xrt_input_name"} 438 + ], 439 + "out": [ 440 + {"name": "value", "type": "struct xrt_facial_expression_set"} 441 + ] 432 442 } 443 + 433 444 }
+3 -1
src/xrt/state_trackers/oxr/oxr_defines.h
··· 1 - // Copyright 2018-2023, Collabora, Ltd. 1 + // Copyright 2018-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Shared internal defines and enums in the state tracker. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Korcan Hussein <korcan.hussein@collabora.com> 7 8 * @ingroup oxr_main 8 9 */ 9 10 ··· 27 28 #define OXR_XR_DEBUG_HTRACKER (*(uint64_t *)"oxrhtra\0") 28 29 #define OXR_XR_DEBUG_PASSTHROUGH (*(uint64_t *)"oxrpass\0") 29 30 #define OXR_XR_DEBUG_PASSTHROUGH_LAYER (*(uint64_t *)"oxrptla\0") 31 + #define OXR_XR_DEBUG_FTRACKER (*(uint64_t *)"oxrftra\0") 30 32 // clang-format on 31 33 32 34 /*!
+3
src/xrt/state_trackers/oxr/oxr_input.c
··· 1080 1080 case XRT_INPUT_TYPE_HAND_TRACKING: 1081 1081 // shouldn't be possible to get here 1082 1082 break; 1083 + case XRT_INPUT_TYPE_FACE_TRACKING: 1084 + // shouldn't be possible to get here 1085 + break; 1083 1086 } 1084 1087 } 1085 1088
+7 -1
src/xrt/state_trackers/oxr/oxr_objects.h
··· 1 - // Copyright 2018-2023, Collabora, Ltd. 1 + // Copyright 2018-2024, Collabora, Ltd. 2 2 // Copyright 2023, NVIDIA CORPORATION. 3 3 // SPDX-License-Identifier: BSL-1.0 4 4 /*! ··· 1385 1385 // clang-format off 1386 1386 static inline struct xrt_device *get_role_head(struct oxr_system *sys) {return sys->xsysd->static_roles.head; } 1387 1387 static inline struct xrt_device *get_role_eyes(struct oxr_system *sys) {return sys->xsysd->static_roles.eyes; } 1388 + static inline struct xrt_device *get_role_face(struct oxr_system* sys) { return sys->xsysd->static_roles.face; } 1388 1389 static inline struct xrt_device *get_role_hand_tracking_left(struct oxr_system* sys) { return sys->xsysd->static_roles.hand_tracking.left; } 1389 1390 static inline struct xrt_device *get_role_hand_tracking_right(struct oxr_system* sys) { return sys->xsysd->static_roles.hand_tracking.right; } 1390 1391 // clang-format on ··· 1417 1418 } 1418 1419 static inline enum xrt_device_name 1419 1420 get_role_profile_eyes(struct oxr_system *sys) 1421 + { 1422 + return XRT_DEVICE_INVALID; 1423 + } 1424 + static inline enum xrt_device_name 1425 + get_role_profile_face(struct oxr_system *sys) 1420 1426 { 1421 1427 return XRT_DEVICE_INVALID; 1422 1428 }
+3 -1
src/xrt/state_trackers/prober/p_prober.c
··· 1 - // Copyright 2019-2022, Collabora, Ltd. 1 + // Copyright 2019-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Main prober code. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Korcan Hussein <korcan.hussein@collabora.com> 7 8 * @ingroup st_prober 8 9 */ 9 10 ··· 856 857 857 858 P(head); 858 859 P(eyes); 860 + P(face); 859 861 PD(left); 860 862 PD(right); 861 863 PD(gamepad);
+2 -1
src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
··· 1 - // Copyright 2020,2023 Collabora, Ltd. 1 + // Copyright 2020,2024 Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 681 681 case XRT_INPUT_TYPE_POSE: 682 682 //! @todo how to handle poses? 683 683 case XRT_INPUT_TYPE_HAND_TRACKING: 684 + case XRT_INPUT_TYPE_FACE_TRACKING: 684 685 case XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE: break; 685 686 } 686 687 }
+4 -1
src/xrt/targets/cli/cli_cmd_test.c
··· 1 - // Copyright 2019-2023, Collabora, Ltd. 1 + // Copyright 2019-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Prints a list of found devices and tests opening some of them. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Korcan Hussein <korcan.hussein@collabora.com> 7 8 */ 8 9 9 10 #include "xrt/xrt_space.h" ··· 131 132 } while (false) 132 133 133 134 PRINT_ROLE(head, " "); 135 + PRINT_ROLE(eyes, " "); 136 + PRINT_ROLE(face, " "); 134 137 PRINT_DYNR(left, " "); 135 138 PRINT_DYNR(right, " "); 136 139 PRINT_DYNR(gamepad, " ");