From 1af4ae760c39517a710b091d38fa8f367cd112d3 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Wed, 12 Nov 2025 20:24:38 -0600 Subject: [PATCH] Update monado --- flake.nix | 2 +- monado-rev | 2 +- ...001-c-multi-early-wake-of-compositor.patch | 4 +- ...02-ipc-server-Always-listen-to-stdin.patch | 4 +- .../monado/0003-Use-extern-socket-fd.patch | 4 +- ...vironment-blend-mode-selection-logic.patch | 4 +- .../0005-st-oxr-forward-0-refresh-rate.patch | 4 +- ...06-Replace-distortion-with-foveation.patch | 4 +- ...07-Limit-foveation-samples-per-pixel.patch | 4 +- ...lh-prevent-crash-on-vive-pro2-WiVRn.patch} | 4 +- ...d-callbacks-and-unify-main-functions.patch | 312 ------------------ 11 files changed, 18 insertions(+), 330 deletions(-) rename patches/monado/{0009-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch => 0008-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch} (86%) delete mode 100644 patches/monado/0008-ipc-Add-callbacks-and-unify-main-functions.patch diff --git a/flake.nix b/flake.nix index 26e87ad2..67525496 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,7 @@ # Keep in sync with CMakeLists.txt monado rev rev = builtins.readFile ./monado-rev; # Nix will output the correct hash when it doesn't match - hash = "sha256-ThaowHvFx0kxzBp/McXXkI+iX4pLBZPcwD3F7ADJIjs="; + hash = "sha256-Li3aG0QpzWvJoiGc2s70WiFmwf9anbMvpUWIncMIZx8="; }; }; diff --git a/monado-rev b/monado-rev index f41abd10..ad5a7801 100644 --- a/monado-rev +++ b/monado-rev @@ -1 +1 @@ -4d6464912e44db58d85caa06aeec0de40ffc7295 +57a9631a2f11069557039b08c9897ee6c4aec6be diff --git a/patches/monado/0001-c-multi-early-wake-of-compositor.patch b/patches/monado/0001-c-multi-early-wake-of-compositor.patch index 17e94d4c..509af8cc 100644 --- a/patches/monado/0001-c-multi-early-wake-of-compositor.patch +++ b/patches/monado/0001-c-multi-early-wake-of-compositor.patch @@ -1,7 +1,7 @@ -From 7188df90796bde8f49480eeb97972ae0dd6d00d9 Mon Sep 17 00:00:00 2001 +From 84a3c13c5db96e6a80a1420f3995f5e7acbfbb1f Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 22 Oct 2024 15:23:19 +0200 -Subject: [PATCH 1/9] c/multi: early wake of compositor +Subject: [PATCH 1/8] c/multi: early wake of compositor --- .../compositor/multi/comp_multi_compositor.c | 14 +++++++++ diff --git a/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch b/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch index f2d7f13e..9dc9c3e6 100644 --- a/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch +++ b/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch @@ -1,7 +1,7 @@ -From b1004ccb12e551a15328051a6bab6a2c947c27be Mon Sep 17 00:00:00 2001 +From 7fe376f6732a82861a207700bc3ab8541ed9f4d8 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 2 Apr 2024 17:14:42 +0200 -Subject: [PATCH 2/9] ipc/server: Always listen to stdin +Subject: [PATCH 2/8] ipc/server: Always listen to stdin --- src/xrt/ipc/server/ipc_server_mainloop_linux.c | 2 +- diff --git a/patches/monado/0003-Use-extern-socket-fd.patch b/patches/monado/0003-Use-extern-socket-fd.patch index 7d43d0a5..44526e5b 100644 --- a/patches/monado/0003-Use-extern-socket-fd.patch +++ b/patches/monado/0003-Use-extern-socket-fd.patch @@ -1,7 +1,7 @@ -From 376b32bb2f6ad1476647f8f1c26e55f6d1c31464 Mon Sep 17 00:00:00 2001 +From 0a362b551b49349aea040106a56269abf39c0f18 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 8 Oct 2024 22:13:15 +0200 -Subject: [PATCH 3/9] Use extern socket fd +Subject: [PATCH 3/8] Use extern socket fd --- src/xrt/ipc/server/ipc_server_mainloop_linux.c | 8 ++++++++ diff --git a/patches/monado/0004-change-environment-blend-mode-selection-logic.patch b/patches/monado/0004-change-environment-blend-mode-selection-logic.patch index d844916e..81d85998 100644 --- a/patches/monado/0004-change-environment-blend-mode-selection-logic.patch +++ b/patches/monado/0004-change-environment-blend-mode-selection-logic.patch @@ -1,7 +1,7 @@ -From 85dc9ce191820fb4647764b70621f779eec6fd97 Mon Sep 17 00:00:00 2001 +From 05263a4f548d9f745d6d96d2a3dc0d46d0b4e7a6 Mon Sep 17 00:00:00 2001 From: galister <85970-galister@users.noreply.gitlab.freedesktop.org> Date: Sat, 23 Nov 2024 02:42:12 +0900 -Subject: [PATCH 4/9] change environment blend mode selection logic +Subject: [PATCH 4/8] change environment blend mode selection logic --- src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++------- diff --git a/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch b/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch index 936fb9a6..b87ff622 100644 --- a/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch +++ b/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch @@ -1,7 +1,7 @@ -From 45e225d1d4b8951725567e032f1767baa4bb49e6 Mon Sep 17 00:00:00 2001 +From 4097ddb56d19b3fc73fa92bffc79385eda0d39c5 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 15 Mar 2025 22:19:48 +0100 -Subject: [PATCH 5/9] st/oxr: forward 0 refresh rate +Subject: [PATCH 5/8] st/oxr: forward 0 refresh rate --- src/xrt/compositor/main/comp_compositor.c | 2 +- diff --git a/patches/monado/0006-Replace-distortion-with-foveation.patch b/patches/monado/0006-Replace-distortion-with-foveation.patch index c151f44c..798aa6fa 100644 --- a/patches/monado/0006-Replace-distortion-with-foveation.patch +++ b/patches/monado/0006-Replace-distortion-with-foveation.patch @@ -1,7 +1,7 @@ -From f893f548c075183711f347d831dfc9f82a369ad8 Mon Sep 17 00:00:00 2001 +From c4794a811b252a5ec7b3c3bbde985453f47f7542 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Wed, 11 Sep 2024 22:56:29 +0200 -Subject: [PATCH 6/9] Replace distortion with foveation +Subject: [PATCH 6/8] Replace distortion with foveation --- src/xrt/compositor/CMakeLists.txt | 4 +- diff --git a/patches/monado/0007-Limit-foveation-samples-per-pixel.patch b/patches/monado/0007-Limit-foveation-samples-per-pixel.patch index e715c6bf..28a34fd5 100644 --- a/patches/monado/0007-Limit-foveation-samples-per-pixel.patch +++ b/patches/monado/0007-Limit-foveation-samples-per-pixel.patch @@ -1,7 +1,7 @@ -From c4b5651515dde6859821bda2b4cb9ced2260ddc6 Mon Sep 17 00:00:00 2001 +From 8d5c814af6d9bbc7977fa36f1ca258c161dfbbcb Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 31 Aug 2025 17:05:49 +0200 -Subject: [PATCH 7/9] Limit foveation samples per pixel +Subject: [PATCH 7/8] Limit foveation samples per pixel --- src/xrt/compositor/shaders/distortion.comp | 12 +++++++++--- diff --git a/patches/monado/0009-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch b/patches/monado/0008-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch similarity index 86% rename from patches/monado/0009-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch rename to patches/monado/0008-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch index 278a2efa..a32dcaeb 100644 --- a/patches/monado/0009-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch +++ b/patches/monado/0008-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch @@ -1,7 +1,7 @@ -From 421b071ddccb9ad47514f31cd490ac73506fa6d4 Mon Sep 17 00:00:00 2001 +From 057b015a3f8a9eac0c97f42d00734ca7b7356bf6 Mon Sep 17 00:00:00 2001 From: no name Date: Sun, 28 Sep 2025 11:33:10 +0200 -Subject: [PATCH 9/9] d/steamvr_lh: prevent crash on vive pro2/WiVRn +Subject: [PATCH 8/8] d/steamvr_lh: prevent crash on vive pro2/WiVRn --- src/xrt/drivers/steamvr_lh/steamvr_lh.cpp | 2 +- diff --git a/patches/monado/0008-ipc-Add-callbacks-and-unify-main-functions.patch b/patches/monado/0008-ipc-Add-callbacks-and-unify-main-functions.patch deleted file mode 100644 index 6cab0f10..00000000 --- a/patches/monado/0008-ipc-Add-callbacks-and-unify-main-functions.patch +++ /dev/null @@ -1,312 +0,0 @@ -From c04b7d37ce9356b990b622145777a97b012a95d7 Mon Sep 17 00:00:00 2001 -From: Jakob Bornecrantz -Date: Fri, 15 Nov 2024 22:51:32 +0000 -Subject: [PATCH 8/9] ipc: Add callbacks and unify main functions - ---- - src/xrt/ipc/server/ipc_server_interface.h | 58 +++++++++---- - src/xrt/ipc/server/ipc_server_process.c | 84 ++++++++++--------- - .../targets/service-lib/service_target.cpp | 38 +++++++-- - 3 files changed, 118 insertions(+), 62 deletions(-) - -diff --git a/src/xrt/ipc/server/ipc_server_interface.h b/src/xrt/ipc/server/ipc_server_interface.h -index b870a52c8..1b44af8a8 100644 ---- a/src/xrt/ipc/server/ipc_server_interface.h -+++ b/src/xrt/ipc/server/ipc_server_interface.h -@@ -10,12 +10,10 @@ - * @ingroup ipc_server - */ - --#include "xrt/xrt_compiler.h" - #include "xrt/xrt_config_os.h" -+#include "xrt/xrt_results.h" - --#ifndef XRT_OS_ANDROID - #include "util/u_debug_gui.h" --#endif - - - #ifdef __cplusplus -@@ -23,7 +21,7 @@ extern "C" { - #endif - - --#ifndef XRT_OS_ANDROID -+struct ipc_server; - - /*! - * Information passed into the IPC server main function, used for customization -@@ -38,31 +36,57 @@ struct ipc_server_main_info - }; - - /*! -- * Main entrypoint to the compositor process. - * - * @ingroup ipc_server - */ --int --ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi); -- --#endif -+struct ipc_server_callbacks -+{ -+ /*! -+ * The IPC server failed to init. -+ * -+ * @param[in] xret The error code generated during init. -+ * @param[in] data User data given passed into the main function. -+ */ -+ void (*init_failed)(xrt_result_t xret, void *data); - -+ /*! -+ * The service has completed init and is entering its mainloop. -+ * -+ * @param[in] s The IPC server. -+ * @param[in] xinst Instance that was created by the IPC server. -+ * @param[in] data User data given passed into the main function. -+ */ -+ void (*mainloop_entering)(struct ipc_server *s, struct xrt_instance *xinst, void *data); - --#ifdef XRT_OS_ANDROID -+ /*! -+ * The service is leaving the mainloop, after this callback returns the -+ * IPC server will destroy all resources created. -+ * -+ * @param[in] s The IPC server. -+ * @param[in] xinst Instance that was created by the IPC server. -+ * @param[in] data User data given passed into the main function. -+ */ -+ void (*mainloop_leaving)(struct ipc_server *s, struct xrt_instance *xinst, void *data); -+}; - - /*! -- * Main entrypoint to the server process. -+ * Common main function for starting the IPC service. - * -- * @param ps Pointer to populate with the server struct. -- * @param startup_complete_callback Function to call upon completing startup -- * and populating *ps, but before entering -- * the mainloop. -- * @param data user data to pass to your callback. -+ * @ingroup ipc_server -+ */ -+int -+ipc_server_main_common(const struct ipc_server_main_info *ismi, const struct ipc_server_callbacks *iscb, void *data); -+ -+ -+#ifndef XRT_OS_ANDROID -+ -+/*! -+ * Main entrypoint to the compositor process. - * - * @ingroup ipc_server - */ - int --ipc_server_main_android(struct ipc_server **ps, void (*startup_complete_callback)(void *data), void *data); -+ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi); - - #endif - -diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c -index 791a655d6..554de713b 100644 ---- a/src/xrt/ipc/server/ipc_server_process.c -+++ b/src/xrt/ipc/server/ipc_server_process.c -@@ -978,9 +978,10 @@ ipc_server_get_system_properties(struct ipc_server *vs, struct xrt_system_proper - return XRT_SUCCESS; - } - --#ifndef XRT_OS_ANDROID - int --ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi) -+ipc_server_main_common(const struct ipc_server_main_info *ismi, -+ const struct ipc_server_callbacks *callbacks, -+ void *data) - { - xrt_result_t xret = XRT_SUCCESS; - int ret = -1; -@@ -1008,11 +1009,8 @@ ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi) - xret = init_all(s, log_level); - U_LOG_CHK_ONLY_PRINT(log_level, xret, "init_all"); - if (xret != XRT_SUCCESS) { --#ifdef XRT_OS_LINUX -- // Print information how to debug issues. -- print_linux_end_user_failed_information(log_level); --#endif -- -+ // Propegate the failure. -+ callbacks->init_failed(xret, data); - u_debug_gui_stop(&s->debug_gui); - free(s); - return -1; -@@ -1021,13 +1019,15 @@ ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi) - // Start the debug UI now (if enabled). - u_debug_gui_start(s->debug_gui, s->xinst, s->xsysd); - --#ifdef XRT_OS_LINUX -- // Print a very clear service started message. -- print_linux_end_user_started_information(log_level); --#endif -+ // Tell the callbacks we are entering the main-loop. -+ callbacks->mainloop_entering(s, s->xinst, data); -+ - // Main loop. - ret = main_loop(s); - -+ // Tell the callbacks we are leaving the main-loop. -+ callbacks->mainloop_leaving(s, s->xinst, data); -+ - // Stop the UI before tearing everything down. - u_debug_gui_stop(&s->debug_gui); - -@@ -1044,39 +1044,43 @@ ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi) - return ret; - } - --#endif // !XRT_OS_ANDROID -- --#ifdef XRT_OS_ANDROID --int --ipc_server_main_android(struct ipc_server **ps, void (*startup_complete_callback)(void *data), void *data) --{ -- xrt_result_t xret = XRT_SUCCESS; -- int ret = -1; -- -- // Get log level first. -- enum u_logging_level log_level = debug_get_log_option_ipc_log(); - -- struct ipc_server *s = U_TYPED_CALLOC(struct ipc_server); -- U_LOG_D("Created IPC server!"); -- -- xret = init_all(s, log_level); -- U_LOG_CHK_ONLY_PRINT(log_level, xret, "init_all"); -- if (xret != XRT_SUCCESS) { -- free(s); -- startup_complete_callback(data); -- return -1; -- } -+#ifndef XRT_OS_ANDROID - -- *ps = s; -- startup_complete_callback(data); -+static void -+init_failed(xrt_result_t xret, void *data) -+{ -+#ifdef XRT_OS_LINUX -+ // Print information how to debug issues. -+ print_linux_end_user_failed_information(debug_get_log_option_ipc_log()); -+#endif -+} - -- ret = main_loop(s); -+static void -+mainloop_entering(struct ipc_server *s, struct xrt_instance *xinst, void *data) -+{ -+#ifdef XRT_OS_LINUX -+ // Print a very clear service started message. -+ print_linux_end_user_started_information(s->log_level); -+#endif -+} - -- teardown_all(s); -- free(s); -+static void -+mainloop_leaving(struct ipc_server *s, struct xrt_instance *xinst, void *data) -+{ -+ // No-op -+} - -- U_LOG_I("Server exiting '%i'!", ret); -+int -+ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi) -+{ -+ const struct ipc_server_callbacks callbacks = { -+ .init_failed = init_failed, -+ .mainloop_entering = mainloop_entering, -+ .mainloop_leaving = mainloop_leaving, -+ }; - -- return ret; -+ return ipc_server_main_common(ismi, &callbacks, NULL); - } --#endif // XRT_OS_ANDROID -+ -+#endif // !XRT_OS_ANDROID -diff --git a/src/xrt/targets/service-lib/service_target.cpp b/src/xrt/targets/service-lib/service_target.cpp -index 45877803d..71c581da6 100644 ---- a/src/xrt/targets/service-lib/service_target.cpp -+++ b/src/xrt/targets/service-lib/service_target.cpp -@@ -1,4 +1,5 @@ - // Copyright 2020, Collabora, Ltd. -+// Copyright 2024, Collabora, Ltd. - // SPDX-License-Identifier: BSL-1.0 - /*! - * @file -@@ -41,10 +42,11 @@ public: - } - - void -- signalStartupComplete() -+ signalStartupComplete(ipc_server *s) - { - std::unique_lock lock{server_mutex}; - startup_complete = true; -+ server = s; - startup_cond.notify_all(); - } - -@@ -53,15 +55,27 @@ public: - { - std::unique_lock lock(server_mutex); - if (!server && !server_thread) { -- server_thread = std::make_unique( -- [&]() { ipc_server_main_android(&server, signalStartupCompleteTrampoline, this); }); -+ server_thread = -+ std::make_unique([&]() { ipc_server_main_common(&ismi, &callbacks, this); }); - } - } - - static void -- signalStartupCompleteTrampoline(void *data) -+ signalInitFailed(xrt_result_t xret, void *data) - { -- static_cast(data)->signalStartupComplete(); -+ static_cast(data)->signalStartupComplete(nullptr); -+ } -+ -+ static void -+ signalStartupCompleteTrampoline(ipc_server *s, xrt_instance *xsint, void *data) -+ { -+ static_cast(data)->signalStartupComplete(s); -+ } -+ -+ static void -+ signalShuttingDownTrampoline(ipc_server *s, xrt_instance *xsint, void *data) -+ { -+ // No-op - } - - int32_t -@@ -114,6 +128,20 @@ private: - return server && completed; - } - -+ const struct ipc_server_main_info ismi = { -+ .udgci = -+ { -+ .window_title = "Monado Android Service", -+ .open = U_DEBUG_GUI_OPEN_NEVER, -+ }, -+ }; -+ -+ const struct ipc_server_callbacks callbacks = { -+ .init_failed = signalInitFailed, -+ .mainloop_entering = signalStartupCompleteTrampoline, -+ .mainloop_leaving = signalShuttingDownTrampoline, -+ }; -+ - //! Reference to the ipc_server, managed by ipc_server_process - struct ipc_server *server = NULL; - --- -2.51.2 -