The open source OpenXR runtime
0
fork

Configure Feed

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

t/common: Refactor Rift-S builder [NFC]

+32 -19
+32 -19
src/xrt/targets/common/target_builder_rift_s.c
··· 98 98 DRV_TRACE_MARKER(); 99 99 100 100 rift_s_log_level = debug_get_log_option_rift_s_log(); 101 - struct u_system_devices *usysd = u_system_devices_allocate(); 101 + struct xrt_system_devices *xsysd = NULL; 102 + { 103 + struct u_system_devices *usysd = u_system_devices_allocate(); 104 + xsysd = &usysd->base; 105 + } 102 106 103 107 xret = xrt_prober_lock_list(xp, &xpdevs, &xpdev_count); 104 108 if (xret != XRT_SUCCESS) { ··· 154 158 goto fail; 155 159 } 156 160 161 + 162 + // Create and add to list. 157 163 struct xrt_device *hmd_xdev = rift_s_system_get_hmd(sys); 158 - usysd->base.xdevs[usysd->base.xdev_count++] = hmd_xdev; 159 - usysd->base.roles.head = hmd_xdev; 164 + xsysd->xdevs[xsysd->xdev_count++] = hmd_xdev; 160 165 161 - struct xrt_device *xdev = rift_s_system_get_controller(sys, 0); 162 - usysd->base.xdevs[usysd->base.xdev_count++] = xdev; 163 - usysd->base.roles.left = xdev; 166 + struct xrt_device *left_xdev = rift_s_system_get_controller(sys, 0); 167 + xsysd->xdevs[xsysd->xdev_count++] = left_xdev; 164 168 165 - xdev = rift_s_system_get_controller(sys, 1); 166 - usysd->base.xdevs[usysd->base.xdev_count++] = xdev; 167 - usysd->base.roles.right = xdev; 169 + struct xrt_device *right_xdev = rift_s_system_get_controller(sys, 1); 170 + xsysd->xdevs[xsysd->xdev_count++] = right_xdev; 171 + 168 172 169 173 #ifdef XRT_BUILD_DRIVER_HANDTRACKING 170 174 struct xrt_device *ht_xdev = rift_s_system_get_hand_tracking_device(sys); ··· 175 179 struct xrt_device *two_hands[2]; 176 180 cemu_devices_create(hmd_xdev, ht_xdev, two_hands); 177 181 178 - usysd->base.roles.hand_tracking.left = two_hands[0]; 179 - usysd->base.roles.hand_tracking.right = two_hands[1]; 182 + xsysd->roles.hand_tracking.left = two_hands[0]; 183 + xsysd->roles.hand_tracking.right = two_hands[1]; 180 184 181 - usysd->base.xdevs[usysd->base.xdev_count++] = two_hands[0]; 182 - usysd->base.xdevs[usysd->base.xdev_count++] = two_hands[1]; 185 + xsysd->xdevs[xsysd->xdev_count++] = two_hands[0]; 186 + xsysd->xdevs[xsysd->xdev_count++] = two_hands[1]; 183 187 184 188 if (debug_get_bool_option_rift_s_hand_tracking_as_controller()) { 185 - usysd->base.roles.left = two_hands[0]; 186 - usysd->base.roles.right = two_hands[1]; 189 + left_xdev = two_hands[0]; 190 + right_xdev = two_hands[1]; 187 191 } 188 192 } 189 193 #endif 190 194 191 - *out_xsysd = &usysd->base; 192 - u_builder_create_space_overseer(&usysd->base, out_xso); 195 + // Assign to role(s). 196 + xsysd->roles.head = hmd_xdev; 197 + xsysd->roles.left = left_xdev; 198 + xsysd->roles.right = right_xdev; 199 + 193 200 194 - return XRT_SUCCESS; 201 + /* 202 + * Done. 203 + */ 204 + 205 + *out_xsysd = xsysd; 206 + u_builder_create_space_overseer(xsysd, out_xso); 207 + 195 208 196 209 unlock_and_fail: 197 210 xret = xrt_prober_unlock_list(xp, &xpdevs); ··· 201 214 202 215 /* Fallthrough */ 203 216 fail: 204 - u_system_devices_destroy(&usysd); 217 + xrt_system_devices_destroy(&xsysd); 205 218 return XRT_ERROR_DEVICE_CREATION_FAILED; 206 219 } 207 220