The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Make the supported fields on xrt_device be a struct

This makes it trivial for the IPC layer to correctly expose the
supported functionality and methods of the device. As I did this change
I noticed multiple fields that were not copied over in the IPC layer.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2466>

authored by

Jakob Bornecrantz and committed by
Marge Bot
bd9a43c9 be07c8d7

+159 -180
+2 -2
src/xrt/auxiliary/util/u_space_overseer.c
··· 296 296 xdev = uso->notify; 297 297 } 298 298 299 - if (xdev == NULL || !xdev->ref_space_usage_supported) { 299 + if (xdev == NULL || !xdev->supported.ref_space_usage) { 300 300 return; 301 301 } 302 302 ··· 1149 1149 xrt_space_reference(&uso->base.semantic.local, NULL); 1150 1150 xrt_space_reference(&uso->base.semantic.unbounded, NULL); 1151 1151 1152 - if (head != NULL && head->stage_supported) { 1152 + if (head != NULL && head->supported.stage) { 1153 1153 // stage poses are polled from the driver 1154 1154 u_space_overseer_create_pose_space(uso, head, XRT_INPUT_GENERIC_STAGE_SPACE_POSE, 1155 1155 &uso->base.semantic.stage);
+1 -1
src/xrt/auxiliary/util/u_system_helpers.c
··· 262 262 for (uint32_t i = 0; i < xsysd->xdev_count; i++) { 263 263 struct xrt_device *xdev = xsysd->xdevs[i]; 264 264 265 - if (xdev == NULL || !xdev->hand_tracking_supported) { 265 + if (xdev == NULL || !xdev->supported.hand_tracking) { 266 266 continue; 267 267 } 268 268
+2 -2
src/xrt/drivers/android/android_sensors.c
··· 327 327 u_var_add_ro_vec3_f32(d, &d->fusion.last.accel, "last.accel"); 328 328 u_var_add_ro_vec3_f32(d, &d->fusion.last.gyro, "last.gyro"); 329 329 330 - d->base.orientation_tracking_supported = true; 331 - d->base.position_tracking_supported = false; 330 + d->base.supported.orientation_tracking = true; 331 + d->base.supported.position_tracking = false; 332 332 333 333 // Distortion information. 334 334 u_distortion_mesh_fill_in_compute(&d->base);
+2 -2
src/xrt/drivers/arduino/arduino_device.c
··· 430 430 u_var_add_ro_vec3_f32(ad, &ad->fusion.last.accel, "last.accel"); 431 431 u_var_add_ro_vec3_f32(ad, &ad->fusion.last.gyro, "last.gyro"); 432 432 433 - ad->base.orientation_tracking_supported = true; 434 - ad->base.position_tracking_supported = false; 433 + ad->base.supported.orientation_tracking = true; 434 + ad->base.supported.position_tracking = false; 435 435 ad->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER; 436 436 437 437 ARDUINO_DEBUG(ad, "Created device!");
+2 -2
src/xrt/drivers/daydream/daydream_device.c
··· 402 402 u_var_add_ro_vec3_f32(dd, &dd->fusion.last.accel, "last.accel"); 403 403 u_var_add_ro_vec3_f32(dd, &dd->fusion.last.gyro, "last.gyro"); 404 404 405 - dd->base.orientation_tracking_supported = true; 406 - dd->base.position_tracking_supported = false; 405 + dd->base.supported.orientation_tracking = true; 406 + dd->base.supported.position_tracking = false; 407 407 dd->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER; 408 408 409 409 DAYDREAM_DEBUG(dd, "Created device!");
+2 -2
src/xrt/drivers/hdk/hdk_device.cpp
··· 489 489 u_device_dump_config(&hd->base, __func__, hd->base.str); 490 490 } 491 491 492 - hd->base.orientation_tracking_supported = true; 493 - hd->base.position_tracking_supported = false; 492 + hd->base.supported.orientation_tracking = true; 493 + hd->base.supported.position_tracking = false; 494 494 hd->base.device_type = XRT_DEVICE_TYPE_HMD; 495 495 496 496 return hd;
+3 -3
src/xrt/drivers/ht/ht_driver.c
··· 217 217 // Yes, you need all of these. Yes, I tried disabling them all one at a time. You need all of these. 218 218 htd->base.name = XRT_DEVICE_HAND_TRACKER; 219 219 htd->base.device_type = XRT_DEVICE_TYPE_HAND_TRACKER; 220 - htd->base.orientation_tracking_supported = true; 221 - htd->base.position_tracking_supported = true; 222 - htd->base.hand_tracking_supported = true; 220 + htd->base.supported.orientation_tracking = true; 221 + htd->base.supported.position_tracking = true; 222 + htd->base.supported.hand_tracking = true; 223 223 224 224 htd->sync = sync; 225 225
+3 -3
src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp
··· 443 443 cemud[i]->base.tracking_origin = hands->tracking_origin; 444 444 445 445 cemud[i]->base.name = XRT_DEVICE_SIMPLE_CONTROLLER; 446 - cemud[i]->base.hand_tracking_supported = true; 447 - cemud[i]->base.orientation_tracking_supported = true; 448 - cemud[i]->base.position_tracking_supported = true; 446 + cemud[i]->base.supported.hand_tracking = true; 447 + cemud[i]->base.supported.orientation_tracking = true; 448 + cemud[i]->base.supported.position_tracking = true; 449 449 450 450 451 451 cemud[i]->base.inputs[CEMU_INDEX_HAND_TRACKING].name =
+2 -2
src/xrt/drivers/hydra/hydra_driver.c
··· 825 825 826 826 hd->base.tracking_origin = &hs->base; 827 827 828 - hd->base.position_tracking_supported = true; 829 - hd->base.orientation_tracking_supported = true; 828 + hd->base.supported.position_tracking = true; 829 + hd->base.supported.orientation_tracking = true; 830 830 hd->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER; 831 831 832 832 out_xdevs[i] = &(hd->base);
+2 -2
src/xrt/drivers/multi_wrapper/multi.c
··· 246 246 d->base = *tracking_override_target; 247 247 248 248 // but take orientation and position tracking capabilities from tracker 249 - d->base.orientation_tracking_supported = tracking_override_tracker->orientation_tracking_supported; 250 - d->base.position_tracking_supported = tracking_override_tracker->position_tracking_supported; 249 + d->base.supported.orientation_tracking = tracking_override_tracker->supported.orientation_tracking; 250 + d->base.supported.position_tracking = tracking_override_tracker->supported.position_tracking; 251 251 252 252 // because we use the tracking data of the tracker, we use its tracking origin instead 253 253 d->base.tracking_origin = tracking_override_tracker->tracking_origin;
+3 -3
src/xrt/drivers/north_star/ns_hmd.c
··· 482 482 XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT); 483 483 // Appeases the inner workings of Monado for when there's no head tracker and we're giving a fake pose through 484 484 // the debug gui 485 - ns->base.orientation_tracking_supported = true; 486 - ns->base.position_tracking_supported = true; 485 + ns->base.supported.orientation_tracking = true; 486 + ns->base.supported.position_tracking = true; 487 487 ns->base.device_type = XRT_DEVICE_TYPE_HMD; 488 488 489 489 ··· 511 511 // Setup variable tracker. 512 512 u_var_add_root(ns, "North Star", true); 513 513 u_var_add_pose(ns, &ns->no_tracker_relation.pose, "pose"); 514 - ns->base.orientation_tracking_supported = true; 514 + ns->base.supported.orientation_tracking = true; 515 515 ns->base.device_type = XRT_DEVICE_TYPE_HMD; 516 516 517 517 size_t idx = 0;
+5 -5
src/xrt/drivers/ohmd/oh_device.c
··· 1030 1030 u_device_dump_config(&ohd->base, __func__, prod); 1031 1031 } 1032 1032 1033 - ohd->base.orientation_tracking_supported = (device_flags & OHMD_DEVICE_FLAGS_ROTATIONAL_TRACKING) != 0; 1034 - ohd->base.position_tracking_supported = (device_flags & OHMD_DEVICE_FLAGS_POSITIONAL_TRACKING) != 0; 1033 + ohd->base.supported.orientation_tracking = (device_flags & OHMD_DEVICE_FLAGS_ROTATIONAL_TRACKING) != 0; 1034 + ohd->base.supported.position_tracking = (device_flags & OHMD_DEVICE_FLAGS_POSITIONAL_TRACKING) != 0; 1035 1035 ohd->base.device_type = XRT_DEVICE_TYPE_HMD; 1036 1036 1037 1037 ··· 1157 1157 snprintf(ohd->base.str, XRT_DEVICE_NAME_LEN, "%s (OpenHMD)", prod); 1158 1158 snprintf(ohd->base.serial, XRT_DEVICE_NAME_LEN, "%s (OpenHMD)", prod); 1159 1159 1160 - ohd->base.orientation_tracking_supported = (device_flags & OHMD_DEVICE_FLAGS_ROTATIONAL_TRACKING) != 0; 1161 - ohd->base.position_tracking_supported = (device_flags & OHMD_DEVICE_FLAGS_POSITIONAL_TRACKING) != 0; 1160 + ohd->base.supported.orientation_tracking = (device_flags & OHMD_DEVICE_FLAGS_ROTATIONAL_TRACKING) != 0; 1161 + ohd->base.supported.position_tracking = (device_flags & OHMD_DEVICE_FLAGS_POSITIONAL_TRACKING) != 0; 1162 1162 ohd->base.device_type = device_type; 1163 1163 1164 1164 ohmd_device_geti(ohd->dev, OHMD_CONTROLS_HINTS, ohd->controls_fn); ··· 1271 1271 1272 1272 sys->devices[OHMD_HMD_INDEX] = hmd; 1273 1273 1274 - if (hmd->base.position_tracking_supported) { 1274 + if (hmd->base.supported.position_tracking) { 1275 1275 sys->base.type = XRT_TRACKING_TYPE_OTHER; 1276 1276 } 1277 1277
+2 -2
src/xrt/drivers/opengloves/opengloves_device.c
··· 290 290 od->base.inputs[OPENGLOVES_INPUT_INDEX_HAND_TRACKING].name = 291 291 od->hand == XRT_HAND_LEFT ? XRT_INPUT_GENERIC_HAND_TRACKING_LEFT : XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT; 292 292 293 - od->base.hand_tracking_supported = true; 294 - od->base.force_feedback_supported = true; 293 + od->base.supported.hand_tracking = true; 294 + od->base.supported.force_feedback = true; 295 295 296 296 // inputs 297 297 od->base.update_inputs = opengloves_device_update_inputs;
+2 -2
src/xrt/drivers/psmv/psmv_driver.c
··· 1225 1225 u_var_add_log_level(psmv, &psmv->log_level, "Log level"); 1226 1226 // clang-format on 1227 1227 1228 - psmv->base.orientation_tracking_supported = true; 1229 - psmv->base.position_tracking_supported = psmv->ball != NULL; 1228 + psmv->base.supported.orientation_tracking = true; 1229 + psmv->base.supported.position_tracking = psmv->ball != NULL; 1230 1230 psmv->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER; 1231 1231 1232 1232 // And finally done
+2 -2
src/xrt/drivers/pssense/pssense_driver.c
··· 895 895 pssense->base.get_tracked_pose = pssense_get_tracked_pose; 896 896 pssense->base.get_battery_status = pssense_get_battery_status; 897 897 pssense->base.destroy = pssense_device_destroy; 898 - pssense->base.orientation_tracking_supported = true; 899 - pssense->base.battery_status_supported = true; 898 + pssense->base.supported.orientation_tracking = true; 899 + pssense->base.supported.battery_status = true; 900 900 901 901 pssense->base.binding_profiles = binding_profiles_pssense; 902 902 pssense->base.binding_profile_count = ARRAY_SIZE(binding_profiles_pssense);
+2 -2
src/xrt/drivers/psvr/psvr_device.c
··· 1175 1175 psvr->base.tracking_origin = psvr->tracker->origin; 1176 1176 } 1177 1177 1178 - psvr->base.orientation_tracking_supported = true; 1179 - psvr->base.position_tracking_supported = psvr->tracker != NULL; 1178 + psvr->base.supported.orientation_tracking = true; 1179 + psvr->base.supported.position_tracking = psvr->tracker != NULL; 1180 1180 psvr->base.device_type = XRT_DEVICE_TYPE_HMD; 1181 1181 1182 1182 PSVR_DEBUG(psvr, "YES!");
+2 -2
src/xrt/drivers/realsense/rs_ddev.c
··· 498 498 return NULL; 499 499 } 500 500 501 - rs->base.orientation_tracking_supported = true; 502 - rs->base.position_tracking_supported = true; 501 + rs->base.supported.orientation_tracking = true; 502 + rs->base.supported.position_tracking = true; 503 503 rs->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER; 504 504 505 505 return &rs->base;
+2 -2
src/xrt/drivers/realsense/rs_hdev.c
··· 1007 1007 1008 1008 xd->inputs[0].name = XRT_INPUT_GENERIC_TRACKER_POSE; 1009 1009 1010 - xd->orientation_tracking_supported = true; 1011 - xd->position_tracking_supported = true; 1010 + xd->supported.orientation_tracking = true; 1011 + xd->supported.position_tracking = true; 1012 1012 1013 1013 xd->update_inputs = u_device_noop_update_inputs; 1014 1014 xd->get_tracked_pose = rs_hdev_get_tracked_pose;
+3 -3
src/xrt/drivers/remote/r_device.c
··· 217 217 rd->base.set_output = r_device_set_output; 218 218 rd->base.destroy = r_device_destroy; 219 219 rd->base.tracking_origin = &r->origin; 220 - rd->base.orientation_tracking_supported = true; 221 - rd->base.position_tracking_supported = true; 222 - rd->base.hand_tracking_supported = true; 220 + rd->base.supported.orientation_tracking = true; 221 + rd->base.supported.position_tracking = true; 222 + rd->base.supported.hand_tracking = true; 223 223 rd->base.name = XRT_DEVICE_INDEX_CONTROLLER; 224 224 rd->base.binding_profiles = vive_binding_profiles_index; 225 225 rd->base.binding_profile_count = vive_binding_profiles_index_count;
+3 -3
src/xrt/drivers/remote/r_hmd.c
··· 150 150 rh->base.set_output = r_hmd_set_output; 151 151 rh->base.destroy = r_hmd_destroy; 152 152 rh->base.tracking_origin = &r->origin; 153 - rh->base.orientation_tracking_supported = true; 154 - rh->base.position_tracking_supported = true; 155 - rh->base.hand_tracking_supported = false; 153 + rh->base.supported.orientation_tracking = true; 154 + rh->base.supported.position_tracking = true; 155 + rh->base.supported.hand_tracking = false; 156 156 rh->base.name = XRT_DEVICE_GENERIC_HMD; 157 157 rh->base.device_type = XRT_DEVICE_TYPE_HMD; 158 158 rh->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE;
+2 -2
src/xrt/drivers/rokid/rokid_hmd.c
··· 490 490 rokid->base.name = XRT_DEVICE_GENERIC_HMD; 491 491 rokid->base.device_type = XRT_DEVICE_TYPE_HMD; 492 492 rokid->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; 493 - rokid->base.orientation_tracking_supported = true; 494 - rokid->base.position_tracking_supported = false; 493 + rokid->base.supported.orientation_tracking = true; 494 + rokid->base.supported.position_tracking = false; 495 495 496 496 // Set up display details 497 497 // refresh rate
+2 -2
src/xrt/drivers/sample/sample_hmd.c
··· 201 201 hmd->base.name = XRT_DEVICE_GENERIC_HMD; 202 202 hmd->base.device_type = XRT_DEVICE_TYPE_HMD; 203 203 hmd->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; 204 - hmd->base.orientation_tracking_supported = true; 205 - hmd->base.position_tracking_supported = true; 204 + hmd->base.supported.orientation_tracking = true; 205 + hmd->base.supported.position_tracking = true; 206 206 207 207 // Set up display details 208 208 // refresh rate
+3 -3
src/xrt/drivers/simula/svr_hmd.c
··· 234 234 svr->base.name = XRT_DEVICE_GENERIC_HMD; 235 235 236 236 // Sorta a lie, we have to do this to make the state tracker happy. (Should multi.c override these?) 237 - svr->base.orientation_tracking_supported = true; 238 - svr->base.position_tracking_supported = true; 237 + svr->base.supported.orientation_tracking = true; 238 + svr->base.supported.position_tracking = true; 239 239 240 240 svr->base.device_type = XRT_DEVICE_TYPE_HMD; 241 241 ··· 271 271 272 272 // Setup variable tracker. 273 273 u_var_add_root(svr, "Simula HMD", true); 274 - svr->base.orientation_tracking_supported = true; 274 + svr->base.supported.orientation_tracking = true; 275 275 svr->base.device_type = XRT_DEVICE_TYPE_HMD; 276 276 277 277 size_t idx = 0;
+3 -3
src/xrt/drivers/simulated/simulated_controller.c
··· 383 383 sd->base.set_output = simulated_device_set_output; 384 384 sd->base.destroy = simulated_device_destroy; 385 385 sd->base.tracking_origin = origin; 386 - sd->base.orientation_tracking_supported = true; 387 - sd->base.position_tracking_supported = true; 388 - sd->base.hand_tracking_supported = false; 386 + sd->base.supported.orientation_tracking = true; 387 + sd->base.supported.position_tracking = true; 388 + sd->base.supported.hand_tracking = false; 389 389 sd->base.name = name; 390 390 sd->base.device_type = type; 391 391 sd->base.binding_profiles = binding_profiles;
+1 -1
src/xrt/drivers/simulated/simulated_hmd.c
··· 200 200 hmd->base.destroy = simulated_hmd_destroy; 201 201 hmd->base.name = XRT_DEVICE_GENERIC_HMD; 202 202 hmd->base.device_type = XRT_DEVICE_TYPE_HMD; 203 - hmd->base.ref_space_usage_supported = true; 203 + hmd->base.supported.ref_space_usage = true; 204 204 hmd->pose.orientation.w = 1.0f; // All other values set to zero. 205 205 hmd->center = *center; 206 206 hmd->created_ns = os_monotonic_get_ns();
+6 -6
src/xrt/drivers/steamvr_lh/device.cpp
··· 202 202 std::strncpy(this->serial, builder.serial, XRT_DEVICE_NAME_LEN - 1); 203 203 this->serial[XRT_DEVICE_NAME_LEN - 1] = 0; 204 204 this->tracking_origin = ctx.get(); 205 - this->orientation_tracking_supported = true; 206 - this->position_tracking_supported = true; 207 - this->hand_tracking_supported = true; 208 - this->force_feedback_supported = false; 209 - this->form_factor_check_supported = false; 210 - this->battery_status_supported = true; 205 + this->supported.orientation_tracking = true; 206 + this->supported.position_tracking = true; 207 + this->supported.hand_tracking = true; 208 + this->supported.force_feedback = false; 209 + this->supported.form_factor_check = false; 210 + this->supported.battery_status = true; 211 211 212 212 this->xrt_device::update_inputs = &device_bouncer<Device, &Device::update_inputs, xrt_result_t>; 213 213 #define SETUP_MEMBER_FUNC(name) this->xrt_device::name = &device_bouncer<Device, &Device::name>
+7 -7
src/xrt/drivers/survive/survive_driver.c
··· 987 987 survive->base.compute_distortion = compute_distortion; 988 988 survive->base.get_battery_status = survive_device_get_battery_status; 989 989 990 - survive->base.orientation_tracking_supported = true; 991 - survive->base.position_tracking_supported = true; 990 + survive->base.supported.orientation_tracking = true; 991 + survive->base.supported.position_tracking = true; 992 + survive->base.supported.battery_status = true; 992 993 survive->base.device_type = XRT_DEVICE_TYPE_HMD; 993 - survive->base.battery_status_supported = true; 994 994 995 995 survive->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; 996 996 ··· 1141 1141 survive->base.binding_profile_count = vive_binding_profiles_index_count; 1142 1142 1143 1143 survive->base.get_hand_tracking = survive_controller_get_hand_tracking; 1144 - survive->base.hand_tracking_supported = !debug_get_bool_option_survive_disable_hand_emulation(); 1144 + survive->base.supported.hand_tracking = !debug_get_bool_option_survive_disable_hand_emulation(); 1145 1145 1146 1146 } else if (survive->ctrl.config.variant == CONTROLLER_VIVE_WAND) { 1147 1147 survive->base.name = XRT_DEVICE_VIVE_WAND; ··· 1188 1188 survive->base.inputs[VIVE_TRACKER_POSE].name = XRT_INPUT_GENERIC_TRACKER_POSE; 1189 1189 } 1190 1190 1191 - survive->base.orientation_tracking_supported = true; 1192 - survive->base.position_tracking_supported = true; 1193 - survive->base.battery_status_supported = true; 1191 + survive->base.supported.orientation_tracking = true; 1192 + survive->base.supported.position_tracking = true; 1193 + survive->base.supported.battery_status = true; 1194 1194 1195 1195 survive->last_inputs = U_TYPED_ARRAY_CALLOC(struct xrt_input, survive->base.input_count); 1196 1196 survive->num_last_inputs = survive->base.input_count;
+2 -2
src/xrt/drivers/twrap/twrap_slam.c
··· 178 178 dx->base.name = name; 179 179 dx->base.tracking_origin->type = XRT_TRACKING_TYPE_OTHER; 180 180 dx->base.inputs[0].name = XRT_INPUT_GENERIC_TRACKER_POSE; 181 - dx->base.orientation_tracking_supported = true; 182 - dx->base.position_tracking_supported = true; 181 + dx->base.supported.orientation_tracking = true; 182 + dx->base.supported.position_tracking = true; 183 183 dx->base.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER; 184 184 185 185
+1 -1
src/xrt/drivers/ultraleap_v2/ulv2_driver.cpp
··· 404 404 ulv2d->base.name = XRT_DEVICE_HAND_TRACKER; 405 405 406 406 ulv2d->base.device_type = XRT_DEVICE_TYPE_HAND_TRACKER; 407 - ulv2d->base.hand_tracking_supported = true; 407 + ulv2d->base.supported.hand_tracking = true; 408 408 409 409 u_var_add_root(ulv2d, "Leap Motion v2 driver", true); 410 410 u_var_add_ro_text(ulv2d, ulv2d->base.str, "Name");
+1 -1
src/xrt/drivers/ultraleap_v5/ulv5_driver.cpp
··· 321 321 ulv5d->base.name = XRT_DEVICE_HAND_TRACKER; 322 322 323 323 ulv5d->base.device_type = XRT_DEVICE_TYPE_HAND_TRACKER; 324 - ulv5d->base.hand_tracking_supported = true; 324 + ulv5d->base.supported.hand_tracking = true; 325 325 326 326 u_var_add_root(ulv5d, "Leap Motion v5 driver", true); 327 327 u_var_add_ro_text(ulv5d, ulv5d->base.str, "Name");
+3 -3
src/xrt/drivers/vive/vive_controller.c
··· 1224 1224 } 1225 1225 1226 1226 VIVE_DEBUG(d, "Opened vive controller!\n"); 1227 - d->base.orientation_tracking_supported = true; 1228 - d->base.position_tracking_supported = false; 1229 - d->base.hand_tracking_supported = 1227 + d->base.supported.orientation_tracking = true; 1228 + d->base.supported.position_tracking = false; 1229 + d->base.supported.hand_tracking = 1230 1230 d->config.variant == CONTROLLER_INDEX_LEFT || d->config.variant == CONTROLLER_INDEX_RIGHT; 1231 1231 1232 1232 vive_controller_setup_ui(d);
+3 -3
src/xrt/drivers/vive/vive_device.c
··· 997 997 bool hand_supported = status.hand_supported; 998 998 bool hand_enabled = status.hand_enabled; 999 999 1000 - d->base.orientation_tracking_supported = dof3_enabled || slam_enabled; 1001 - d->base.position_tracking_supported = slam_enabled; 1002 - d->base.hand_tracking_supported = false; // this is handled by a separate hand device 1000 + d->base.supported.orientation_tracking = dof3_enabled || slam_enabled; 1001 + d->base.supported.position_tracking = slam_enabled; 1002 + d->base.supported.hand_tracking = false; // this is handled by a separate hand device 1003 1003 d->base.device_type = XRT_DEVICE_TYPE_HMD; 1004 1004 1005 1005 d->tracking.slam_enabled = slam_enabled;
+3 -3
src/xrt/drivers/wmr/wmr_controller_base.c
··· 548 548 549 549 wcb->base.name = XRT_DEVICE_WMR_CONTROLLER; 550 550 wcb->base.device_type = controller_type; 551 - wcb->base.orientation_tracking_supported = true; 552 - wcb->base.position_tracking_supported = false; 553 - wcb->base.hand_tracking_supported = false; 551 + wcb->base.supported.orientation_tracking = true; 552 + wcb->base.supported.position_tracking = false; 553 + wcb->base.supported.hand_tracking = false; 554 554 555 555 m_imu_3dof_init(&wcb->fusion, M_IMU_3DOF_USE_GRAVITY_DUR_20MS); 556 556
+3 -3
src/xrt/drivers/wmr/wmr_hmd.c
··· 1839 1839 #endif 1840 1840 bool hand_enabled = hand_supported && hand_wanted; 1841 1841 1842 - wh->base.orientation_tracking_supported = dof3_enabled || slam_enabled; 1843 - wh->base.position_tracking_supported = slam_enabled; 1844 - wh->base.hand_tracking_supported = false; // out_handtracker will handle it 1842 + wh->base.supported.orientation_tracking = dof3_enabled || slam_enabled; 1843 + wh->base.supported.position_tracking = slam_enabled; 1844 + wh->base.supported.hand_tracking = false; // out_handtracker will handle it 1845 1845 1846 1846 wh->tracking.slam_enabled = slam_enabled; 1847 1847 wh->tracking.hand_enabled = hand_enabled;
+2 -2
src/xrt/drivers/xreal_air/xreal_air_hmd.c
··· 1120 1120 hmd->base.name = XRT_DEVICE_GENERIC_HMD; 1121 1121 hmd->base.device_type = XRT_DEVICE_TYPE_HMD; 1122 1122 hmd->base.inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; 1123 - hmd->base.orientation_tracking_supported = true; 1124 - hmd->base.position_tracking_supported = false; 1123 + hmd->base.supported.orientation_tracking = true; 1124 + hmd->base.supported.position_tracking = false; 1125 1125 1126 1126 // Set up display details refresh rate 1127 1127 hmd->base.hmd->screens[0].nominal_frame_interval_ns = time_s_to_ns(1.0f / 60.0f);
+30 -13
src/xrt/include/xrt/xrt_device.h
··· 1 1 // Copyright 2019-2024, Collabora, Ltd. 2 + // Copyright 2024-2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 244 245 }; 245 246 246 247 /*! 248 + * Static data of supported features of the @ref xrt_device this struct sits on. 249 + * 250 + * This struct needs to always be a piece of data as it sits inside of the 251 + * shared memory area in the IPC layer, so no pointers please. 252 + * 253 + * @ingroup xrt_iface 254 + */ 255 + struct xrt_device_supported 256 + { 257 + bool orientation_tracking; 258 + bool position_tracking; 259 + bool hand_tracking; 260 + bool eye_gaze; 261 + bool force_feedback; 262 + bool ref_space_usage; 263 + bool form_factor_check; 264 + bool stage; 265 + bool face_tracking; 266 + bool body_tracking; 267 + bool battery_status; 268 + 269 + bool planes; 270 + enum xrt_plane_detection_capability_flags_ext plane_capability_flags; 271 + }; 272 + 273 + /*! 247 274 * @interface xrt_device 248 275 * 249 276 * A single HMD or input device. ··· 283 310 //! Array of output structs. 284 311 struct xrt_output *outputs; 285 312 286 - bool orientation_tracking_supported; 287 - bool position_tracking_supported; 288 - bool hand_tracking_supported; 289 - bool eye_gaze_supported; 290 - bool force_feedback_supported; 291 - bool ref_space_usage_supported; 292 - bool form_factor_check_supported; 293 - bool stage_supported; 294 - bool face_tracking_supported; 295 - bool body_tracking_supported; 296 - bool battery_status_supported; 297 - bool planes_supported; 298 - enum xrt_plane_detection_capability_flags_ext plane_capability_flags; 313 + //! What features/functions/things does this device supports? 314 + struct xrt_device_supported supported; 315 + 299 316 300 317 /* 301 318 *
+3 -11
src/xrt/ipc/client/ipc_client_device.c
··· 322 322 u_var_add_root(icd, icd->base.str, true); 323 323 u_var_add_ro_u32(icd, &icd->device_id, "device_id"); 324 324 325 - icd->base.orientation_tracking_supported = isdev->orientation_tracking_supported; 326 - icd->base.position_tracking_supported = isdev->position_tracking_supported; 327 - icd->base.hand_tracking_supported = isdev->hand_tracking_supported; 328 - icd->base.eye_gaze_supported = isdev->eye_gaze_supported; 329 - icd->base.face_tracking_supported = isdev->face_tracking_supported; 330 - icd->base.body_tracking_supported = isdev->body_tracking_supported; 331 - icd->base.force_feedback_supported = isdev->force_feedback_supported; 332 - icd->base.stage_supported = isdev->stage_supported; 333 - icd->base.planes_supported = isdev->planes_supported; 334 - icd->base.plane_capability_flags = isdev->plane_capability_flags; 325 + // Copy information. 326 + icd->base.device_type = isdev->device_type; 327 + icd->base.supported = isdev->supported; 335 328 336 - icd->base.device_type = isdev->device_type; 337 329 return &icd->base; 338 330 }
+2 -12
src/xrt/ipc/client/ipc_client_hmd.c
··· 541 541 u_var_add_root(ich, ich->base.str, true); 542 542 u_var_add_ro_u32(ich, &ich->device_id, "device_id"); 543 543 544 - ich->base.orientation_tracking_supported = isdev->orientation_tracking_supported; 545 - ich->base.position_tracking_supported = isdev->position_tracking_supported; 544 + // Copy information. 546 545 ich->base.device_type = isdev->device_type; 547 - ich->base.hand_tracking_supported = isdev->hand_tracking_supported; 548 - ich->base.eye_gaze_supported = isdev->eye_gaze_supported; 549 - ich->base.face_tracking_supported = isdev->face_tracking_supported; 550 - ich->base.body_tracking_supported = isdev->body_tracking_supported; 551 - ich->base.force_feedback_supported = isdev->force_feedback_supported; 552 - ich->base.form_factor_check_supported = isdev->form_factor_check_supported; 553 - ich->base.stage_supported = isdev->stage_supported; 554 - ich->base.battery_status_supported = isdev->battery_status_supported; 555 - ich->base.planes_supported = isdev->planes_supported; 556 - ich->base.plane_capability_flags = isdev->plane_capability_flags; 546 + ich->base.supported = isdev->supported; 557 547 558 548 return &ich->base; 559 549 }
+2 -12
src/xrt/ipc/server/ipc_server_process.c
··· 348 348 memcpy(isdev->str, xdev->str, sizeof(isdev->str)); 349 349 memcpy(isdev->serial, xdev->serial, sizeof(isdev->serial)); 350 350 351 - isdev->orientation_tracking_supported = xdev->orientation_tracking_supported; 352 - isdev->position_tracking_supported = xdev->position_tracking_supported; 351 + // Copy information. 353 352 isdev->device_type = xdev->device_type; 354 - isdev->hand_tracking_supported = xdev->hand_tracking_supported; 355 - isdev->force_feedback_supported = xdev->force_feedback_supported; 356 - isdev->form_factor_check_supported = xdev->form_factor_check_supported; 357 - isdev->eye_gaze_supported = xdev->eye_gaze_supported; 358 - isdev->face_tracking_supported = xdev->face_tracking_supported; 359 - isdev->body_tracking_supported = xdev->body_tracking_supported; 360 - isdev->stage_supported = xdev->stage_supported; 361 - isdev->battery_status_supported = xdev->battery_status_supported; 362 - isdev->planes_supported = xdev->planes_supported; 363 - isdev->plane_capability_flags = xdev->plane_capability_flags; 353 + isdev->supported = xdev->supported; 364 354 365 355 // Setup the tracking origin. 366 356 isdev->tracking_origin_index = (uint32_t)-1;
+2 -12
src/xrt/ipc/shared/ipc_protocol.h
··· 135 135 //! 'Offset' into the array of outputs where the outputs starts. 136 136 uint32_t first_output_index; 137 137 138 - bool orientation_tracking_supported; 139 - bool position_tracking_supported; 140 - bool hand_tracking_supported; 141 - bool eye_gaze_supported; 142 - bool face_tracking_supported; 143 - bool body_tracking_supported; 144 - bool force_feedback_supported; 145 - bool form_factor_check_supported; 146 - bool stage_supported; 147 - bool battery_status_supported; 148 - bool planes_supported; 149 - enum xrt_plane_detection_capability_flags_ext plane_capability_flags; 138 + //! The supported fields. 139 + struct xrt_device_supported supported; 150 140 }; 151 141 152 142 static_assert(sizeof(struct ipc_shared_device) == 564,
+4 -4
src/xrt/state_trackers/oxr/oxr_api_session.c
··· 440 440 } 441 441 442 442 // Find the correct input on the device. 443 - if (xdev != NULL && xdev->hand_tracking_supported) { 443 + if (xdev != NULL && xdev->supported.hand_tracking) { 444 444 for (uint32_t j = 0; j < xdev->input_count; j++) { 445 445 struct xrt_input *input = &xdev->inputs[j]; 446 446 ··· 826 826 827 827 //! @todo support planes on other devices 828 828 struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, head); 829 - if (!xdev->planes_supported) { 829 + if (!xdev->supported.planes) { 830 830 return XR_ERROR_FEATURE_UNSUPPORTED; 831 831 } 832 832 ··· 885 885 return oxr_error(&log, XR_ERROR_TIME_INVALID, "Time %" PRId64 " invalid", beginInfo->time); 886 886 } 887 887 888 - if (!pd->xdev->planes_supported) { 888 + if (!pd->xdev->supported.planes) { 889 889 return XR_ERROR_FEATURE_UNSUPPORTED; 890 890 } 891 891 ··· 1038 1038 return oxr_error(&log, XR_ERROR_TIME_INVALID, "Time %" PRId64 " invalid", info->time); 1039 1039 } 1040 1040 1041 - if (!pd->xdev->planes_supported) { 1041 + if (!pd->xdev->supported.planes) { 1042 1042 return XR_ERROR_FEATURE_UNSUPPORTED; 1043 1043 } 1044 1044
+3 -3
src/xrt/state_trackers/oxr/oxr_body_tracking.c
··· 57 57 } 58 58 59 59 struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, body); 60 - if (xdev == NULL || !xdev->body_tracking_supported) { 60 + if (xdev == NULL || !xdev->supported.body_tracking) { 61 61 return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED, "No device found for body tracking role"); 62 62 } 63 63 ··· 79 79 XrBodySkeletonFB *skeleton) 80 80 { 81 81 82 - if (body_tracker_fb->xdev == NULL || !body_tracker_fb->xdev->body_tracking_supported) { 82 + if (body_tracker_fb->xdev == NULL || !body_tracker_fb->xdev->supported.body_tracking) { 83 83 return oxr_error(log, XR_ERROR_FUNCTION_UNSUPPORTED, 84 84 "Device not found or does not support body tracking."); 85 85 } ··· 113 113 const XrBodyJointsLocateInfoFB *locateInfo, 114 114 XrBodyJointLocationsFB *locations) 115 115 { 116 - if (body_tracker_fb->xdev == NULL || !body_tracker_fb->xdev->body_tracking_supported) { 116 + if (body_tracker_fb->xdev == NULL || !body_tracker_fb->xdev->supported.body_tracking) { 117 117 return oxr_error(log, XR_ERROR_FUNCTION_UNSUPPORTED, 118 118 "Device not found or does not support body tracking."); 119 119 }
+1 -1
src/xrt/state_trackers/oxr/oxr_face_tracking.c
··· 64 64 return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED, "No device found for face tracking role"); 65 65 } 66 66 67 - if (!xdev->face_tracking_supported) { 67 + if (!xdev->supported.face_tracking) { 68 68 return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED, "Device does not support HTC facial tracking"); 69 69 } 70 70
+1 -1
src/xrt/state_trackers/oxr/oxr_face_tracking2_fb.c
··· 40 40 return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED, "No device found for face tracking role"); 41 41 } 42 42 43 - if (!xdev->face_tracking_supported || xdev->get_face_tracking == NULL) { 43 + if (!xdev->supported.face_tracking || xdev->get_face_tracking == NULL) { 44 44 return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED, "Device does not support FB2 face tracking"); 45 45 } 46 46
+12 -12
src/xrt/state_trackers/oxr/oxr_system.c
··· 70 70 } 71 71 72 72 struct xrt_device *xdev = GET_XDEV_BY_ROLE(selected, head); 73 - if (xdev->form_factor_check_supported && 73 + if (xdev->supported.form_factor_check && 74 74 !xrt_device_is_form_factor_available(xdev, convert_form_factor(form_factor))) { 75 75 return oxr_error(log, XR_ERROR_FORM_FACTOR_UNAVAILABLE, "request form factor %i is unavailable now", 76 76 form_factor); ··· 259 259 struct xrt_device *ht_left = GET_XDEV_BY_ROLE(sys, hand_tracking_left); 260 260 struct xrt_device *ht_right = GET_XDEV_BY_ROLE(sys, hand_tracking_right); 261 261 262 - bool left_supported = ht_left && ht_left->hand_tracking_supported; 263 - bool right_supported = ht_right && ht_right->hand_tracking_supported; 262 + bool left_supported = ht_left && ht_left->supported.hand_tracking; 263 + bool right_supported = ht_right && ht_right->supported.hand_tracking; 264 264 265 265 return left_supported || right_supported; 266 266 } ··· 271 271 struct oxr_system *sys = &inst->system; 272 272 struct xrt_device *eyes = GET_XDEV_BY_ROLE(sys, eyes); 273 273 274 - return eyes && eyes->eye_gaze_supported; 274 + return eyes && eyes->supported.eye_gaze; 275 275 } 276 276 277 277 bool ··· 281 281 struct xrt_device *ffb_left = GET_XDEV_BY_ROLE(sys, hand_tracking_left); 282 282 struct xrt_device *ffb_right = GET_XDEV_BY_ROLE(sys, hand_tracking_right); 283 283 284 - bool left_supported = ffb_left && ffb_left->force_feedback_supported; 285 - bool right_supported = ffb_right && ffb_right->force_feedback_supported; 284 + bool left_supported = ffb_left && ffb_left->supported.force_feedback; 285 + bool right_supported = ffb_right && ffb_right->supported.force_feedback; 286 286 287 287 return left_supported || right_supported; 288 288 } ··· 301 301 if (supports_lip) 302 302 *supports_lip = false; 303 303 304 - if (face_xdev == NULL || !face_xdev->face_tracking_supported || face_xdev->inputs == NULL) { 304 + if (face_xdev == NULL || !face_xdev->supported.face_tracking || face_xdev->inputs == NULL) { 305 305 return; 306 306 } 307 307 ··· 331 331 struct oxr_system *sys = &inst->system; 332 332 struct xrt_device *face_xdev = GET_XDEV_BY_ROLE(sys, face); 333 333 334 - if (face_xdev == NULL || !face_xdev->face_tracking_supported || face_xdev->inputs == NULL) { 334 + if (face_xdev == NULL || !face_xdev->supported.face_tracking || face_xdev->inputs == NULL) { 335 335 return; 336 336 } 337 337 ··· 353 353 { 354 354 struct oxr_system *sys = &inst->system; 355 355 const struct xrt_device *body = GET_XDEV_BY_ROLE(sys, body); 356 - if (body == NULL || !body->body_tracking_supported || body->inputs == NULL) { 356 + if (body == NULL || !body->supported.body_tracking || body->inputs == NULL) { 357 357 return false; 358 358 } 359 359 ··· 392 392 } 393 393 properties->graphicsProperties.maxSwapchainImageWidth = 1024 * 16; 394 394 properties->graphicsProperties.maxSwapchainImageHeight = 1024 * 16; 395 - properties->trackingProperties.orientationTracking = xdev->orientation_tracking_supported; 396 - properties->trackingProperties.positionTracking = xdev->position_tracking_supported; 395 + properties->trackingProperties.orientationTracking = xdev->supported.orientation_tracking; 396 + properties->trackingProperties.positionTracking = xdev->supported.position_tracking; 397 397 398 398 #ifdef OXR_HAVE_EXT_hand_tracking 399 399 XrSystemHandTrackingPropertiesEXT *hand_tracking_props = NULL; ··· 518 518 if (plane_detection_props) { 519 519 // for now these are mapped 1:1 520 520 plane_detection_props->supportedFeatures = 521 - (XrPlaneDetectionCapabilityFlagsEXT)xdev->plane_capability_flags; 521 + (XrPlaneDetectionCapabilityFlagsEXT)xdev->supported.plane_capability_flags; 522 522 } 523 523 #endif // OXR_HAVE_EXT_plane_detection 524 524
+5 -5
src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
··· 562 562 563 563 AddControl("/input/trackpad/y", XRT_INPUT_INDEX_TRACKPAD, &y); 564 564 565 - if (m_xdev->hand_tracking_supported) { 565 + if (m_xdev->supported.hand_tracking) { 566 566 ovrd_log("Enabling skeletal input as this device supports it"); 567 567 568 568 // skeletal input compatibility with games is a bit funky with any controllers ··· 763 763 m_pose.poseIsValid = false; 764 764 m_pose.deviceIsConnected = true; 765 765 m_pose.result = vr::TrackingResult_Uninitialized; 766 - m_pose.willDriftInYaw = !m_xdev->position_tracking_supported; 766 + m_pose.willDriftInYaw = !m_xdev->supported.position_tracking; 767 767 768 768 if (m_emulate_index_controller) { 769 769 m_input_profile = std::string("{indexcontroller}/input/index_controller_profile.json"); ··· 965 965 } 966 966 } 967 967 968 - if (m_xdev->hand_tracking_supported && m_skeletal_input_control.control_handle) { 968 + if (m_xdev->supported.hand_tracking && m_skeletal_input_control.control_handle) { 969 969 vr::VRBoneTransform_t bone_transforms[OPENVR_BONE_COUNT]; 970 970 971 971 timepoint_ns now_ns = os_monotonic_get_ns(); ··· 1295 1295 1296 1296 .result = vr::TrackingResult_Running_OK, 1297 1297 .poseIsValid = (rel.relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) != 0, 1298 - .willDriftInYaw = !m_xdev->position_tracking_supported, 1298 + .willDriftInYaw = !m_xdev->supported.position_tracking, 1299 1299 //! @todo: Monado head model? 1300 - .shouldApplyHeadModel = !m_xdev->position_tracking_supported, 1300 + .shouldApplyHeadModel = !m_xdev->supported.position_tracking, 1301 1301 .deviceIsConnected = true, 1302 1302 }; 1303 1303 apply_pose(&rel, &t);
+2 -2
src/xrt/targets/common/target_builder_simulated.c
··· 113 113 114 114 // Make the objects be tracked in space. 115 115 //! @todo Make these be a option to the hmd create function, or just make it be there from the start. 116 - head->orientation_tracking_supported = true; 117 - head->position_tracking_supported = true; 116 + head->supported.orientation_tracking = true; 117 + head->supported.position_tracking = true; 118 118 //! @todo Create a shared tracking origin on the system devices struct instead. 119 119 head->tracking_origin->type = XRT_TRACKING_TYPE_OTHER; // Just anything other then none. 120 120
+3 -3
src/xrt/targets/libmonado/monado.c
··· 309 309 const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index]; 310 310 311 311 switch (prop) { 312 - case MND_PROPERTY_SUPPORTS_POSITION_BOOL: *out_bool = shared_device->position_tracking_supported; break; 313 - case MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL: *out_bool = shared_device->orientation_tracking_supported; break; 312 + case MND_PROPERTY_SUPPORTS_POSITION_BOOL: *out_bool = shared_device->supported.position_tracking; break; 313 + case MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL: *out_bool = shared_device->supported.orientation_tracking; break; 314 314 default: PE("Is not a valid boolean property (%u)", prop); return MND_ERROR_INVALID_PROPERTY; 315 315 } 316 316 ··· 574 574 575 575 const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index]; 576 576 577 - if (!shared_device->battery_status_supported) { 577 + if (!shared_device->supported.battery_status) { 578 578 return MND_ERROR_OPERATION_FAILED; 579 579 } 580 580