From c9e774ee65b2dc9575bc74e752289fdf014a0409 Mon Sep 17 00:00:00 2001 From: Vindicus999 <211831565+Vindicus999@users.noreply.github.com> Date: Sun, 24 Aug 2025 19:20:52 -0400 Subject: [PATCH] feat: add solarxr patches --- ...098-d-solarxr-Add-SolarXR-IPC-driver.patch | 39 ++--- .../0099-t-common-Load-SolarXR-driver.patch | 142 +++--------------- 2 files changed, 45 insertions(+), 136 deletions(-) diff --git a/patches/monado/0098-d-solarxr-Add-SolarXR-IPC-driver.patch b/patches/monado/0098-d-solarxr-Add-SolarXR-IPC-driver.patch index 71e102c1..684840be 100644 --- a/patches/monado/0098-d-solarxr-Add-SolarXR-IPC-driver.patch +++ b/patches/monado/0098-d-solarxr-Add-SolarXR-IPC-driver.patch @@ -1,4 +1,4 @@ -From 7a3b7758a1ae3b0d9c7a48280f279f8e99b8b678 Mon Sep 17 00:00:00 2001 +From fee8044b7304f789f5bb6f1b3b442d57847dba7b Mon Sep 17 00:00:00 2001 From: rcelyte Date: Mon, 17 Jun 2024 04:32:36 +0000 Subject: [PATCH] d/solarxr: Add SolarXR IPC driver @@ -28,7 +28,7 @@ Subject: [PATCH] d/solarxr: Add SolarXR IPC driver create mode 100644 src/xrt/drivers/solarxr/solarxr_ipc_socket.h diff --git a/CMakeLists.txt b/CMakeLists.txt -index c84143343c..da462f4c3f 100644 +index f4f13fbb2..755bebb33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,6 +343,7 @@ option_with_deps(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Va @@ -39,7 +39,7 @@ index c84143343c..da462f4c3f 100644 option(XRT_BUILD_DRIVER_SIMULATED "Enable simulated driver" ON) option(XRT_BUILD_SAMPLES "Enable compiling sample code implementations that will not be linked into any final targets" ON) -@@ -443,6 +444,7 @@ list( +@@ -446,6 +447,7 @@ list( "TWRAP" "XREAL_AIR" "STEAMVR_LIGHTHOUSE" @@ -47,7 +47,7 @@ index c84143343c..da462f4c3f 100644 ) # Package name needs to be known by the native code itself. -@@ -672,6 +674,7 @@ message(STATUS "# DRIVER_VIVE: ${XRT_BUILD_DRIVER_VIVE}") +@@ -678,6 +680,7 @@ message(STATUS "# DRIVER_VIVE: ${XRT_BUILD_DRIVER_VIVE}") message(STATUS "# DRIVER_WMR: ${XRT_BUILD_DRIVER_WMR}") message(STATUS "# DRIVER_XREAL_AIR: ${XRT_BUILD_DRIVER_XREAL_AIR}") message(STATUS "# DRIVER_STEAMVR_LIGHTHOUSE: ${XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE}") @@ -56,10 +56,10 @@ index c84143343c..da462f4c3f 100644 # cmake-format: on diff --git a/src/xrt/drivers/CMakeLists.txt b/src/xrt/drivers/CMakeLists.txt -index 0d422f16e4..5a823014d3 100644 +index 90dc4970f..a41d25117 100644 --- a/src/xrt/drivers/CMakeLists.txt +++ b/src/xrt/drivers/CMakeLists.txt -@@ -494,6 +494,23 @@ if(XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE) +@@ -510,6 +510,23 @@ if(XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE) list(APPEND ENABLED_HEADSET_DRIVERS steamvr_lh) endif() @@ -85,7 +85,7 @@ index 0d422f16e4..5a823014d3 100644 # but it never gets linked into a final target. diff --git a/src/xrt/drivers/solarxr/feeder.c b/src/xrt/drivers/solarxr/feeder.c new file mode 100644 -index 0000000000..55e235608c +index 000000000..55e235608 --- /dev/null +++ b/src/xrt/drivers/solarxr/feeder.c @@ -0,0 +1,286 @@ @@ -377,7 +377,7 @@ index 0000000000..55e235608c +} diff --git a/src/xrt/drivers/solarxr/feeder.h b/src/xrt/drivers/solarxr/feeder.h new file mode 100644 -index 0000000000..d5ef6a8b5f +index 000000000..d5ef6a8b5 --- /dev/null +++ b/src/xrt/drivers/solarxr/feeder.h @@ -0,0 +1,33 @@ @@ -416,7 +416,7 @@ index 0000000000..d5ef6a8b5f + bool (*filter)(struct xrt_device *device)); // thread safe diff --git a/src/xrt/drivers/solarxr/protocol.c b/src/xrt/drivers/solarxr/protocol.c new file mode 100644 -index 0000000000..01181b84a9 +index 000000000..01181b84a --- /dev/null +++ b/src/xrt/drivers/solarxr/protocol.c @@ -0,0 +1,383 @@ @@ -805,7 +805,7 @@ index 0000000000..01181b84a9 +} diff --git a/src/xrt/drivers/solarxr/protocol.h b/src/xrt/drivers/solarxr/protocol.h new file mode 100644 -index 0000000000..b630d26b41 +index 000000000..b630d26b4 --- /dev/null +++ b/src/xrt/drivers/solarxr/protocol.h @@ -0,0 +1,245 @@ @@ -1056,7 +1056,7 @@ index 0000000000..b630d26b41 +read_solarxr_bone(struct solarxr_bone *out, const uint8_t buffer[], size_t buffer_len, const solarxr_bone_t *ref); diff --git a/src/xrt/drivers/solarxr/solarxr_device.c b/src/xrt/drivers/solarxr/solarxr_device.c new file mode 100644 -index 0000000000..f6bf6ce53a +index 000000000..3fc8f74a0 --- /dev/null +++ b/src/xrt/drivers/solarxr/solarxr_device.c @@ -0,0 +1,1145 @@ @@ -2143,7 +2143,7 @@ index 0000000000..f6bf6ce53a + tracker->base.get_tracked_pose = solarxr_generic_tracker_get_tracked_pose; + tracker->base.destroy = solarxr_generic_tracker_destroy; + tracker->base.inputs[0].name = XRT_INPUT_GENERIC_TRACKER_POSE; -+ m_relation_history_create(&tracker->history, NULL); ++ m_relation_history_create(&tracker->history); + tracker->role = SOLARXR_BODY_PART_NONE; + tracker->parent = device; + tracker->weak_ref = &device->trackers[i]; @@ -2207,7 +2207,7 @@ index 0000000000..f6bf6ce53a +} diff --git a/src/xrt/drivers/solarxr/solarxr_interface.h b/src/xrt/drivers/solarxr/solarxr_interface.h new file mode 100644 -index 0000000000..15916484ff +index 000000000..15916484f --- /dev/null +++ b/src/xrt/drivers/solarxr/solarxr_interface.h @@ -0,0 +1,40 @@ @@ -2253,7 +2253,7 @@ index 0000000000..15916484ff +#endif diff --git a/src/xrt/drivers/solarxr/solarxr_ipc_message.h b/src/xrt/drivers/solarxr/solarxr_ipc_message.h new file mode 100644 -index 0000000000..0d97b51118 +index 000000000..0d97b5111 --- /dev/null +++ b/src/xrt/drivers/solarxr/solarxr_ipc_message.h @@ -0,0 +1,74 @@ @@ -2333,7 +2333,7 @@ index 0000000000..0d97b51118 +} diff --git a/src/xrt/drivers/solarxr/solarxr_ipc_socket.c b/src/xrt/drivers/solarxr/solarxr_ipc_socket.c new file mode 100644 -index 0000000000..b889a76163 +index 000000000..b889a7616 --- /dev/null +++ b/src/xrt/drivers/solarxr/solarxr_ipc_socket.c @@ -0,0 +1,255 @@ @@ -2594,7 +2594,7 @@ index 0000000000..b889a76163 +} diff --git a/src/xrt/drivers/solarxr/solarxr_ipc_socket.h b/src/xrt/drivers/solarxr/solarxr_ipc_socket.h new file mode 100644 -index 0000000000..aaebfdd547 +index 000000000..aaebfdd54 --- /dev/null +++ b/src/xrt/drivers/solarxr/solarxr_ipc_socket.h @@ -0,0 +1,49 @@ @@ -2648,10 +2648,10 @@ index 0000000000..aaebfdd547 + return atomic_load(&state->ipc_handle) != XRT_IPC_HANDLE_INVALID; +} diff --git a/src/xrt/targets/common/CMakeLists.txt b/src/xrt/targets/common/CMakeLists.txt -index e2b9ba79d1..1fbf5f436f 100644 +index e7655456a..c42697d0e 100644 --- a/src/xrt/targets/common/CMakeLists.txt +++ b/src/xrt/targets/common/CMakeLists.txt -@@ -201,6 +201,10 @@ if(XRT_BUILD_DRIVER_SIMULAVR) +@@ -205,6 +205,10 @@ if(XRT_BUILD_DRIVER_SIMULAVR) target_link_libraries(target_lists PRIVATE drv_svr) endif() @@ -2663,4 +2663,5 @@ index e2b9ba79d1..1fbf5f436f 100644 # Instance # -- -GitLab +2.50.1 + diff --git a/patches/monado/0099-t-common-Load-SolarXR-driver.patch b/patches/monado/0099-t-common-Load-SolarXR-driver.patch index a23c5a32..73ea18bf 100644 --- a/patches/monado/0099-t-common-Load-SolarXR-driver.patch +++ b/patches/monado/0099-t-common-Load-SolarXR-driver.patch @@ -1,22 +1,22 @@ -From 999c18895dc60680b0c4e167b4b89de031020445 Mon Sep 17 00:00:00 2001 +From a0c03b2f602311a8c4299e250ecb64be9528194b Mon Sep 17 00:00:00 2001 From: rcelyte Date: Fri, 23 Aug 2024 20:54:53 +0000 Subject: [PATCH] t/common: Load SolarXR driver --- - src/xrt/drivers/qwerty/qwerty_device.c | 4 +++ - .../common/target_builder_lighthouse.c | 25 +++++++++++++++++ - .../targets/common/target_builder_qwerty.c | 25 +++++++++++++++++ - .../targets/common/target_builder_rift_s.c | 26 ++++++++++++++++++ - .../targets/common/target_builder_steamvr.c | 27 +++++++++++++++++++ - src/xrt/targets/common/target_builder_wmr.c | 25 +++++++++++++++++ - 6 files changed, 132 insertions(+) + src/xrt/drivers/qwerty/qwerty_device.c | 4 ++++ + .../targets/common/target_builder_lighthouse.c | 14 ++++++++++++++ + src/xrt/targets/common/target_builder_qwerty.c | 14 ++++++++++++++ + src/xrt/targets/common/target_builder_rift_s.c | 15 +++++++++++++++ + src/xrt/targets/common/target_builder_steamvr.c | 15 +++++++++++++++ + src/xrt/targets/common/target_builder_wmr.c | 14 ++++++++++++++ + 6 files changed, 76 insertions(+) diff --git a/src/xrt/drivers/qwerty/qwerty_device.c b/src/xrt/drivers/qwerty/qwerty_device.c -index 53949d3b90..e1194bc061 100644 +index b390af901..fc60c869c 100644 --- a/src/xrt/drivers/qwerty/qwerty_device.c +++ b/src/xrt/drivers/qwerty/qwerty_device.c -@@ -315,6 +315,8 @@ qwerty_hmd_create(void) +@@ -317,6 +317,8 @@ qwerty_hmd_create(void) xd->inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE; @@ -25,7 +25,7 @@ index 53949d3b90..e1194bc061 100644 xd->update_inputs = u_device_noop_update_inputs; xd->get_tracked_pose = qwerty_get_tracked_pose; xd->get_view_poses = u_device_get_view_poses; -@@ -367,6 +369,8 @@ qwerty_controller_create(bool is_left, struct qwerty_hmd *qhmd) +@@ -369,6 +371,8 @@ qwerty_controller_create(bool is_left, struct qwerty_hmd *qhmd) xd->binding_profiles = binding_profiles; xd->binding_profile_count = ARRAY_SIZE(binding_profiles); @@ -35,7 +35,7 @@ index 53949d3b90..e1194bc061 100644 xd->get_tracked_pose = qwerty_get_tracked_pose; xd->set_output = qwerty_set_output; diff --git a/src/xrt/targets/common/target_builder_lighthouse.c b/src/xrt/targets/common/target_builder_lighthouse.c -index 2386586be3..b8cbafdbed 100644 +index 78fe52ab4..da68c0b4a 100644 --- a/src/xrt/targets/common/target_builder_lighthouse.c +++ b/src/xrt/targets/common/target_builder_lighthouse.c @@ -58,6 +58,10 @@ @@ -49,25 +49,8 @@ index 2386586be3..b8cbafdbed 100644 #if defined(XRT_BUILD_DRIVER_SURVIVE) #define DEFAULT_DRIVER "survive" #else -@@ -509,6 +513,16 @@ try_add_opengloves(struct xrt_device *left, - #endif - } - -+#ifdef XRT_BUILD_DRIVER_SOLARXR -+static void -+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd) -+{ -+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0); -+ u_system_devices_close(xsysd); -+ free(xsysd); -+} -+#endif -+ - static xrt_result_t - lighthouse_open_system_impl(struct xrt_builder *xb, - cJSON *config, -@@ -736,6 +750,17 @@ end_valve_index: - try_add_opengloves(left, right, &left_ht, &right_ht); +@@ -740,6 +744,16 @@ end_valve_index: + try_add_opengloves(left, right, &unobstructed_left_ht, &unobstructed_right_ht); } +#ifdef XRT_BUILD_DRIVER_SOLARXR @@ -76,7 +59,6 @@ index 2386586be3..b8cbafdbed 100644 + if (count != 0) { + xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count]; + solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count); -+ xsysd->destroy = destroy_system_devices_solarxr; + } + xsysd->xdev_count += count; +#endif @@ -85,7 +67,7 @@ index 2386586be3..b8cbafdbed 100644 ubrh->head = head; ubrh->left = left; diff --git a/src/xrt/targets/common/target_builder_qwerty.c b/src/xrt/targets/common/target_builder_qwerty.c -index 2c66ad3038..5a5059ee18 100644 +index 2c66ad303..76444147e 100644 --- a/src/xrt/targets/common/target_builder_qwerty.c +++ b/src/xrt/targets/common/target_builder_qwerty.c @@ -18,6 +18,10 @@ @@ -99,24 +81,7 @@ index 2c66ad3038..5a5059ee18 100644 #include -@@ -67,6 +71,16 @@ qwerty_estimate_system(struct xrt_builder *xb, - return XRT_SUCCESS; - } - -+#ifdef XRT_BUILD_DRIVER_SOLARXR -+static void -+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd) -+{ -+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0); -+ u_system_devices_close(xsysd); -+ free(xsysd); -+} -+#endif -+ - static xrt_result_t - qwerty_open_system_impl(struct xrt_builder *xb, - cJSON *config, -@@ -100,6 +114,17 @@ qwerty_open_system_impl(struct xrt_builder *xb, +@@ -100,6 +104,16 @@ qwerty_open_system_impl(struct xrt_builder *xb, ubrh->left = left; ubrh->right = right; @@ -126,7 +91,6 @@ index 2c66ad3038..5a5059ee18 100644 + if (count != 0) { + xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count]; + solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count); -+ xsysd->destroy = destroy_system_devices_solarxr; + } + xsysd->xdev_count += count; +#endif @@ -135,7 +99,7 @@ index 2c66ad3038..5a5059ee18 100644 } diff --git a/src/xrt/targets/common/target_builder_rift_s.c b/src/xrt/targets/common/target_builder_rift_s.c -index 675b303228..bf5581688d 100644 +index fb284d77b..f48eebe35 100644 --- a/src/xrt/targets/common/target_builder_rift_s.c +++ b/src/xrt/targets/common/target_builder_rift_s.c @@ -28,6 +28,10 @@ @@ -149,24 +113,7 @@ index 675b303228..bf5581688d 100644 #include "rift_s/rift_s_interface.h" #include "rift_s/rift_s.h" -@@ -92,6 +96,16 @@ rift_s_estimate_system(struct xrt_builder *xb, - return XRT_SUCCESS; - } - -+#ifdef XRT_BUILD_DRIVER_SOLARXR -+static void -+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd) -+{ -+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0); -+ u_system_devices_close(xsysd); -+ free(xsysd); -+} -+#endif -+ - static xrt_result_t - rift_s_open_system_impl(struct xrt_builder *xb, - cJSON *config, -@@ -200,6 +214,18 @@ rift_s_open_system_impl(struct xrt_builder *xb, +@@ -200,6 +204,17 @@ rift_s_open_system_impl(struct xrt_builder *xb, } #endif @@ -177,7 +124,6 @@ index 675b303228..bf5581688d 100644 + if (count != 0) { + xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count]; + solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count); -+ xsysd->destroy = destroy_system_devices_solarxr; + } + xsysd->xdev_count += count; +#endif @@ -186,7 +132,7 @@ index 675b303228..bf5581688d 100644 ubrh->head = hmd_xdev; ubrh->left = left_xdev; diff --git a/src/xrt/targets/common/target_builder_steamvr.c b/src/xrt/targets/common/target_builder_steamvr.c -index 7b70e6b7c7..0267bb900d 100644 +index a603eeaf5..171ad0d9a 100644 --- a/src/xrt/targets/common/target_builder_steamvr.c +++ b/src/xrt/targets/common/target_builder_steamvr.c @@ -34,6 +34,10 @@ @@ -200,27 +146,9 @@ index 7b70e6b7c7..0267bb900d 100644 #ifndef XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE #error "This builder requires the SteamVR Lighthouse driver" #endif -@@ -115,6 +119,17 @@ steamvr_destroy(struct xrt_builder *xb) - free(svrb); - } - -+#ifdef XRT_BUILD_DRIVER_SOLARXR -+static void -+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd) -+{ -+ void _Z7destroyP18xrt_system_devices(struct xrt_system_devices * xsysd); -+ -+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0); -+ _Z7destroyP18xrt_system_devices(xsysd); -+} -+#endif -+ - static xrt_result_t - steamvr_open_system(struct xrt_builder *xb, - cJSON *config, -@@ -151,6 +166,18 @@ steamvr_open_system(struct xrt_builder *xb, - svrb->right_ht = u_system_devices_get_ht_device_right(xsysd); - xsysd->static_roles.hand_tracking.right = svrb->right_ht; +@@ -166,6 +170,17 @@ steamvr_open_system(struct xrt_builder *xb, + SET_HT_ROLES(conforming) + #undef SET_HT_ROLES +#ifdef XRT_BUILD_DRIVER_SOLARXR + const uint32_t count = @@ -229,7 +157,6 @@ index 7b70e6b7c7..0267bb900d 100644 + if (count != 0) { + xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count]; + solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count); -+ xsysd->destroy = destroy_system_devices_solarxr; + } + xsysd->xdev_count += count; +#endif @@ -238,7 +165,7 @@ index 7b70e6b7c7..0267bb900d 100644 * Space overseer. */ diff --git a/src/xrt/targets/common/target_builder_wmr.c b/src/xrt/targets/common/target_builder_wmr.c -index 40df6b6535..d543c441c2 100644 +index 57c3bfd7e..c0564c2a8 100644 --- a/src/xrt/targets/common/target_builder_wmr.c +++ b/src/xrt/targets/common/target_builder_wmr.c @@ -26,6 +26,10 @@ @@ -252,24 +179,7 @@ index 40df6b6535..d543c441c2 100644 #ifndef XRT_BUILD_DRIVER_WMR #error "Must only be built with XRT_BUILD_DRIVER_WMR set" #endif -@@ -175,6 +179,16 @@ wmr_estimate_system(struct xrt_builder *xb, - return XRT_SUCCESS; - } - -+#ifdef XRT_BUILD_DRIVER_SOLARXR -+static void -+destroy_system_devices_solarxr(struct xrt_system_devices *xsysd) -+{ -+ solarxr_device_set_feeder_devices(xsysd->static_roles.body, NULL, 0); -+ u_system_devices_close(xsysd); -+ free(xsysd); -+} -+#endif -+ - static xrt_result_t - wmr_open_system_impl(struct xrt_builder *xb, - cJSON *config, -@@ -295,6 +309,17 @@ wmr_open_system_impl(struct xrt_builder *xb, +@@ -296,6 +300,16 @@ wmr_open_system_impl(struct xrt_builder *xb, right = ht_right; } @@ -279,7 +189,6 @@ index 40df6b6535..d543c441c2 100644 + if (count != 0) { + xsysd->static_roles.body = xsysd->xdevs[xsysd->xdev_count]; + solarxr_device_set_feeder_devices(xsysd->static_roles.body, xsysd->xdevs, xsysd->xdev_count); -+ xsysd->destroy = destroy_system_devices_solarxr; + } + xsysd->xdev_count += count; +#endif @@ -288,5 +197,4 @@ index 40df6b6535..d543c441c2 100644 // Assign to role(s). ubrh->head = head; -- -GitLab - +2.50.1