The open source OpenXR runtime

xrt: Also create a space overseer when creating system devices

+177 -62
+5 -3
src/xrt/auxiliary/util/u_system_helpers.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 54 54 } 55 55 56 56 xrt_result_t 57 - u_system_devices_create_from_prober(struct xrt_instance *xinst, struct xrt_system_devices **out_xsysd) 57 + u_system_devices_create_from_prober(struct xrt_instance *xinst, 58 + struct xrt_system_devices **out_xsysd, 59 + struct xrt_space_overseer **out_xso) 58 60 { 59 61 xrt_result_t xret; 60 62 ··· 77 79 return xret; 78 80 } 79 81 80 - return xrt_prober_create_system(xp, out_xsysd); 82 + return xrt_prober_create_system(xp, out_xsysd, out_xso); 81 83 } 82 84 83 85 struct xrt_device *
+4 -2
src/xrt/auxiliary/util/u_system_helpers.h
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 68 68 * @ingroup aux_util 69 69 */ 70 70 xrt_result_t 71 - u_system_devices_create_from_prober(struct xrt_instance *xinst, struct xrt_system_devices **out_xsysd); 71 + u_system_devices_create_from_prober(struct xrt_instance *xinst, 72 + struct xrt_system_devices **out_xsysd, 73 + struct xrt_space_overseer **out_xso); 72 74 73 75 /*! 74 76 * Helper function.
+5 -2
src/xrt/include/xrt/xrt_instance.h
··· 1 - // Copyright 2020-2022, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 20 20 21 21 struct xrt_prober; 22 22 struct xrt_device; 23 + struct xrt_space_overseer; 23 24 struct xrt_system_devices; 24 25 struct xrt_system_compositor; 25 26 ··· 83 84 */ 84 85 xrt_result_t (*create_system)(struct xrt_instance *xinst, 85 86 struct xrt_system_devices **out_xsysd, 87 + struct xrt_space_overseer **out_xso, 86 88 struct xrt_system_compositor **out_xsysc); 87 89 88 90 /*! ··· 134 136 static inline xrt_result_t 135 137 xrt_instance_create_system(struct xrt_instance *xinst, 136 138 struct xrt_system_devices **out_xsysd, 139 + struct xrt_space_overseer **out_xso, 137 140 struct xrt_system_compositor **out_xsysc) 138 141 { 139 - return xinst->create_system(xinst, out_xsysd, out_xsysc); 142 + return xinst->create_system(xinst, out_xsysd, out_xso, out_xsysc); 140 143 } 141 144 142 145 /*!
+16 -7
src/xrt/include/xrt/xrt_prober.h
··· 1 - // Copyright 2019-2022, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 35 35 struct xrt_tracking_factory; 36 36 struct xrt_builder; 37 37 struct xrt_system_devices; 38 + struct xrt_space_overseer; 38 39 struct os_hid_device; 39 40 40 41 /*! ··· 182 183 * 183 184 * @param[in] xp Prober self parameter. 184 185 * @param[out] out_xsysd Return of system devices, the pointed pointer must be NULL. 186 + * @param[out] out_xso Return of the @ref xrt_space_overseer, the pointed pointer must be NULL. 185 187 * 186 188 * @note Code consuming this interface should use xrt_prober_create_system() 187 189 */ 188 - xrt_result_t (*create_system)(struct xrt_prober *xp, struct xrt_system_devices **out_xsysd); 190 + xrt_result_t (*create_system)(struct xrt_prober *xp, 191 + struct xrt_system_devices **out_xsysd, 192 + struct xrt_space_overseer **out_xso); 189 193 190 194 /*! 191 195 * Iterate through drivers (by ID and auto-probers) checking to see if ··· 365 369 * @public @memberof xrt_prober 366 370 */ 367 371 static inline xrt_result_t 368 - xrt_prober_create_system(struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 372 + xrt_prober_create_system(struct xrt_prober *xp, 373 + struct xrt_system_devices **out_xsysd, 374 + struct xrt_space_overseer **out_xso) 369 375 { 370 - return xp->create_system(xp, out_xsysd); 376 + return xp->create_system(xp, out_xsysd, out_xso); 371 377 } 372 378 373 379 /*! ··· 578 584 * @param[in] xp Prober 579 585 * @param[in] config JSON config object if found for this setter upper. 580 586 * @param[out] out_xsysd Return of system devices, the pointed pointer must be NULL. 587 + * @param[out] out_xso Return of the @ref xrt_space_overseer, the pointed pointer must be NULL. 581 588 * 582 589 * @note Code consuming this interface should use xrt_builder_open_system() 583 590 */ 584 591 xrt_result_t (*open_system)(struct xrt_builder *xb, 585 592 cJSON *config, 586 593 struct xrt_prober *xp, 587 - struct xrt_system_devices **out_xsysd); 594 + struct xrt_system_devices **out_xsysd, 595 + struct xrt_space_overseer **out_xso); 588 596 589 597 /*! 590 598 * Destroy this setter upper. ··· 621 629 xrt_builder_open_system(struct xrt_builder *xb, 622 630 cJSON *config, 623 631 struct xrt_prober *xp, 624 - struct xrt_system_devices **out_xsysd) 632 + struct xrt_system_devices **out_xsysd, 633 + struct xrt_space_overseer **out_xso) 625 634 { 626 - return xb->open_system(xb, config, xp, out_xsysd); 635 + return xb->open_system(xb, config, xp, out_xsysd, out_xso); 627 636 } 628 637 629 638 /*!
+6 -2
src/xrt/include/xrt/xrt_space.h
··· 120 120 struct xrt_space **out_space); 121 121 122 122 /*! 123 - * Create a space that wraps a device input pose, implicitly make the 124 - * device's tracking space the returned space parent. 123 + * Create a space that wraps the @p xdev input pose described by input 124 + * @p name, implicitly make the device's tracking space the parent of 125 + * the created space. The name pose_space was chosen because while most 126 + * input poses are part of the device, they may also be things tracked 127 + * by the device. The important part is that the space is following the 128 + * pose, that it happens to be attached to device is coincidental. 125 129 * 126 130 * @param[in] xso Owning space overseer. 127 131 * @param[in] xdev Device to get the pose from.
+6 -1
src/xrt/ipc/client/ipc_client_instance.c
··· 1 - // Copyright 2020, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 25 25 26 26 #include "shared/ipc_protocol.h" 27 27 #include "client/ipc_client.h" 28 + 28 29 #include "ipc_client_generated.h" 30 + 29 31 30 32 #include <stdio.h> 31 33 #if !defined(XRT_OS_WINDOWS) ··· 314 316 static xrt_result_t 315 317 ipc_client_instance_create_system(struct xrt_instance *xinst, 316 318 struct xrt_system_devices **out_xsysd, 319 + struct xrt_space_overseer **out_xso, 317 320 struct xrt_system_compositor **out_xsysc) 318 321 { 319 322 struct ipc_client_instance *ii = ipc_client_instance(xinst); ··· 349 352 // Done here now. 350 353 if (out_xsysc == NULL) { 351 354 *out_xsysd = &usysd->base; 355 + *out_xso = ipc_client_space_overseer_create(&ii->ipc_c); 352 356 return XRT_SUCCESS; 353 357 } 354 358 ··· 366 370 } 367 371 368 372 *out_xsysd = &usysd->base; 373 + *out_xso = ipc_client_space_overseer_create(&ii->ipc_c); 369 374 *out_xsysc = xsysc; 370 375 371 376 return XRT_SUCCESS;
+3 -2
src/xrt/ipc/server/ipc_server_process.c
··· 1 - // Copyright 2020-2021, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 131 131 132 132 teardown_idevs(s); 133 133 134 + xrt_space_overseer_destroy(&s->xso); 134 135 xrt_system_devices_destroy(&s->xsysd); 135 136 136 137 xrt_instance_destroy(&s->xinst); ··· 468 469 return -1; 469 470 } 470 471 471 - xret = xrt_instance_create_system(s->xinst, &s->xsysd, &s->xsysc); 472 + xret = xrt_instance_create_system(s->xinst, &s->xsysd, &s->xso, &s->xsysc); 472 473 if (xret != XRT_SUCCESS) { 473 474 IPC_ERROR(s, "Could not create system!"); 474 475 teardown_all(s);
+1
src/xrt/state_trackers/gui/gui_common.h
··· 47 47 struct gui_scene_manager *gsm; 48 48 49 49 struct xrt_system_devices *xsysd; 50 + struct xrt_space_overseer *xso; 50 51 struct xrt_instance *instance; 51 52 struct xrt_prober *xp; 52 53
+7 -3
src/xrt/state_trackers/gui/gui_prober.c
··· 1 - // Copyright 2019-2022, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 7 */ 8 8 9 + #include "xrt/xrt_space.h" 9 10 #include "xrt/xrt_prober.h" 11 + #include "xrt/xrt_system.h" 10 12 #include "xrt/xrt_instance.h" 11 - #include "xrt/xrt_system.h" 13 + 12 14 #include "util/u_time.h" 15 + 13 16 #include "gui_common.h" 14 17 15 18 ··· 64 67 int 65 68 gui_prober_select(struct gui_program *p) 66 69 { 67 - xrt_result_t xret = xrt_instance_create_system(p->instance, &p->xsysd, NULL); 70 + xrt_result_t xret = xrt_instance_create_system(p->instance, &p->xsysd, &p->xso, NULL); 68 71 if (xret != XRT_SUCCESS) { 69 72 return -1; 70 73 } ··· 90 93 void 91 94 gui_prober_teardown(struct gui_program *p) 92 95 { 96 + xrt_space_overseer_destroy(&p->xso); 93 97 xrt_system_devices_destroy(&p->xsysd); 94 98 95 99 xrt_instance_destroy(&p->instance);
+4 -3
src/xrt/state_trackers/oxr/oxr_instance.c
··· 1 - // Copyright 2018-2022, Collabora, Ltd. 1 + // Copyright 2018-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 70 70 u_hashset_destroy(&inst->action_sets.name_store); 71 71 u_hashset_destroy(&inst->action_sets.loc_store); 72 72 73 + xrt_space_overseer_destroy(&inst->system.xso); 73 74 xrt_system_devices_destroy(&inst->system.xsysd); 74 75 75 76 #ifdef XRT_FEATURE_CLIENT_DEBUG_GUI ··· 267 268 268 269 // Create the compositor if we are not headless. 269 270 if (!inst->extensions.MND_headless) { 270 - xret = xrt_instance_create_system(inst->xinst, &sys->xsysd, &sys->xsysc); 271 + xret = xrt_instance_create_system(inst->xinst, &sys->xsysd, &sys->xso, &sys->xsysc); 271 272 } else { 272 - xret = xrt_instance_create_system(inst->xinst, &sys->xsysd, NULL); 273 + xret = xrt_instance_create_system(inst->xinst, &sys->xsysd, &sys->xso, NULL); 273 274 } 274 275 275 276 if (xret != XRT_SUCCESS) {
+4
src/xrt/state_trackers/oxr/oxr_objects.h
··· 9 9 10 10 #pragma once 11 11 12 + #include "xrt/xrt_space.h" 12 13 #include "xrt/xrt_limits.h" 13 14 #include "xrt/xrt_system.h" 14 15 #include "xrt/xrt_device.h" ··· 1295 1296 1296 1297 //! System devices used in all session types. 1297 1298 struct xrt_system_devices *xsysd; 1299 + 1300 + //! Space overseer used in all session types. 1301 + struct xrt_space_overseer *xso; 1298 1302 1299 1303 //! System compositor, used to create session compositors. 1300 1304 struct xrt_system_compositor *xsysc;
+3 -3
src/xrt/state_trackers/prober/p_prober.c
··· 89 89 p_dump(struct xrt_prober *xp); 90 90 91 91 static xrt_result_t 92 - p_create_system(struct xrt_prober *xp, struct xrt_system_devices **out_xsysd); 92 + p_create_system(struct xrt_prober *xp, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso); 93 93 94 94 static int 95 95 p_select_device(struct xrt_prober *xp, struct xrt_device **xdevs, size_t xdev_count); ··· 964 964 } 965 965 966 966 static xrt_result_t 967 - p_create_system(struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 967 + p_create_system(struct xrt_prober *xp, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso) 968 968 { 969 969 XRT_TRACE_MARKER(); 970 970 ··· 1062 1062 1063 1063 if (select != NULL) { 1064 1064 u_pp(dg, "\n\tUsing builder %s: %s", select->identifier, select->name); 1065 - xret = xrt_builder_open_system(select, p->json.root, xp, out_xsysd); 1065 + xret = xrt_builder_open_system(select, p->json.root, xp, out_xsysd, out_xso); 1066 1066 1067 1067 if (xret == XRT_SUCCESS) { 1068 1068 print_system_devices(dg, *out_xsysd);
+6 -1
src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
··· 29 29 #include "util/u_builders.h" 30 30 #include "util/u_hand_tracking.h" 31 31 32 + #include "xrt/xrt_space.h" 32 33 #include "xrt/xrt_system.h" 33 34 #include "xrt/xrt_defines.h" 34 35 #include "xrt/xrt_device.h" ··· 1433 1434 private: 1434 1435 struct xrt_instance *m_xinst = NULL; 1435 1436 struct xrt_system_devices *m_xsysd = NULL; 1437 + struct xrt_space_overseer *m_xso = NULL; 1436 1438 struct xrt_device *m_xhmd = NULL; 1437 1439 1438 1440 CDeviceDriver_Monado *m_MonadoDeviceDriver = NULL; ··· 1462 1464 return vr::VRInitError_Init_HmdNotFound; 1463 1465 } 1464 1466 1465 - xret = xrt_instance_create_system(m_xinst, &m_xsysd, NULL); 1467 + xret = xrt_instance_create_system(m_xinst, &m_xsysd, &m_xso, NULL); 1466 1468 if (xret < 0) { 1467 1469 ovrd_log("Failed to create system devices\n"); 1468 1470 xrt_instance_destroy(&m_xinst); ··· 1470 1472 } 1471 1473 if (m_xsysd->roles.head == NULL) { 1472 1474 ovrd_log("Didn't get a HMD device!\n"); 1475 + xrt_space_overseer_destroy(&m_xso); 1476 + xrt_system_devices_destroy(&m_xsysd); 1473 1477 xrt_instance_destroy(&m_xinst); 1474 1478 return vr::VRInitError_Init_HmdNotFound; 1475 1479 } ··· 1508 1512 m_MonadoDeviceDriver = NULL; 1509 1513 } 1510 1514 1515 + xrt_space_overseer_destroy(&m_xso); 1511 1516 xrt_system_devices_destroy(&m_xsysd); 1512 1517 m_xhmd = NULL; 1513 1518 m_left->m_xdev = NULL;
+10 -6
src/xrt/targets/cli/cli_cmd_probe.c
··· 1 - // Copyright 2019, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 7 */ 8 8 9 - #include <string.h> 10 - #include <stdio.h> 11 - 12 - #include "xrt/xrt_instance.h" 9 + #include "xrt/xrt_space.h" 13 10 #include "xrt/xrt_system.h" 14 11 #include "xrt/xrt_device.h" 15 12 #include "xrt/xrt_prober.h" 13 + #include "xrt/xrt_instance.h" 14 + #include "xrt/xrt_config_drivers.h" 15 + 16 16 #include "cli_common.h" 17 17 18 - #include "xrt/xrt_config_drivers.h" 18 + #include <string.h> 19 + #include <stdio.h> 19 20 20 21 static int 21 22 do_exit(struct xrt_instance **xi_ptr, int ret) ··· 48 49 printf(" :: Creating system devices!\n"); 49 50 50 51 struct xrt_system_devices *xsysd = NULL; 52 + struct xrt_space_overseer *xso = NULL; 51 53 xret = xrt_instance_create_system( // 52 54 xi, // Instance 53 55 &xsysd, // System devices. 56 + &xso, // Space overseer. 54 57 NULL); // System compositor. 55 58 if (xret != XRT_SUCCESS) { 56 59 printf("\tCall to xrt_instance_create_system failed! '%i'\n", xret); ··· 114 117 115 118 printf(" :: Destroying probed devices\n"); 116 119 120 + xrt_space_overseer_destroy(&xso); 117 121 xrt_system_devices_destroy(&xsysd); 118 122 119 123 // End of program
+10 -5
src/xrt/targets/cli/cli_cmd_test.c
··· 1 - // Copyright 2019, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 7 */ 8 8 9 - #include <string.h> 10 - #include <stdio.h> 11 - 12 - #include "xrt/xrt_instance.h" 9 + #include "xrt/xrt_space.h" 13 10 #include "xrt/xrt_system.h" 14 11 #include "xrt/xrt_prober.h" 12 + #include "xrt/xrt_instance.h" 13 + 15 14 #include "cli_common.h" 15 + 16 + #include <string.h> 17 + #include <stdio.h> 16 18 17 19 18 20 static int ··· 74 76 printf(" :: Creating system devices!\n"); 75 77 76 78 struct xrt_system_devices *xsysd = NULL; 79 + struct xrt_space_overseer *xso = NULL; 77 80 xret = xrt_instance_create_system( // 78 81 xi, // Instance 79 82 &xsysd, // System devices. 83 + &xso, // Space Overseer. 80 84 NULL); // System compositor. 81 85 if (xret != XRT_SUCCESS) { 82 86 printf("\tCall to xrt_instance_create_system failed! '%i'\n", xret); ··· 123 127 // End of program 124 128 printf(" :: All ok, shutting down.\n"); 125 129 130 + xrt_space_overseer_destroy(&xso); 126 131 xrt_system_devices_destroy(&xsysd); 127 132 128 133 // Finally done
+8 -2
src/xrt/targets/common/target_builder_legacy.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 12 12 13 13 #include "util/u_misc.h" 14 14 #include "util/u_device.h" 15 + #include "util/u_builders.h" 15 16 #include "util/u_system_helpers.h" 16 17 17 18 #include "target_builder_interface.h" ··· 106 107 } 107 108 108 109 static xrt_result_t 109 - legacy_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 110 + legacy_open_system(struct xrt_builder *xb, 111 + cJSON *config, 112 + struct xrt_prober *xp, 113 + struct xrt_system_devices **out_xsysd, 114 + struct xrt_space_overseer **out_xso) 110 115 { 111 116 struct u_system_devices *usysd = u_system_devices_allocate(); 112 117 xrt_result_t xret; ··· 169 174 */ 170 175 171 176 *out_xsysd = &usysd->base; 177 + u_builder_create_space_overseer(&usysd->base, out_xso); 172 178 173 179 return XRT_SUCCESS; 174 180 }
+4 -2
src/xrt/targets/common/target_builder_lighthouse.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 524 524 lighthouse_open_system(struct xrt_builder *xb, 525 525 cJSON *config, 526 526 struct xrt_prober *xp, 527 - struct xrt_system_devices **out_xsysd) 527 + struct xrt_system_devices **out_xsysd, 528 + struct xrt_space_overseer **out_xso) 528 529 { 529 530 struct lighthouse_system *lhs = (struct lighthouse_system *)xb; 530 531 lhs->devices = u_system_devices_allocate(); ··· 703 704 704 705 if (result == XRT_SUCCESS) { 705 706 *out_xsysd = &usysd->base; 707 + u_builder_create_space_overseer(&usysd->base, out_xso); 706 708 } else { 707 709 u_system_devices_destroy(&usysd); 708 710 }
+7 -2
src/xrt/targets/common/target_builder_north_star.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 408 408 409 409 410 410 static xrt_result_t 411 - ns_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 411 + ns_open_system(struct xrt_builder *xb, 412 + cJSON *config, 413 + struct xrt_prober *xp, 414 + struct xrt_system_devices **out_xsysd, 415 + struct xrt_space_overseer **out_xso) 412 416 { 413 417 struct ns_builder *nsb = (struct ns_builder *)xb; 414 418 ··· 547 551 end: 548 552 if (result == XRT_SUCCESS) { 549 553 *out_xsysd = &usysd->base; 554 + u_builder_create_space_overseer(&usysd->base, out_xso); 550 555 } else { 551 556 u_system_devices_destroy(&usysd); 552 557 }
+16 -3
src/xrt/targets/common/target_builder_remote.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 71 71 } 72 72 73 73 static xrt_result_t 74 - remote_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 74 + remote_open_system(struct xrt_builder *xb, 75 + cJSON *config, 76 + struct xrt_prober *xp, 77 + struct xrt_system_devices **out_xsysd, 78 + struct xrt_space_overseer **out_xso) 75 79 { 76 80 assert(out_xsysd != NULL); 77 81 assert(*out_xsysd == NULL); ··· 82 86 port = 4242; 83 87 } 84 88 85 - return r_create_devices(port, out_xsysd); 89 + struct xrt_system_devices *xsysd = NULL; 90 + xrt_result_t xret = r_create_devices(port, &xsysd); 91 + if (xret != XRT_SUCCESS) { 92 + return xret; 93 + } 94 + 95 + *out_xsysd = xsysd; 96 + u_builder_create_space_overseer(xsysd, out_xso); 97 + 98 + return xret; 86 99 } 87 100 88 101 static void
+7 -2
src/xrt/targets/common/target_builder_rgb_tracking.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 274 274 } 275 275 276 276 static xrt_result_t 277 - rgb_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 277 + rgb_open_system(struct xrt_builder *xb, 278 + cJSON *config, 279 + struct xrt_prober *xp, 280 + struct xrt_system_devices **out_xsysd, 281 + struct xrt_space_overseer **out_xso) 278 282 { 279 283 struct u_builder_search_results results = {0}; 280 284 struct xrt_prober_device **xpdevs = NULL; ··· 401 405 */ 402 406 403 407 *out_xsysd = &usysd->base; 408 + u_builder_create_space_overseer(&usysd->base, out_xso); 404 409 405 410 return XRT_SUCCESS; 406 411 }
+7 -2
src/xrt/targets/common/target_builder_rift_s.c
··· 1 - // Copyright 2019, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // Copyright 2022, Jan Schmidt 3 3 // SPDX-License-Identifier: BSL-1.0 4 4 /*! ··· 82 82 } 83 83 84 84 static xrt_result_t 85 - rift_s_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 85 + rift_s_open_system(struct xrt_builder *xb, 86 + cJSON *config, 87 + struct xrt_prober *xp, 88 + struct xrt_system_devices **out_xsysd, 89 + struct xrt_space_overseer **out_xso) 86 90 { 87 91 struct xrt_prober_device **xpdevs = NULL; 88 92 size_t xpdev_count = 0; ··· 185 189 #endif 186 190 187 191 *out_xsysd = &usysd->base; 192 + u_builder_create_space_overseer(&usysd->base, out_xso); 188 193 189 194 return XRT_SUCCESS; 190 195
+3 -1
src/xrt/targets/common/target_builder_simulated.c
··· 92 92 simulated_open_system(struct xrt_builder *xb, 93 93 cJSON *config, 94 94 struct xrt_prober *xp, 95 - struct xrt_system_devices **out_xsysd) 95 + struct xrt_system_devices **out_xsysd, 96 + struct xrt_space_overseer **out_xso) 96 97 { 97 98 assert(out_xsysd != NULL); 98 99 assert(*out_xsysd == NULL); ··· 131 132 } 132 133 133 134 *out_xsysd = &usysd->base; 135 + u_builder_create_space_overseer(&usysd->base, out_xso); 134 136 135 137 return XRT_SUCCESS; 136 138 }
+7 -2
src/xrt/targets/common/target_builder_simulavr.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 185 185 } 186 186 187 187 static xrt_result_t 188 - svr_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, struct xrt_system_devices **out_xsysd) 188 + svr_open_system(struct xrt_builder *xb, 189 + cJSON *config, 190 + struct xrt_prober *xp, 191 + struct xrt_system_devices **out_xsysd, 192 + struct xrt_space_overseer **out_xso) 189 193 { 190 194 struct simula_builder *sb = (struct simula_builder *)xb; 191 195 struct u_system_devices *usysd = u_system_devices_allocate(); ··· 215 219 end: 216 220 if (result == XRT_SUCCESS) { 217 221 *out_xsysd = &usysd->base; 222 + u_builder_create_space_overseer(&usysd->base, out_xso); 218 223 } else { 219 224 u_system_devices_destroy(&usysd); 220 225 }
+9 -2
src/xrt/targets/common/target_instance.c
··· 1 - // Copyright 2020-2022, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 7 */ 8 8 9 + #include "xrt/xrt_space.h" 9 10 #include "xrt/xrt_system.h" 10 11 #include "xrt/xrt_config_build.h" 11 12 ··· 46 47 static xrt_result_t 47 48 t_instance_create_system(struct xrt_instance *xinst, 48 49 struct xrt_system_devices **out_xsysd, 50 + struct xrt_space_overseer **out_xso, 49 51 struct xrt_system_compositor **out_xsysc) 50 52 { 51 53 XRT_TRACE_MARKER(); 52 54 53 55 assert(out_xsysd != NULL); 54 56 assert(*out_xsysd == NULL); 57 + assert(out_xso != NULL); 58 + assert(*out_xso == NULL); 55 59 assert(out_xsysc == NULL || *out_xsysc == NULL); 56 60 57 61 struct xrt_system_compositor *xsysc = NULL; 62 + struct xrt_space_overseer *xso = NULL; 58 63 struct xrt_system_devices *xsysd = NULL; 59 64 xrt_result_t xret = XRT_SUCCESS; 60 65 61 - xret = u_system_devices_create_from_prober(xinst, &xsysd); 66 + xret = u_system_devices_create_from_prober(xinst, &xsysd, &xso); 62 67 if (xret != XRT_SUCCESS) { 63 68 return xret; 64 69 } ··· 96 101 #endif 97 102 98 103 if (xret != XRT_SUCCESS) { 104 + xrt_space_overseer_destroy(&xso); 99 105 xrt_system_devices_destroy(&xsysd); 100 106 return xret; 101 107 } 102 108 103 109 *out_xsysd = xsysd; 110 + *out_xso = xso; 104 111 *out_xsysc = xsysc; 105 112 106 113 return xret;
+7 -2
src/xrt/targets/common/target_instance_no_comp.c
··· 1 - // Copyright 2020, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 18 18 static xrt_result_t 19 19 t_instance_create_system(struct xrt_instance *xinst, 20 20 struct xrt_system_devices **out_xsysd, 21 + struct xrt_space_overseer **out_xso, 21 22 struct xrt_system_compositor **out_xsysc) 22 23 { 23 24 XRT_TRACE_MARKER(); 24 25 25 26 struct xrt_system_devices *xsysd = NULL; 27 + struct xrt_space_overseer *xso = NULL; 26 28 xrt_result_t xret = XRT_SUCCESS; 27 29 28 30 assert(out_xsysd != NULL); 29 31 assert(*out_xsysd == NULL); 32 + assert(out_xso != NULL); 33 + assert(*out_xso == NULL); 30 34 assert(out_xsysc == NULL || *out_xsysc == NULL); 31 35 32 36 // Can't create a system compositor. ··· 34 38 return XRT_ERROR_ALLOCATION; 35 39 } 36 40 37 - xret = u_system_devices_create_from_prober(xinst, &xsysd); 41 + xret = u_system_devices_create_from_prober(xinst, &xsysd, &xso); 38 42 if (xret != XRT_SUCCESS) { 39 43 return xret; 40 44 } 41 45 42 46 *out_xsysd = xsysd; 47 + *out_xso = xso; 43 48 44 49 return xret; 45 50 }
+8 -1
src/xrt/targets/sdl_test/sdl_instance.c
··· 1 - // Copyright 2020-2022, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 11 11 #include "xrt/xrt_config_drivers.h" 12 12 13 13 #include "util/u_misc.h" 14 + #include "util/u_builders.h" 14 15 #include "util/u_trace_marker.h" 15 16 16 17 #include "sdl_internal.h" ··· 55 56 static xrt_result_t 56 57 sdl_instance_create_system(struct xrt_instance *xinst, 57 58 struct xrt_system_devices **out_xsysd, 59 + struct xrt_space_overseer **out_xso, 58 60 struct xrt_system_compositor **out_xsysc) 59 61 { 60 62 assert(out_xsysd != NULL); 61 63 assert(*out_xsysd == NULL); 64 + assert(out_xso != NULL); 65 + assert(*out_xso == NULL); 62 66 assert(out_xsysc == NULL || *out_xsysc == NULL); 63 67 64 68 struct sdl_program *sp = from_xinst(xinst); 65 69 66 70 *out_xsysd = &sp->xsysd_base; 71 + *out_xso = sp->xso; 67 72 68 73 // Early out if we only want devices. 69 74 if (out_xsysc == NULL) { ··· 107 112 sp->xsysd_base.xdevs[0] = head; 108 113 sp->xsysd_base.xdev_count = 1; 109 114 sp->xsysd_base.roles.head = head; 115 + 116 + u_builder_create_space_overseer(&sp->xsysd_base, &sp->xso); 110 117 } 111 118 112 119 void
+4 -1
src/xrt/targets/sdl_test/sdl_internal.h
··· 1 - // Copyright 2020-2022, Collabora, Ltd. 1 + // Copyright 2020-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 129 129 130 130 //! System devices base. 131 131 struct xrt_system_devices xsysd_base; 132 + 133 + //! Space overseer, implemented for now using helper code. 134 + struct xrt_space_overseer *xso; 132 135 133 136 //! SDL compositor struct. 134 137 struct sdl_compositor c;