From 45907329c7a39a97f38de2b456b58b00d15ac012 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 20 Mar 2026 15:45:22 +0100 Subject: [PATCH 1/4] Set project name + version from git/GIT_DESC --- CMakeLists.txt | 14 +++++++ cmake/GitVersion.cmake | 1 + common/CMakeLists.txt | 15 +------- .../0010-configure-u_git_tag-in-WiVRn.patch | 37 +++++++++++++++++++ server/CMakeLists.txt | 1 + server/u_git_tag.cpp.in | 36 ++++++++++++++++++ 6 files changed, 90 insertions(+), 14 deletions(-) create mode 100644 patches/monado/0010-configure-u_git_tag-in-WiVRn.patch create mode 100644 server/u_git_tag.cpp.in diff --git a/CMakeLists.txt b/CMakeLists.txt index aa8c5723..75f761bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,6 +282,20 @@ FetchContent_Declare(monado EXCLUDE_FROM_ALL ) +add_custom_target(wivrn-version ALL + COMMAND ${CMAKE_COMMAND} + -D GIT_EXECUTABLE=${GIT_EXECUTABLE} + -D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/common/version.cpp.in + -D OUTPUT_FILE=${CMAKE_BINARY_DIR}/version.cpp + -D INPUT_FILE_1=${CMAKE_CURRENT_SOURCE_DIR}/server/u_git_tag.cpp.in + -D OUTPUT_FILE_1=${CMAKE_BINARY_DIR}/u_git_tag.cpp + -D GIT_DESC="${GIT_DESC}" + -D GIT_COMMIT="${GIT_COMMIT}" + -P ${CMAKE_SOURCE_DIR}/cmake/GitVersion.cmake + BYPRODUCTS ${CMAKE_BINARY_DIR}/version.cpp ${CMAKE_BINARY_DIR}/u_git_tag.cpp + SOURCES common/version.cpp.in server/u_git_tag.cpp.in + ) + add_subdirectory(external) if (NEED_COMMON) add_subdirectory(common) diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake index d46b85b5..30e28d2f 100644 --- a/cmake/GitVersion.cmake +++ b/cmake/GitVersion.cmake @@ -30,3 +30,4 @@ else() endif() configure_file(${INPUT_FILE} ${OUTPUT_FILE}) +configure_file(${INPUT_FILE_1} ${OUTPUT_FILE_1}) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index e4e85ae5..ccc8e6de 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -5,25 +5,12 @@ else() FetchContent_MakeAvailable(boost) endif() -add_custom_target(wivrn-version ALL - COMMAND ${CMAKE_COMMAND} - -D GIT_EXECUTABLE=${GIT_EXECUTABLE} - -D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in - -D OUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/version.cpp - -D CMAKE_PROJECT_VERSION=${CMAKE_PROJECT_VERSION} - -D GIT_DESC="${GIT_DESC}" - -D GIT_COMMIT="${GIT_COMMIT}" - -P ${CMAKE_SOURCE_DIR}/cmake/GitVersion.cmake - BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in - ) - configure_file(wivrn_config.h.in wivrn_config.h) add_library(wivrn-common-base STATIC EXCLUDE_FROM_ALL utils/strings.cpp utils/xdg_base_directory.cpp - ${CMAKE_CURRENT_BINARY_DIR}/version.cpp + ${CMAKE_BINARY_DIR}/version.cpp ) add_library(wivrn-common STATIC EXCLUDE_FROM_ALL diff --git a/patches/monado/0010-configure-u_git_tag-in-WiVRn.patch b/patches/monado/0010-configure-u_git_tag-in-WiVRn.patch new file mode 100644 index 00000000..14a97e76 --- /dev/null +++ b/patches/monado/0010-configure-u_git_tag-in-WiVRn.patch @@ -0,0 +1,37 @@ +From a9ac675eab72a6ce96adb38215e83f7b3e9b51e7 Mon Sep 17 00:00:00 2001 +From: no name +Date: Fri, 20 Mar 2026 16:51:18 +0100 +Subject: [PATCH] configure u_git_tag in WiVRn + +--- + src/xrt/auxiliary/util/CMakeLists.txt | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/src/xrt/auxiliary/util/CMakeLists.txt b/src/xrt/auxiliary/util/CMakeLists.txt +index d45cd60c9..ec0d45434 100644 +--- a/src/xrt/auxiliary/util/CMakeLists.txt ++++ b/src/xrt/auxiliary/util/CMakeLists.txt +@@ -10,11 +10,6 @@ + # by applications like the OpenXR runtime library. + # + +-configure_file( +- "${CMAKE_CURRENT_SOURCE_DIR}/u_git_tag.c.in" "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" +- @ONLY +- ) +- + add_library( + aux_util STATIC + u_autoexpgain.c +@@ -118,7 +113,7 @@ add_library( + u_worker.cpp + u_worker.h + u_worker.hpp +- "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" ++ "${U_GIT_TAG_CPP}" + ) + target_link_libraries( + aux_util +-- +2.53.0 + diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 6fa0d842..5ebc1a83 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,3 +1,4 @@ +set(U_GIT_TAG_CPP "${CMAKE_BINARY_DIR}/u_git_tag.cpp") set(XRT_BUILD_DRIVER_ARDUINO OFF) set(XRT_BUILD_DRIVER_BLUBUR_S1 OFF) diff --git a/server/u_git_tag.cpp.in b/server/u_git_tag.cpp.in new file mode 100644 index 00000000..b4fb8f57 --- /dev/null +++ b/server/u_git_tag.cpp.in @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +namespace +{ +uint16_t version(int digit) +{ + std::string_view tag = "@GIT_DESC@"; + if (not tag.empty() and tag[0] == 'v') + tag = tag.substr(1); + for (; digit > 0; --digit) + { + while (not tag.empty() and std::isdigit(tag[0])) + tag = tag.substr(1); + if (not tag.empty() and tag[0] == '.') + tag = tag.substr(1); + } + tag = tag.substr(0, tag.find('.')); + + uint16_t val = 0; + // We don't care if parsing fail, return 0 + std::from_chars(tag.begin(), tag.end(), val); + return val; +} +} // namespace + +extern "C" +{ + extern const char u_git_tag[] = "@GIT_DESC@"; + extern const uint16_t u_version_major = version(0); + extern const uint16_t u_version_minor = version(1); + extern const uint16_t u_version_patch = version(2); + extern const char u_runtime_description[] = "WiVRn"; +} From 7164a7dbebaf74946b359576614d9d4df3b2ab13 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Fri, 20 Mar 2026 00:47:03 -0500 Subject: [PATCH 2/4] Fix build failure in debug --- server/driver/wivrn_comp_target.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index 1f2d74c7..5b0ebed9 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -487,8 +487,8 @@ VkResult wivrn_comp_target::present( assert(present_queue != nullptr); (void)present_queue; - assert(index < cn->image_count); - assert(cn->psc.images[index].status == pseudo_swapchain::status_t::acquired); + assert(index < image_count); + assert(psc.images[index].status == pseudo_swapchain::status_t::acquired); auto vk = get_vk(); auto res = wivrn_bundle->device.waitForFences(*psc.fence, true, UINT64_MAX); From 78d7fc40f2f6ed282191b1d4a918e2126fa13d7a Mon Sep 17 00:00:00 2001 From: Sapphire Date: Fri, 20 Mar 2026 00:53:18 -0500 Subject: [PATCH 3/4] Update Monado --- flake.nix | 2 +- monado-rev | 2 +- ...001-c-multi-early-wake-of-compositor.patch | 4 +- .../monado/0002-Use-extern-socket-fd.patch | 2 +- ...vironment-blend-mode-selection-logic.patch | 2 +- .../0004-st-oxr-forward-0-refresh-rate.patch | 6 +-- ...05-Replace-distortion-with-foveation.patch | 2 +- ..._lh-prevent-crash-on-vive-pro2-WiVRn.patch | 2 +- ...entDataInteractionProfileChanged-whe.patch | 38 ++++--------------- ...08-Don-t-get-pose-data-in-compositor.patch | 2 +- .../monado/0009-don-t-verify-GL-stuff.patch | 2 +- 11 files changed, 21 insertions(+), 43 deletions(-) diff --git a/flake.nix b/flake.nix index 18f0cdca..c3f58b8f 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,7 @@ # Keep in sync with CMakeLists.txt monado rev rev = lib.strings.trim (builtins.readFile ./monado-rev); # Nix will output the correct hash when it doesn't match - hash = "sha256-aIHry5C30pZVIkB5fptJ0Ncbmg8EKf0M7evB4IJZEI0="; + hash = "sha256-II+jtlMrFsea6I69azABFiI92NjckxoXbenaw5+JnXE="; }; }; diff --git a/monado-rev b/monado-rev index 74481bea..9573b344 100644 --- a/monado-rev +++ b/monado-rev @@ -1 +1 @@ -ee655a920cb4b50bafa2af2c92333a503e40cae6 +6d503d082fa31b5f3e53dfbe7a76bc8f72863efc 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 487f061f..42e63340 100644 --- a/patches/monado/0001-c-multi-early-wake-of-compositor.patch +++ b/patches/monado/0001-c-multi-early-wake-of-compositor.patch @@ -1,4 +1,4 @@ -From 563f347bf4d59b4a82144e25c3be894a0cd17c8d Mon Sep 17 00:00:00 2001 +From 6317d6556f2510cc63aa5f71d86585830a38b2a1 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 @@ -10,7 +10,7 @@ Subject: [PATCH 1/9] c/multi: early wake of compositor 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/xrt/compositor/multi/comp_multi_compositor.c b/src/xrt/compositor/multi/comp_multi_compositor.c -index 94cea110e..88347a092 100644 +index 1fc135ce4..25b64aca8 100644 --- a/src/xrt/compositor/multi/comp_multi_compositor.c +++ b/src/xrt/compositor/multi/comp_multi_compositor.c @@ -236,7 +236,21 @@ wait_for_scheduled_free(struct multi_compositor *mc) diff --git a/patches/monado/0002-Use-extern-socket-fd.patch b/patches/monado/0002-Use-extern-socket-fd.patch index 077363b3..2f73da74 100644 --- a/patches/monado/0002-Use-extern-socket-fd.patch +++ b/patches/monado/0002-Use-extern-socket-fd.patch @@ -1,4 +1,4 @@ -From 7d7c139b9ed03ec492256760c6acd1c7364c2e2a Mon Sep 17 00:00:00 2001 +From 71b4f13a8b7cb90edf83f75bef8459d2db66c386 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 8 Oct 2024 22:13:15 +0200 Subject: [PATCH 2/9] Use extern socket fd diff --git a/patches/monado/0003-change-environment-blend-mode-selection-logic.patch b/patches/monado/0003-change-environment-blend-mode-selection-logic.patch index 3e0450f2..435bebd3 100644 --- a/patches/monado/0003-change-environment-blend-mode-selection-logic.patch +++ b/patches/monado/0003-change-environment-blend-mode-selection-logic.patch @@ -1,4 +1,4 @@ -From 1328192bc28f312e728460d6c29ab150a9b655bd Mon Sep 17 00:00:00 2001 +From d3fc5ebb88a59ce5fc1120ed33de921eec03384f 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 3/9] change environment blend mode selection logic diff --git a/patches/monado/0004-st-oxr-forward-0-refresh-rate.patch b/patches/monado/0004-st-oxr-forward-0-refresh-rate.patch index dd3a2967..e3bbdce6 100644 --- a/patches/monado/0004-st-oxr-forward-0-refresh-rate.patch +++ b/patches/monado/0004-st-oxr-forward-0-refresh-rate.patch @@ -1,4 +1,4 @@ -From 18f87ff2f292e2f4cab8718601e6d5ba236a5013 Mon Sep 17 00:00:00 2001 +From 42e1e561a98f5c9fd6f757232bd4821124ae9bb3 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 15 Mar 2025 22:19:48 +0100 Subject: [PATCH 4/9] st/oxr: forward 0 refresh rate @@ -9,10 +9,10 @@ Subject: [PATCH 4/9] st/oxr: forward 0 refresh rate 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c -index b6c4947bf..0e8ed02b7 100644 +index 3364aaead..deec90a73 100644 --- a/src/xrt/compositor/main/comp_compositor.c +++ b/src/xrt/compositor/main/comp_compositor.c -@@ -372,7 +372,7 @@ compositor_request_display_refresh_rate(struct xrt_compositor *xc, float display +@@ -377,7 +377,7 @@ compositor_request_display_refresh_rate(struct xrt_compositor *xc, float display if (c->target && c->target->request_refresh_rate) { xrt_result_t result = comp_target_request_refresh_rate(c->target, display_refresh_rate_hz); // Assume refresh rate change is immediate diff --git a/patches/monado/0005-Replace-distortion-with-foveation.patch b/patches/monado/0005-Replace-distortion-with-foveation.patch index f35b0569..83d1d7e3 100644 --- a/patches/monado/0005-Replace-distortion-with-foveation.patch +++ b/patches/monado/0005-Replace-distortion-with-foveation.patch @@ -1,4 +1,4 @@ -From 8c322edfafa6179875bfe1dca1517c4043f0c5b4 Mon Sep 17 00:00:00 2001 +From 4b5685fc3177fd2f54996e0a87c1efe985db9c7b Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Wed, 11 Sep 2024 22:56:29 +0200 Subject: [PATCH 5/9] Replace distortion with foveation diff --git a/patches/monado/0006-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch b/patches/monado/0006-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch index 076c45a3..b6107ea3 100644 --- a/patches/monado/0006-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch +++ b/patches/monado/0006-d-steamvr_lh-prevent-crash-on-vive-pro2-WiVRn.patch @@ -1,4 +1,4 @@ -From b9acd6d83db324c6f31572615fb6738a6f93d63c Mon Sep 17 00:00:00 2001 +From 5664ae214c09deb241507526e749f83f3a16298c Mon Sep 17 00:00:00 2001 From: no name Date: Sun, 28 Sep 2025 11:33:10 +0200 Subject: [PATCH 6/9] d/steamvr_lh: prevent crash on vive pro2/WiVRn diff --git a/patches/monado/0007-st-oxr-push-XrEventDataInteractionProfileChanged-whe.patch b/patches/monado/0007-st-oxr-push-XrEventDataInteractionProfileChanged-whe.patch index 6447c583..5b5515b9 100644 --- a/patches/monado/0007-st-oxr-push-XrEventDataInteractionProfileChanged-whe.patch +++ b/patches/monado/0007-st-oxr-push-XrEventDataInteractionProfileChanged-whe.patch @@ -1,49 +1,27 @@ -From 8c6580e84690ffe8f082cdff5ead8443d1f6bf23 Mon Sep 17 00:00:00 2001 +From 4fdc8798f4810145c446fe147ae94e4c717b6b28 Mon Sep 17 00:00:00 2001 From: Sapphire Date: Fri, 7 Nov 2025 20:41:16 -0600 Subject: [PATCH 7/9] st/oxr: push XrEventDataInteractionProfileChanged when profile changes to NULL --- - src/xrt/state_trackers/oxr/actions/oxr_input.c | 15 +++++---------- - 1 file changed, 5 insertions(+), 10 deletions(-) + src/xrt/state_trackers/oxr/actions/oxr_input.c | 3 --- + 1 file changed, 3 deletions(-) diff --git a/src/xrt/state_trackers/oxr/actions/oxr_input.c b/src/xrt/state_trackers/oxr/actions/oxr_input.c -index 349c9adcb..667163142 100644 +index 269c6ec62..05a747f74 100644 --- a/src/xrt/state_trackers/oxr/actions/oxr_input.c +++ b/src/xrt/state_trackers/oxr/actions/oxr_input.c -@@ -1945,26 +1945,21 @@ oxr_session_update_action_bindings(struct oxr_logger *log, struct oxr_session *s - } - } - -- /* -- * This code will only send events (and update the bindings) if there -- * is a profile mapped to the subaction path. Meaning it won't update -- * the cache or generate events when a controller goes away, basically -- * latching the interaction profile to the last active device. -- */ -+ bool any_profile_changed = false; +@@ -1947,9 +1947,6 @@ session_update_action_bindings(struct oxr_logger *log, #define POPULATE_PROFILE(X) \ do { \ XrPath path = profiles.X != NULL ? profiles.X->path : XR_NULL_PATH; \ - if (path == XR_NULL_PATH) { \ - break; /* Only update on "active" interaction profiles per sub-action path. */ \ - } \ - if (sess->X != path) { \ - sess->X = path; \ -- oxr_event_push_XrEventDataInteractionProfileChanged(log, sess); \ -+ any_profile_changed = true; \ - } \ - } while (false); - OXR_FOR_EACH_VALID_SUBACTION_PATH(POPULATE_PROFILE) - #undef POPULATE_PROFILE - -+ if (any_profile_changed) { -+ oxr_event_push_XrEventDataInteractionProfileChanged(log, sess); -+ } - return oxr_session_success_result(sess); - } - + if (action_context->X != path) { \ + action_context->X = path; \ + interaction_profile_changed = true; \ -- 2.53.0 diff --git a/patches/monado/0008-Don-t-get-pose-data-in-compositor.patch b/patches/monado/0008-Don-t-get-pose-data-in-compositor.patch index 1d6eb084..f9e2eed1 100644 --- a/patches/monado/0008-Don-t-get-pose-data-in-compositor.patch +++ b/patches/monado/0008-Don-t-get-pose-data-in-compositor.patch @@ -1,4 +1,4 @@ -From 959707499b31f8db80f28492d1bfc01e34b23368 Mon Sep 17 00:00:00 2001 +From 025dcad51542cd6c23d9a6ad16cca982bf2fa5ca Mon Sep 17 00:00:00 2001 From: no name Date: Thu, 15 Jan 2026 12:13:06 +0100 Subject: [PATCH 8/9] Don't get pose data in compositor diff --git a/patches/monado/0009-don-t-verify-GL-stuff.patch b/patches/monado/0009-don-t-verify-GL-stuff.patch index d9e62ff7..f15a5228 100644 --- a/patches/monado/0009-don-t-verify-GL-stuff.patch +++ b/patches/monado/0009-don-t-verify-GL-stuff.patch @@ -1,4 +1,4 @@ -From 14e5d4a2f29b95f0f7933dbf2dde5000c0a98866 Mon Sep 17 00:00:00 2001 +From dfacf60061206ca6f41b8bc44e9cd7166230d77e Mon Sep 17 00:00:00 2001 From: no name Date: Sun, 25 Jan 2026 10:09:10 +0100 Subject: [PATCH 9/9] don't verify GL stuff From a491561271cdb0c2a7332ff91caa5a040b2bf30a Mon Sep 17 00:00:00 2001 From: Sapphire Date: Fri, 20 Mar 2026 00:56:49 -0500 Subject: [PATCH 4/4] Update Monado --- flake.nix | 2 +- monado-rev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index c3f58b8f..f2cf658b 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,7 @@ # Keep in sync with CMakeLists.txt monado rev rev = lib.strings.trim (builtins.readFile ./monado-rev); # Nix will output the correct hash when it doesn't match - hash = "sha256-II+jtlMrFsea6I69azABFiI92NjckxoXbenaw5+JnXE="; + hash = "sha256-M0SQMu1rgY++a+4r0DK//ralFEO5w7I3UrgLecoLO+A="; }; }; diff --git a/monado-rev b/monado-rev index 9573b344..5462f9a8 100644 --- a/monado-rev +++ b/monado-rev @@ -1 +1 @@ -6d503d082fa31b5f3e53dfbe7a76bc8f72863efc +ef152c973b94a313e1ba9552162818b5151ac671