Compare commits
179
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70c08fd649 | ||
|
|
28d34b48d9 | ||
|
|
e46228d75a | ||
|
|
0ca94d8037 | ||
|
|
f3ca5e5c35 | ||
|
|
5169f12b98 | ||
|
|
8a961fa625 | ||
|
|
cf3c364b42 | ||
|
|
492ed88ae2 | ||
|
|
7e0dba71a5 | ||
|
|
d89714070e | ||
|
|
7867063c37 | ||
|
|
ca05a3cf29 | ||
|
|
a110a54256 | ||
|
|
870c3c0796 | ||
|
|
28b6771511 | ||
|
|
963caf1794 | ||
|
|
393cefda8f | ||
|
|
faa1a0c02f | ||
|
|
bee076416c | ||
|
|
9439c75f75 | ||
|
|
d45fae44e7 | ||
|
|
c3065d4950 | ||
|
|
ec83166955 | ||
|
|
9dee429515 | ||
|
|
4cc00b6a67 | ||
|
|
85493b6599 | ||
|
|
0c8f319a86 | ||
|
|
5e590273f7 | ||
|
|
33cf4be5fd | ||
|
|
66c7b3e04d | ||
|
|
8441add99b | ||
|
|
184254cb62 | ||
|
|
0640bcf943 | ||
|
|
4430721eb4 | ||
|
|
1e794eee1d | ||
|
|
7c9ce8283b | ||
|
|
fea424e894 | ||
|
|
c9e774ee65 | ||
|
|
f4fa43784f | ||
|
|
f0c31a7994 | ||
|
|
ef50208923 | ||
|
|
81d256b623 | ||
|
|
3a0e1fa2a6 | ||
|
|
9f82675237 | ||
|
|
eb86dbf209 | ||
|
|
f4e55b41d7 | ||
|
|
3c1909a2d9 | ||
|
|
07c0ecd31b | ||
|
|
675464a868 | ||
|
|
517c809817 | ||
|
|
155abc0bc2 | ||
|
|
6d9d6f5a80 | ||
|
|
5925b2197e | ||
|
|
143a05ba2f | ||
|
|
642ed2ce23 | ||
|
|
06df375a2a | ||
|
|
b3604697ab | ||
|
|
5895c53e2f | ||
|
|
928ce04443 | ||
|
|
e271c6c2d6 | ||
|
|
011b347b87 | ||
|
|
f92a55d5fd | ||
|
|
eb2e0c12ca | ||
|
|
bb511c855e | ||
|
|
298de3f9c2 | ||
|
|
bec073ef91 | ||
|
|
5255887a85 | ||
|
|
34c49cdae6 | ||
|
|
7e1a04afba | ||
|
|
29ea3f918b | ||
|
|
d8173cdc1c | ||
|
|
a680811058 | ||
|
|
d60060a125 | ||
|
|
5c6a874542 | ||
|
|
10dad7dac4 | ||
|
|
450cbbe71a | ||
|
|
72e8989889 | ||
|
|
e7eff33bab | ||
|
|
e03d750ba5 | ||
|
|
5109a19824 | ||
|
|
0534c3d0bb | ||
|
|
07611d7db6 | ||
|
|
45900a5fde | ||
|
|
5d2b125cbf | ||
|
|
48088d6ef3 | ||
|
|
4eb74814f2 | ||
|
|
265280d3a4 | ||
|
|
fca81fd326 | ||
|
|
99dbc34b16 | ||
|
|
fcaa2ed7cb | ||
|
|
2e40a8523b | ||
|
|
4b2d681278 | ||
|
|
cad5133bca | ||
|
|
b88b9eaac7 | ||
|
|
7114a32d56 | ||
|
|
a9bf0e6a66 | ||
|
|
fe022becbb | ||
|
|
1a22f38b7f | ||
|
|
f55fd1683b | ||
|
|
4414f3b0cd | ||
|
|
2772c0d2f9 | ||
|
|
dbc52ac72b | ||
|
|
1bc732002f | ||
|
|
1e9d0f691d | ||
|
|
e32cfc8786 | ||
|
|
9ab2cfc1a1 | ||
|
|
f6f41680be | ||
|
|
644eac6b1b | ||
|
|
6b94344eb1 | ||
|
|
57844afef0 | ||
|
|
e012a74cb4 | ||
|
|
68366776de | ||
|
|
90b5a7f774 | ||
|
|
92f677b518 | ||
|
|
f4d232d8ad | ||
|
|
755b4f1300 | ||
|
|
c3ed62811b | ||
|
|
a4791a028a | ||
|
|
ab6c2f0aae | ||
|
|
e0df6484dc | ||
|
|
b1efa984fa | ||
|
|
3fe032fa3b | ||
|
|
1c81b7b264 | ||
|
|
7ce68a0673 | ||
|
|
e7e42054d5 | ||
|
|
ea45e9f91b | ||
|
|
6212dccc2b | ||
|
|
449a5b5201 | ||
|
|
80e31b642a | ||
|
|
8a9d218e4f | ||
|
|
6eaaf8b770 | ||
|
|
617934e91f | ||
|
|
06d5e00fe2 | ||
|
|
377e218782 | ||
|
|
5e81b4a14d | ||
|
|
20b67a5a3c | ||
|
|
c55fec84fe | ||
|
|
acf6cc03d0 | ||
|
|
0e2d46c152 | ||
|
|
ea5d3b4185 | ||
|
|
c0a8df2a60 | ||
|
|
4bb40296fc | ||
|
|
c34e8c6961 | ||
|
|
1999e953dd | ||
|
|
40f83a2b60 | ||
|
|
8af5b3eb29 | ||
|
|
3485593e56 | ||
|
|
6c3563904c | ||
|
|
66435957bb | ||
|
|
1550a346c3 | ||
|
|
4fd6d6d816 | ||
|
|
be2027ce9a | ||
|
|
fa3313e293 | ||
|
|
7e0ea37b3c | ||
|
|
b0d9bd2ab7 | ||
|
|
42755dbb7c | ||
|
|
b9ff08d893 | ||
|
|
b997ff3a17 | ||
|
|
63aa862a67 | ||
|
|
52646de23e | ||
|
|
6e8e78b912 | ||
|
|
a7a56d0873 | ||
|
|
59a241de63 | ||
|
|
4740848ca5 | ||
|
|
651c9d5a0f | ||
|
|
bc5d80a13a | ||
|
|
b1db340227 | ||
|
|
8377d617cf | ||
|
|
f94e46ed24 | ||
|
|
aa1f3b39bd | ||
|
|
680dd34529 | ||
|
|
f301ba393a | ||
|
|
0ccc8b6239 | ||
|
|
adcf159916 | ||
|
|
4125cad44e | ||
|
|
6969e5f972 | ||
|
|
d0250abbc9 | ||
|
|
7485cd0880 |
@@ -0,0 +1,6 @@
|
||||
version: "1"
|
||||
rules:
|
||||
- base: master
|
||||
upstream: WiVRn:master
|
||||
mergeMethod: hardreset
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Checkout from upstream instead of WiVRn-APK to ensure the GIT_DESC variable is set correctly
|
||||
repository: 'WiVRn/WiVRn'
|
||||
repository: 'Vindicus999/WiVRn'
|
||||
ref: ${{ github.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -109,13 +109,15 @@ jobs:
|
||||
pattern: 'apk-*'
|
||||
merge-multiple: true
|
||||
|
||||
- name: Rename APK artifacts
|
||||
run: |
|
||||
cd apk
|
||||
for f in *.apk; do
|
||||
BASENAME=`echo ${f}|awk -F '-APK-' '{print $2}'`
|
||||
mv "${f}" "org.meumeu.wivrn-${BASENAME}"
|
||||
done
|
||||
# - name: Rename APK artifacts
|
||||
# run: |
|
||||
# cd apk
|
||||
# ls
|
||||
# for f in *.apk; do
|
||||
# BASENAME=`echo ${f}|awk -F '-APK-' '{print $2}'`
|
||||
# mv "${f}" "org.meumeu.wivrn-${BASENAME}"
|
||||
# done
|
||||
# ls
|
||||
|
||||
- name: Download APK debug artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
@@ -34,6 +34,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev libarchive-dev
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Sync Upstream
|
||||
|
||||
env:
|
||||
UPSTREAM_URL: "https://github.com/wivrn/wivrn.git"
|
||||
WORKFLOW_TOKEN: ${{ secrets.DOWNSTREAM_GITHUB_TOKEN }}
|
||||
UPSTREAM_BRANCH: "master"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 5/6 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: GitHub Sync to Upstream Repository
|
||||
uses: dabreadman/sync-upstream-repo@v1.3.0
|
||||
with:
|
||||
upstream_repo: ${{ env.UPSTREAM_URL }}
|
||||
upstream_branch: ${{ env.UPSTREAM_BRANCH }}
|
||||
token: ${{ env.WORKFLOW_TOKEN }}
|
||||
|
||||
- name: Checkout stuff
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Merge sneed -> master
|
||||
uses: devmasx/merge-branch@master
|
||||
with:
|
||||
type: now
|
||||
from_branch: sneed
|
||||
target_branch: master
|
||||
github_token: ${{ env.WORKFLOW_TOKEN }}
|
||||
|
||||
+2
-2
@@ -43,12 +43,12 @@ option(WIVRN_USE_X264 "Enable x264 software encoder" ON)
|
||||
option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" ON)
|
||||
option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" OFF)
|
||||
|
||||
set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite"
|
||||
set(OVR_COMPAT_SEARCH_PATH "/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite:/opt/xrizer"
|
||||
CACHE STRING "List of places to search for the OpenVR compatibility layer, separated by :")
|
||||
|
||||
option(WIVRN_FEATURE_DEBUG_GUI "Enable Monado debug GUI" OFF)
|
||||
option(WIVRN_FEATURE_RENDERDOC "Support renderdoc" OFF)
|
||||
set(WIVRN_FEATURE_SOLARXR OFF) # Will be added back when merged in upstream Monado
|
||||
option(WIVRN_FEATURE_SOLARXR "Enable SolarXR driver" OFF)
|
||||
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
|
||||
|
||||
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 292 B |
+5
-15
@@ -236,14 +236,8 @@ add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn.png
|
||||
COMMAND ${RSVG_CONVERT} ${IMG_SRC_DIR}/wivrn.svg -w 540 -h 540 -o ${ASSETS_DIR}/wivrn.png ${RSVG_OPTS}
|
||||
DEPENDS ${IMG_SRC_DIR}/wivrn.svg ${WIVRN_CSS_ABS})
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn-pride.png
|
||||
COMMAND ${RSVG_CONVERT} ${IMG_SRC_DIR}/wivrn-pride.svg -w 540 -h 540 -o ${ASSETS_DIR}/wivrn-pride.png ${RSVG_OPTS}
|
||||
DEPENDS ${IMG_SRC_DIR}/wivrn-pride.svg ${WIVRN_CSS_ABS})
|
||||
|
||||
add_custom_target(assets ALL DEPENDS
|
||||
${ASSETS_DIR}/wivrn.png
|
||||
${ASSETS_DIR}/wivrn-pride.png
|
||||
)
|
||||
${ASSETS_DIR}/wivrn.png)
|
||||
|
||||
add_dependencies(wivrn assets)
|
||||
|
||||
@@ -252,25 +246,21 @@ if(ANDROID)
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 4x4 --astc_quality 100 --genmipmap ${ASSETS_DIR}/wivrn.ktx2 ${ASSETS_DIR}/wivrn.png
|
||||
DEPENDS ${ASSETS_DIR}/wivrn.png)
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/wivrn-pride.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 4x4 --astc_quality 100 --genmipmap ${ASSETS_DIR}/wivrn-pride.ktx2 ${ASSETS_DIR}/wivrn-pride.png
|
||||
DEPENDS ${ASSETS_DIR}/wivrn-pride.png)
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/default_icon.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 4x4 --astc_quality 100 --genmipmap ${ASSETS_DIR}/wivrn-pride.ktx2 ${ASSETS_DIR}/default_icon.png
|
||||
DEPENDS ${ASSETS_DIR}/default_icon.png)
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/WoodFloor051_1K-JPG_Color.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 12x12 --astc_quality 100 --genmipmap ${ASSETS_DIR}/WoodFloor051_1K-JPG_Color.ktx2 ${AST_SRC_DIR}/WoodFloor051_1K-JPG_Color.jpg
|
||||
DEPENDS ${AST_SRC_DIR}/WoodFloor051_1K-JPG_Color.jpg)
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/default_icon.ktx2
|
||||
COMMAND ${TOKTX} --encode astc --astc_blk_d 4x4 --astc_quality 100 --genmipmap ${ASSETS_DIR}/wivrn.ktx2 ${ASSETS_DIR}/default_icon.png
|
||||
DEPENDS ${ASSETS_DIR}/default_icon.png)
|
||||
|
||||
add_custom_command(OUTPUT ${ASSETS_DIR}/vr_splash.png
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSETS_DIR}/wivrn.png ${ASSETS_DIR}/vr_splash.png
|
||||
DEPENDS ${ASSETS_DIR}/wivrn.png)
|
||||
|
||||
add_custom_target(assets-android ALL DEPENDS
|
||||
${ASSETS_DIR}/wivrn.ktx2
|
||||
${ASSETS_DIR}/wivrn-pride.ktx2
|
||||
${ASSETS_DIR}/WoodFloor051_1K-JPG_Color.ktx2
|
||||
${ASSETS_DIR}/vr_splash.png
|
||||
)
|
||||
|
||||
@@ -909,11 +909,8 @@ void scenes::lobby::on_focused()
|
||||
|
||||
swapchain_imgui = xr::swapchain(session, device, swapchain_format, 3000, 1300);
|
||||
|
||||
imgui_ctx.emplace(physical_device, device, queue_family_index, queue, imgui_inputs, swapchain_imgui, vps);
|
||||
|
||||
auto t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
auto tm = std::localtime(&t);
|
||||
std::string image = tm->tm_mon == 5 ? "wivrn-pride" : "wivrn";
|
||||
std::string image;
|
||||
image = "wivrn";
|
||||
try
|
||||
{
|
||||
about_picture = imgui_ctx->load_texture(image + ".ktx2");
|
||||
|
||||
@@ -1231,6 +1231,9 @@ void scenes::lobby::gui_about()
|
||||
ImGui::SetCursorPosX(win_width / 4);
|
||||
|
||||
ImGui::Image(about_picture, {win_width / 2, win_width / 2});
|
||||
ImGui::PushFont(nullptr, constants::gui::font_size_large);
|
||||
CenterTextH(std::string("Sneed'n'Chuck Edition"));
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void scenes::lobby::gui_first_run()
|
||||
|
||||
@@ -35,6 +35,10 @@ finish-args:
|
||||
# Set the active OpenXR / OpenVR runtime
|
||||
- --filesystem=xdg-config/openxr:create
|
||||
- --filesystem=xdg-config/openvr:create
|
||||
# SlimeVR
|
||||
- --filesystem=xdg-run/SlimeVRInput
|
||||
- --filesystem=xdg-run/SlimeVRRpc
|
||||
- --filesystem=xdg-run/app/dev.slimevr.SlimeVR
|
||||
# Let outside application access the WiVRn socket
|
||||
- --filesystem=xdg-run/wivrn:create
|
||||
- --own-name=io.github.wivrn.Server
|
||||
@@ -343,6 +347,7 @@ modules:
|
||||
- -DWIVRN_BUILD_SERVER_LIBRARY=ON
|
||||
- -DWIVRN_BUILD_DASHBOARD=OFF
|
||||
- -DWIVRN_BUILD_WIVRNCTL=OFF
|
||||
- -DWIVRN_FEATURE_SOLARXR=ON
|
||||
- -DWIVRN_WERROR=ON
|
||||
- -DFETCHCONTENT_FULLY_DISCONNECTED=ON
|
||||
- -DFETCHCONTENT_BASE_DIR=deps
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 158 KiB |
@@ -9,11 +9,6 @@ if [ -d ".git" ] ; then
|
||||
exec git am --committer-date-is-author-date "$@"
|
||||
fi
|
||||
|
||||
if ! type patch 2> /dev/null ; then
|
||||
echo "patch command not found" >&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# There is no reliable way to apply a patch and succeed if it was
|
||||
# already applied. Just ignore errors...
|
||||
for f in "$@" ; do
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
From dace1409153696ce05526de69597d1274e317374 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Zeni <simon.zeni@collabora.com>
|
||||
Date: Wed, 3 Sep 2025 11:40:57 -0400
|
||||
Subject: [PATCH 1/4] xrt: introduce xrt_list
|
||||
|
||||
---
|
||||
src/xrt/include/xrt/xrt_compiler.h | 12 +++-
|
||||
src/xrt/include/xrt/xrt_list.h | 105 +++++++++++++++++++++++++++++
|
||||
2 files changed, 116 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/xrt/include/xrt/xrt_list.h
|
||||
|
||||
diff --git a/src/xrt/include/xrt/xrt_compiler.h b/src/xrt/include/xrt/xrt_compiler.h
|
||||
index 49a49a238..fccd68444 100644
|
||||
--- a/src/xrt/include/xrt/xrt_compiler.h
|
||||
+++ b/src/xrt/include/xrt/xrt_compiler.h
|
||||
@@ -1,9 +1,10 @@
|
||||
-// Copyright 2019, Collabora, Ltd.
|
||||
+// Copyright 2019-2025, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Header holding common defines.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
+ * @author Simon Zeni <simon.zeni@collabora.com>
|
||||
* @ingroup xrt_iface
|
||||
*/
|
||||
|
||||
@@ -222,3 +223,12 @@ typedef intptr_t ssize_t;
|
||||
#else
|
||||
#define XRT_C11_COMPOUND(X) (X)
|
||||
#endif
|
||||
+
|
||||
+/*
|
||||
+ * `typeof` is standard in C23 only, it is a GNU extension prior to this version
|
||||
+ */
|
||||
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
+#define XRT_TYPEOF(expr) typeof(expr)
|
||||
+#else
|
||||
+#define XRT_TYPEOF(expr) __typeof(expr)
|
||||
+#endif
|
||||
diff --git a/src/xrt/include/xrt/xrt_list.h b/src/xrt/include/xrt/xrt_list.h
|
||||
new file mode 100644
|
||||
index 000000000..c6edd5c6b
|
||||
--- /dev/null
|
||||
+++ b/src/xrt/include/xrt/xrt_list.h
|
||||
@@ -0,0 +1,105 @@
|
||||
+// Copyright 2025, Collabora, Ltd.
|
||||
+// SPDX-License-Identifier: BSL-1.0
|
||||
+/*!
|
||||
+ * @file
|
||||
+ * @brief Circular doubly linked list
|
||||
+ * @author Simon Zeni <simon.zeni@collabora.com>
|
||||
+ * @ingroup xrt_iface
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "xrt/xrt_compiler.h"
|
||||
+
|
||||
+#include <stdbool.h>
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+/*!
|
||||
+ * TODO
|
||||
+ *
|
||||
+ * See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/list.h
|
||||
+ *
|
||||
+ * @ingroup xrt_iface
|
||||
+ */
|
||||
+struct xrt_list
|
||||
+{
|
||||
+ //! Previous element of the list
|
||||
+ struct xrt_list *prev;
|
||||
+ //! Next element of the list
|
||||
+ struct xrt_list *next;
|
||||
+};
|
||||
+
|
||||
+static inline void
|
||||
+xrt_list_init(struct xrt_list *list)
|
||||
+{
|
||||
+ list->prev = list;
|
||||
+ list->next = list;
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+xrt_list_insert(struct xrt_list *list, struct xrt_list *element)
|
||||
+{
|
||||
+ element->prev = list;
|
||||
+ element->next = list->next;
|
||||
+ list->next = element;
|
||||
+ element->next->prev = element;
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+xrt_list_remove(struct xrt_list *element)
|
||||
+{
|
||||
+ if (element->next == NULL && element->prev == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ element->prev->next = element->next;
|
||||
+ element->next->prev = element->prev;
|
||||
+ element->next = NULL;
|
||||
+ element->prev = NULL;
|
||||
+}
|
||||
+
|
||||
+static inline size_t
|
||||
+xrt_list_length(const struct xrt_list *list)
|
||||
+{
|
||||
+ size_t count = 0;
|
||||
+
|
||||
+ struct xrt_list *e = list->next;
|
||||
+ while (e != list) {
|
||||
+ e = e->next;
|
||||
+ count++;
|
||||
+ }
|
||||
+
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static inline bool
|
||||
+xrt_list_empty(const struct xrt_list *list)
|
||||
+{
|
||||
+ return list->next == list;
|
||||
+}
|
||||
+
|
||||
+#define XRT_LIST_FOR_EACH(pos, head, member) \
|
||||
+ for (pos = container_of((head)->next, XRT_TYPEOF(*(pos)), member); &pos->member != (head); \
|
||||
+ pos = container_of(pos->member.next, XRT_TYPEOF(*(pos), member))
|
||||
+
|
||||
+#define XRT_LIST_FOR_EACH_SAFE(pos, tmp, head, member) \
|
||||
+ for (pos = container_of((head)->next, XRT_TYPEOF(*(pos)), member), \
|
||||
+ tmp = container_of((pos)->member.next, XRT_TYPEOF(*(tmp)), member); \
|
||||
+ &pos->member != (head); pos = tmp, tmp = container_of(pos->member.next, XRT_TYPEOF(*(tmp)), member))
|
||||
+
|
||||
+#define XRT_LIST_FOR_EACH_REVERSE(pos, head, member) \
|
||||
+ for (pos = container_of((head)->prev, XRT_TYPEOF(*(pos)), member); &pos->member != (head); \
|
||||
+ pos = container_of(pos->member.prev, XRT_TYPEOF(*(pos)), member))
|
||||
+
|
||||
+#define XRT_LIST_FOR_EACH_REVERSE_SAFE(pos, tmp, head, member) \
|
||||
+ for (pos = container_of((head)->prev, XRT_TYPEOF(*(pos)), member), \
|
||||
+ tmp = container_of((pos)->member.prev, XRT_TYPEOF(*(tmp)), member); \
|
||||
+ &pos->member != (head); pos = tmp, tmp = container_of(pos->member.prev, XRT_TYPEOF(*(tmp)), member))
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+} // extern "C"
|
||||
+#endif
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 61a77c13ae26ddcf2eeee7394e8022182e07167d Mon Sep 17 00:00:00 2001
|
||||
From: Simon Zeni <simon.zeni@collabora.com>
|
||||
Date: Wed, 3 Sep 2025 11:41:06 -0400
|
||||
Subject: [PATCH 2/4] xrt: introduce xrt_signal
|
||||
|
||||
---
|
||||
src/xrt/include/xrt/xrt_signal.h | 61 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 61 insertions(+)
|
||||
create mode 100644 src/xrt/include/xrt/xrt_signal.h
|
||||
|
||||
diff --git a/src/xrt/include/xrt/xrt_signal.h b/src/xrt/include/xrt/xrt_signal.h
|
||||
new file mode 100644
|
||||
index 000000000..ebd86bf6f
|
||||
--- /dev/null
|
||||
+++ b/src/xrt/include/xrt/xrt_signal.h
|
||||
@@ -0,0 +1,61 @@
|
||||
+// Copyright 2025, Collabora, Ltd.
|
||||
+// SPDX-License-Identifier: BSL-1.0
|
||||
+/*!
|
||||
+ * @file
|
||||
+ * @brief Source of an observable event
|
||||
+ * @author Simon Zeni <simon.zeni@collabora.com>
|
||||
+ * @ingroup xrt_iface
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "xrt/xrt_list.h"
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+struct xrt_listener;
|
||||
+
|
||||
+typedef void (*xrt_listener_notify_fn)(struct xrt_listener *listener, void *data);
|
||||
+
|
||||
+struct xrt_listener
|
||||
+{
|
||||
+ //! Part of xrt_signal::listeners
|
||||
+ struct xrt_list link;
|
||||
+
|
||||
+ //! Callback function
|
||||
+ xrt_listener_notify_fn notify;
|
||||
+};
|
||||
+
|
||||
+struct xrt_signal
|
||||
+{
|
||||
+ //! Contains xrt_listener
|
||||
+ struct xrt_list listeners;
|
||||
+};
|
||||
+
|
||||
+static inline void
|
||||
+xrt_signal_init(struct xrt_signal *signal)
|
||||
+{
|
||||
+ xrt_list_init(&signal->listeners);
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+xrt_signal_register(struct xrt_signal *signal, struct xrt_listener *listener)
|
||||
+{
|
||||
+ xrt_list_insert(signal->listeners.prev, &listener->link);
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+xrt_signal_emit(const struct xrt_signal *signal, void *data)
|
||||
+{
|
||||
+ struct xrt_listener *listener, *tmp;
|
||||
+ XRT_LIST_FOR_EACH_SAFE(listener, tmp, &signal->listeners, link)
|
||||
+ {
|
||||
+ listener->notify(listener, data);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+} // extern "C"
|
||||
+#endif
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From a487ba3906e2be9cfe06cd51ab8aa91b7c61c31e Mon Sep 17 00:00:00 2001
|
||||
From: Simon Zeni <simon.zeni@collabora.com>
|
||||
Date: Thu, 4 Sep 2025 11:51:28 -0400
|
||||
Subject: [PATCH 3/4] xrt: xrt: add destroy event to xrt_device
|
||||
|
||||
---
|
||||
src/xrt/include/xrt/xrt_device.h | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h
|
||||
index 15a46207a..ddc9e8434 100644
|
||||
--- a/src/xrt/include/xrt/xrt_device.h
|
||||
+++ b/src/xrt/include/xrt/xrt_device.h
|
||||
@@ -1,4 +1,4 @@
|
||||
-// Copyright 2019-2024, Collabora, Ltd.
|
||||
+// Copyright 2019-2025, Collabora, Ltd.
|
||||
// Copyright 2024-2025, NVIDIA CORPORATION.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
@@ -13,9 +13,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "xrt/xrt_defines.h"
|
||||
+#include "xrt/xrt_limits.h"
|
||||
#include "xrt/xrt_plane_detector.h"
|
||||
+#include "xrt/xrt_signal.h"
|
||||
#include "xrt/xrt_visibility_mask.h"
|
||||
-#include "xrt/xrt_limits.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -314,6 +315,13 @@ struct xrt_device
|
||||
//! What features/functions/things does this device supports?
|
||||
struct xrt_device_supported supported;
|
||||
|
||||
+ //! Signals emitted by the device
|
||||
+ struct
|
||||
+ {
|
||||
+ //! Emitted on xrt_device_destroy
|
||||
+ struct xrt_signal destroy;
|
||||
+ } events;
|
||||
+
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -1062,6 +1070,9 @@ xrt_device_destroy(struct xrt_device **xdev_ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
+ xrt_signal_emit(&xdev->events.destroy, NULL);
|
||||
+ assert(xrt_list_empty(&xdev->events.destroy.listeners));
|
||||
+
|
||||
xdev->destroy(xdev);
|
||||
*xdev_ptr = NULL;
|
||||
}
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From ac3996d3cc6bb9b0ade862654166bc232096c65b Mon Sep 17 00:00:00 2001
|
||||
From: Simon Zeni <simon.zeni@collabora.com>
|
||||
Date: Thu, 4 Sep 2025 11:54:58 -0400
|
||||
Subject: [PATCH 4/4] xrt: add xrt_device_init function
|
||||
|
||||
---
|
||||
src/xrt/auxiliary/util/u_device.c | 2 ++
|
||||
src/xrt/include/xrt/xrt_device.h | 11 +++++++++++
|
||||
tests/tests_cxx_wrappers.cpp | 1 +
|
||||
3 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/xrt/auxiliary/util/u_device.c b/src/xrt/auxiliary/util/u_device.c
|
||||
index 748adcfe3..21a6d3db4 100644
|
||||
--- a/src/xrt/auxiliary/util/u_device.c
|
||||
+++ b/src/xrt/auxiliary/util/u_device.c
|
||||
@@ -326,6 +326,8 @@ u_device_allocate(enum u_device_alloc_flags flags, size_t size, size_t input_cou
|
||||
snprintf(xdev->tracking_origin->name, XRT_TRACKING_NAME_LEN, "%s", "No tracking");
|
||||
}
|
||||
|
||||
+ xrt_device_init(xdev);
|
||||
+
|
||||
return xdev;
|
||||
}
|
||||
|
||||
diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h
|
||||
index ddc9e8434..065a5e881 100644
|
||||
--- a/src/xrt/include/xrt/xrt_device.h
|
||||
+++ b/src/xrt/include/xrt/xrt_device.h
|
||||
@@ -697,6 +697,17 @@ struct xrt_device
|
||||
// Add new functions above destroy.
|
||||
};
|
||||
|
||||
+/*!
|
||||
+ * Initializes the common fields of a @ref xrt_device
|
||||
+ *
|
||||
+ * @public @memberof xrt_device
|
||||
+ */
|
||||
+static inline void
|
||||
+xrt_device_init(struct xrt_device *xdev)
|
||||
+{
|
||||
+ xrt_signal_init(&xdev->events.destroy);
|
||||
+}
|
||||
+
|
||||
/*!
|
||||
* Helper function for @ref xrt_device::update_inputs.
|
||||
*
|
||||
diff --git a/tests/tests_cxx_wrappers.cpp b/tests/tests_cxx_wrappers.cpp
|
||||
index 7dd36b6af..408975795 100644
|
||||
--- a/tests/tests_cxx_wrappers.cpp
|
||||
+++ b/tests/tests_cxx_wrappers.cpp
|
||||
@@ -21,6 +21,7 @@ struct silly_device
|
||||
silly_device(bool &destroyed_) : destroyed(&destroyed_)
|
||||
{
|
||||
base.destroy = [](xrt_device *xdev) { delete reinterpret_cast<silly_device *>(xdev); };
|
||||
+ xrt_device_init(&base);
|
||||
}
|
||||
~silly_device()
|
||||
{
|
||||
--
|
||||
2.51.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,561 @@
|
||||
From 0ad51126916a6488310340a1e55927a891cabe23 Mon Sep 17 00:00:00 2001
|
||||
From: rcelyte <rcelyte@battletrains.org>
|
||||
Date: Mon, 15 Sep 2025 22:46:15 +0000
|
||||
Subject: [PATCH 5/5] d/solarxr: Feed device poses to server
|
||||
|
||||
---
|
||||
src/xrt/drivers/CMakeLists.txt | 2 +
|
||||
src/xrt/drivers/solarxr/feeder.c | 316 ++++++++++++++++++++
|
||||
src/xrt/drivers/solarxr/feeder.h | 62 ++++
|
||||
src/xrt/drivers/solarxr/solarxr_device.c | 54 +++-
|
||||
src/xrt/drivers/solarxr/solarxr_interface.h | 3 +
|
||||
5 files changed, 431 insertions(+), 6 deletions(-)
|
||||
create mode 100644 src/xrt/drivers/solarxr/feeder.c
|
||||
create mode 100644 src/xrt/drivers/solarxr/feeder.h
|
||||
|
||||
diff --git a/src/xrt/drivers/CMakeLists.txt b/src/xrt/drivers/CMakeLists.txt
|
||||
index 2e2124f52..a41d25117 100644
|
||||
--- a/src/xrt/drivers/CMakeLists.txt
|
||||
+++ b/src/xrt/drivers/CMakeLists.txt
|
||||
@@ -513,6 +513,8 @@ endif()
|
||||
if(XRT_BUILD_DRIVER_SOLARXR)
|
||||
add_library(
|
||||
drv_solarxr STATIC
|
||||
+ solarxr/feeder.c
|
||||
+ solarxr/feeder.h
|
||||
solarxr/protocol.c
|
||||
solarxr/protocol.h
|
||||
solarxr/solarxr_device.c
|
||||
diff --git a/src/xrt/drivers/solarxr/feeder.c b/src/xrt/drivers/solarxr/feeder.c
|
||||
new file mode 100644
|
||||
index 000000000..344c0860f
|
||||
--- /dev/null
|
||||
+++ b/src/xrt/drivers/solarxr/feeder.c
|
||||
@@ -0,0 +1,316 @@
|
||||
+// Copyright 2025, rcelyte
|
||||
+// SPDX-License-Identifier: BSL-1.0
|
||||
+/*!
|
||||
+ * @file
|
||||
+ * @brief SolarXR pose feeder
|
||||
+ * @ingroup drv_solarxr
|
||||
+ */
|
||||
+
|
||||
+#include "feeder.h"
|
||||
+#include "solarxr_ipc_message.h"
|
||||
+
|
||||
+#include "xrt/xrt_device.h"
|
||||
+
|
||||
+#include <math.h>
|
||||
+
|
||||
+#define PROTOBUF_FLOAT(v_) ((uint8_t *)&(v_))[0], ((uint8_t *)&(v_))[1], ((uint8_t *)&(v_))[2], ((uint8_t *)&(v_))[3]
|
||||
+#define PROTOBUF_INT32(v_) \
|
||||
+ (uint8_t)(0x80 | (uint32_t)(v_)), (uint8_t)(0x80 | (uint32_t)(v_) >> 7), \
|
||||
+ (uint8_t)(0x80 | (uint32_t)(v_) >> 14), (uint8_t)(0x80 | (uint32_t)(v_) >> 21), (uint32_t)(v_) >> 28
|
||||
+
|
||||
+struct feeder_device
|
||||
+{
|
||||
+ struct xrt_listener base;
|
||||
+ struct xrt_device *xdev; // weak reference
|
||||
+ struct feeder *feeder;
|
||||
+ enum xrt_input_name input_name;
|
||||
+ uint32_t id;
|
||||
+ uint8_t last_status;
|
||||
+ bool battery_charging;
|
||||
+ float battery_charge;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+feeder_device_detach(struct xrt_listener *const listener, void *const data)
|
||||
+{
|
||||
+ (void)data;
|
||||
+ struct feeder_device *const device = (struct feeder_device *)listener;
|
||||
+ struct feeder *const feeder = device->feeder;
|
||||
+ os_mutex_lock(&feeder->mutex);
|
||||
+ assert(device->xdev != NULL);
|
||||
+ U_LOG_IFL_D(feeder->socket.log_level, "device \"%.*s\" was destroyed", (unsigned)ARRAY_SIZE(device->xdev->str),
|
||||
+ device->xdev->str);
|
||||
+ device->xdev = NULL;
|
||||
+ xrt_list_remove(&listener->link);
|
||||
+ os_mutex_unlock(&feeder->mutex);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+feeder_send_feedback(struct feeder *const feeder, const timepoint_ns time)
|
||||
+{
|
||||
+ if (!solarxr_ipc_socket_is_connected(&feeder->socket)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // check for errors on the socket
|
||||
+ if (!solarxr_ipc_socket_wait_timeout(&feeder->socket, 0)) {
|
||||
+ U_LOG_IFL_E(feeder->socket.log_level, "connection lost");
|
||||
+ solarxr_ipc_socket_destroy(&feeder->socket);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ os_mutex_lock(&feeder->mutex);
|
||||
+ uint8_t packet[0x10000], *packet_end = packet;
|
||||
+ for (uint32_t i = 0, devices_len = feeder->devices_len; i < devices_len; ++i) {
|
||||
+ struct feeder_device *const device = &feeder->devices[i];
|
||||
+ uint8_t status = 0; // Status::DISCONNECTED
|
||||
+
|
||||
+ if (device->xdev != NULL) {
|
||||
+ // report meaningful changes in battery level
|
||||
+ bool present = false, charging = false;
|
||||
+ float charge = 0;
|
||||
+ if (device->xdev->supported.battery_status &&
|
||||
+ xrt_device_get_battery_status(device->xdev, &present, &charging, &charge) == XRT_SUCCESS &&
|
||||
+ (charging != device->battery_charging || fabsf(charge - device->battery_charge) >= 1e-05)) {
|
||||
+ device->battery_charging = charging;
|
||||
+ device->battery_charge = charge;
|
||||
+ uint8_t message[] = {
|
||||
+ (5 << 3) | 2, 0, // ProtobufMessage::battery
|
||||
+ (1 << 3) | 0, PROTOBUF_INT32(device->id), // Battery::tracker_id
|
||||
+ (2 << 3) | 5, PROTOBUF_FLOAT(charge), // Battery::battery_level
|
||||
+ (3 << 3) | 0, charging, // Battery::is_charging
|
||||
+ };
|
||||
+ message[1] = sizeof(message) - 2;
|
||||
+ solarxr_ipc_message_write_single(&packet_end, &packet[ARRAY_SIZE(packet)], message,
|
||||
+ sizeof(message));
|
||||
+ }
|
||||
+
|
||||
+ // report pose
|
||||
+ struct xrt_space_relation relation = {0};
|
||||
+ assert(device->xdev->get_tracked_pose != NULL);
|
||||
+ if (xrt_device_get_tracked_pose(device->xdev, device->input_name, time, &relation) ==
|
||||
+ XRT_SUCCESS &&
|
||||
+ (relation.relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) != 0) {
|
||||
+ uint8_t message[30 + 15] = {
|
||||
+ (1 << 3) | 2, 0, // ProtobufMessage::position
|
||||
+ (1 << 3) | 0, PROTOBUF_INT32(device->id), // Position::tracker_id
|
||||
+ (5 << 3) | 5, PROTOBUF_FLOAT(relation.pose.orientation.x), // Position::qx
|
||||
+ (6 << 3) | 5, PROTOBUF_FLOAT(relation.pose.orientation.y), // Position::qy
|
||||
+ (7 << 3) | 5, PROTOBUF_FLOAT(relation.pose.orientation.z), // Position::qz
|
||||
+ (8 << 3) | 5, PROTOBUF_FLOAT(relation.pose.orientation.w), // Position::qw
|
||||
+ (9 << 3) | 0, 3, // Position::data_source = DataSource::FULL
|
||||
+ };
|
||||
+ uint32_t message_len = sizeof(message);
|
||||
+ if ((relation.relation_flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) != 0) {
|
||||
+ const uint8_t position[15] = {
|
||||
+ (2 << 3) | 5, PROTOBUF_FLOAT(relation.pose.position.x), // Position::x
|
||||
+ (3 << 3) | 5, PROTOBUF_FLOAT(relation.pose.position.y), // Position::y
|
||||
+ (4 << 3) | 5, PROTOBUF_FLOAT(relation.pose.position.z), // Position::z
|
||||
+ };
|
||||
+ memcpy(&message[sizeof(message) - sizeof(position)], position,
|
||||
+ sizeof(position));
|
||||
+ } else {
|
||||
+ message_len -= 15;
|
||||
+ }
|
||||
+ message[1] = message_len - 2;
|
||||
+ solarxr_ipc_message_write_single(&packet_end, &packet[ARRAY_SIZE(packet)], message,
|
||||
+ message_len);
|
||||
+ if ((relation.relation_flags & XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT) != 0) {
|
||||
+ status = 1; // Status::OK
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // report tracking status
|
||||
+ if (status != device->last_status) {
|
||||
+ device->last_status = status;
|
||||
+ uint8_t message[] = {
|
||||
+ (4 << 3) | 2, 0, // ProtobufMessage::tracker_status
|
||||
+ (1 << 3) | 0, PROTOBUF_INT32(device->id), // TrackerStatus::tracker_id
|
||||
+ (2 << 3) | 0, status, // TrackerStatus::status
|
||||
+ };
|
||||
+ message[1] = sizeof(message) - 2;
|
||||
+ solarxr_ipc_message_write_single(&packet_end, &packet[ARRAY_SIZE(packet)], message,
|
||||
+ sizeof(message));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // flush queued messages to socket
|
||||
+ if (packet_end != packet) {
|
||||
+ solarxr_ipc_socket_send_raw(&feeder->socket, packet, packet_end - packet);
|
||||
+ }
|
||||
+ os_mutex_unlock(&feeder->mutex);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+filter_feeder_device(struct xrt_device *const device)
|
||||
+{
|
||||
+ return device != NULL && device->supported.orientation_tracking;
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+feeder_set_devices(struct feeder *const feeder, struct xrt_device *const devices[const], const uint32_t devices_len)
|
||||
+{
|
||||
+ uint32_t device_count = 0;
|
||||
+ for (uint32_t i = 0; i < devices_len; ++i) {
|
||||
+ device_count += filter_feeder_device(devices[i]);
|
||||
+ }
|
||||
+ os_mutex_lock(&feeder->mutex);
|
||||
+ for (uint32_t i = 0, devices_len = feeder->devices_len; i < devices_len; ++i) {
|
||||
+ // The feeder protocol doesn't define a 'removed' message so
|
||||
+ // the best we can do is the status to `DISCONNECTED`
|
||||
+ if (feeder->devices[i].last_status != 0) {
|
||||
+ uint8_t message[] = {
|
||||
+ [sizeof(struct solarxr_ipc_message)] = (4 << 3) | 2,
|
||||
+ 0, // ProtobufMessage::tracker_status
|
||||
+ (1 << 3) | 0,
|
||||
+ PROTOBUF_INT32(feeder->devices[i].id), // TrackerStatus::tracker_id
|
||||
+ (2 << 3) | 0,
|
||||
+ 0, // TrackerStatus::status = Status::DISCONNECTED
|
||||
+ };
|
||||
+ message[sizeof(struct solarxr_ipc_message) + 1] =
|
||||
+ sizeof(message) - sizeof(struct solarxr_ipc_message) - 2;
|
||||
+ solarxr_ipc_socket_send_raw(&feeder->socket, message,
|
||||
+ solarxr_ipc_message_inline(message, sizeof(message)));
|
||||
+ }
|
||||
+
|
||||
+ // unregister destroy listener
|
||||
+ if (feeder->devices[i].base.link.prev != NULL && feeder->devices[i].base.link.next != NULL) {
|
||||
+ xrt_list_remove(&feeder->devices[i].base.link);
|
||||
+ }
|
||||
+ feeder->devices[i] = (struct feeder_device){0};
|
||||
+ }
|
||||
+
|
||||
+ // ensure IPC connection and device capacity
|
||||
+ struct feeder_device *new_devices = NULL;
|
||||
+ if (device_count != 0 && (solarxr_ipc_socket_is_connected(&feeder->socket) ||
|
||||
+ solarxr_ipc_socket_connect(&feeder->socket, "SlimeVRInput", NULL, 0))) {
|
||||
+ new_devices = realloc(feeder->devices, device_count * sizeof(*new_devices));
|
||||
+ }
|
||||
+
|
||||
+ bool result;
|
||||
+ if (new_devices == NULL) {
|
||||
+ U_LOG_IFL_D(feeder->socket.log_level, "Clearing SolarXR feeder list");
|
||||
+ free(feeder->devices);
|
||||
+ feeder->devices = NULL;
|
||||
+ feeder->devices_len = 0;
|
||||
+ result = device_count == 0;
|
||||
+ } else {
|
||||
+ U_LOG_IFL_D(feeder->socket.log_level, "Setting SolarXR feeder xdevs:");
|
||||
+ feeder->devices = new_devices;
|
||||
+ feeder->devices_len = device_count;
|
||||
+ for (uint32_t i = 0; i < devices_len; ++i) {
|
||||
+ // must match condition used to compute `device_count`
|
||||
+ if (!filter_feeder_device(devices[i])) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // find a suitable pose input to report
|
||||
+ enum xrt_input_name input_name = XRT_INPUT_GENERIC_TRACKER_POSE;
|
||||
+ for (size_t input = 0, input_count = devices[i]->input_count; input < input_count; ++input) {
|
||||
+ if (XRT_GET_INPUT_TYPE(devices[i]->inputs[input].name) == XRT_INPUT_TYPE_POSE) {
|
||||
+ input_name = devices[i]->inputs[input].name;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ uint8_t role = 0;
|
||||
+ const char *role_name = "NONE";
|
||||
+ switch (devices[i]->device_type) {
|
||||
+ case XRT_DEVICE_TYPE_HMD: {
|
||||
+ role = 19;
|
||||
+ role_name = "HMD";
|
||||
+ } break;
|
||||
+ case XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER: {
|
||||
+ role = 14;
|
||||
+ role_name = "RIGHT_CONTROLLER";
|
||||
+ } break;
|
||||
+ case XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER: {
|
||||
+ role = 13;
|
||||
+ role_name = "LEFT_CONTROLLER";
|
||||
+ } break;
|
||||
+ case XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER: {
|
||||
+ role = 21;
|
||||
+ role_name = "GENERIC_CONTROLLER";
|
||||
+ } break;
|
||||
+ default:;
|
||||
+ }
|
||||
+
|
||||
+ // initialize state for the device
|
||||
+ assert(new_devices - feeder->devices < feeder->devices_len);
|
||||
+ const uint32_t id = feeder->next_id++;
|
||||
+ *new_devices = (struct feeder_device){
|
||||
+ .base.notify = feeder_device_detach,
|
||||
+ .xdev = devices[i],
|
||||
+ .feeder = feeder,
|
||||
+ .input_name = input_name,
|
||||
+ .id = id,
|
||||
+ .last_status = UINT8_MAX,
|
||||
+ };
|
||||
+
|
||||
+ // listen for destroy so we can safely clean up references to the xdev
|
||||
+ xrt_signal_register(&devices[i]->events.destroy, &new_devices->base);
|
||||
+
|
||||
+ // advance head
|
||||
+ ++new_devices;
|
||||
+
|
||||
+ // announce the new tracker
|
||||
+ const uint32_t serial_len = strlen(devices[i]->serial), name_len = strlen(devices[i]->str);
|
||||
+ const uint8_t message_1[] = {
|
||||
+ (3 << 3) | 2, PROTOBUF_INT32(0), // ProtobufMessage::tracker_added
|
||||
+ (1 << 3) | 0, PROTOBUF_INT32(id), // TrackerAdded::tracker_id
|
||||
+ (4 << 3) | 0, role, // TrackerAdded::tracker_role
|
||||
+ (2 << 3) | 2, PROTOBUF_INT32(serial_len),
|
||||
+ };
|
||||
+ const uint8_t message_2[] = {
|
||||
+ (3 << 3) | 2,
|
||||
+ PROTOBUF_INT32(name_len),
|
||||
+ };
|
||||
+ uint8_t packet[sizeof(struct solarxr_ipc_message) + sizeof(message_1) +
|
||||
+ sizeof(devices[i]->serial) + sizeof(message_2) + sizeof(devices[i]->str)];
|
||||
+ struct solarxr_ipc_message *const message =
|
||||
+ solarxr_ipc_message_start(packet, &packet[ARRAY_SIZE(packet)]);
|
||||
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)], message_1, sizeof(message_1));
|
||||
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)],
|
||||
+ (const uint8_t *)devices[i]->serial,
|
||||
+ serial_len); // TrackerAdded::tracker_serial
|
||||
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)], message_2, sizeof(message_2));
|
||||
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)],
|
||||
+ (const uint8_t *)devices[i]->str,
|
||||
+ name_len); // TrackerAdded::tracker_name
|
||||
+ const uint32_t packet_len = solarxr_ipc_message_end(message, &(uint8_t *){packet});
|
||||
+ if (packet_len == 0) {
|
||||
+ U_LOG_IFL_E(feeder->socket.log_level, "solarxr_ipc_message_end() failed");
|
||||
+ assert(false);
|
||||
+ continue;
|
||||
+ }
|
||||
+ const uint8_t tracker_added[] = {
|
||||
+ PROTOBUF_INT32(packet_len - sizeof(*message) - sizeof((uint8_t[]){0, PROTOBUF_INT32(0)})),
|
||||
+ };
|
||||
+ memcpy(&message->body[1], tracker_added, sizeof(tracker_added));
|
||||
+ solarxr_ipc_socket_send_raw(&feeder->socket, packet, packet_len);
|
||||
+ U_LOG_IFL_D(feeder->socket.log_level,
|
||||
+ " \"%s\" [id=%" PRIu32 " serial=\"%s\" role=TrackerRole::%s]", devices[i]->str,
|
||||
+ id, devices[i]->serial, role_name);
|
||||
+ }
|
||||
+ assert(new_devices - feeder->devices == feeder->devices_len);
|
||||
+ result = true;
|
||||
+ }
|
||||
+ os_mutex_unlock(&feeder->mutex);
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+feeder_init(struct feeder *const feeder, const enum u_logging_level log_level)
|
||||
+{
|
||||
+ solarxr_ipc_socket_init(&feeder->socket, log_level);
|
||||
+ return os_mutex_init(&feeder->mutex) == 0;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+feeder_fini(struct feeder *const feeder)
|
||||
+{
|
||||
+ feeder_set_devices(feeder, NULL, 0);
|
||||
+ os_mutex_destroy(&feeder->mutex);
|
||||
+ solarxr_ipc_socket_destroy(&feeder->socket);
|
||||
+}
|
||||
diff --git a/src/xrt/drivers/solarxr/feeder.h b/src/xrt/drivers/solarxr/feeder.h
|
||||
new file mode 100644
|
||||
index 000000000..9e849055e
|
||||
--- /dev/null
|
||||
+++ b/src/xrt/drivers/solarxr/feeder.h
|
||||
@@ -0,0 +1,62 @@
|
||||
+// Copyright 2025, rcelyte
|
||||
+// SPDX-License-Identifier: BSL-1.0
|
||||
+/*!
|
||||
+ * @file
|
||||
+ * @brief SolarXR pose feeder
|
||||
+ * @ingroup drv_solarxr
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+#include "solarxr_ipc_socket.h"
|
||||
+
|
||||
+#include "os/os_threading.h"
|
||||
+
|
||||
+/*!
|
||||
+ * Object that observes a collection of @ref xrt_device objects,
|
||||
+ * reporting their poses and status to a SolarXR server over IPC
|
||||
+ * @ingroup drv_solarxr
|
||||
+ */
|
||||
+struct feeder_device;
|
||||
+struct feeder
|
||||
+{
|
||||
+ struct os_mutex mutex;
|
||||
+ struct solarxr_ipc_socket socket;
|
||||
+ uint32_t next_id;
|
||||
+ uint32_t devices_len;
|
||||
+ struct feeder_device *devices;
|
||||
+};
|
||||
+
|
||||
+bool
|
||||
+feeder_init(struct feeder *feeder, enum u_logging_level log_level);
|
||||
+
|
||||
+void
|
||||
+feeder_fini(struct feeder *feeder);
|
||||
+
|
||||
+/*!
|
||||
+ * Poll all observed xdevs and
|
||||
+ *
|
||||
+ * Holds the mutex during most of the operation.
|
||||
+ *
|
||||
+ * @param feeder self
|
||||
+ * @param time Timestamp used to query device poses
|
||||
+ *
|
||||
+ * @public @memberof feeder
|
||||
+ */
|
||||
+void
|
||||
+feeder_send_feedback(struct feeder *feeder, timepoint_ns time); // thread safe
|
||||
+
|
||||
+/*!
|
||||
+ * Set the list of devices to observe and announce them to the server
|
||||
+ *
|
||||
+ * Holds the mutex during most of the operation.
|
||||
+ *
|
||||
+ * @param feeder self
|
||||
+ * @param devices array of devices
|
||||
+ * @param devices_len size of @p devices
|
||||
+ *
|
||||
+ * @return true on success.
|
||||
+ *
|
||||
+ * @public @memberof feeder
|
||||
+ */
|
||||
+bool
|
||||
+feeder_set_devices(struct feeder *feeder, struct xrt_device *const devices[], uint32_t devices_len); // thread safe
|
||||
diff --git a/src/xrt/drivers/solarxr/solarxr_device.c b/src/xrt/drivers/solarxr/solarxr_device.c
|
||||
index 77ebdb20b..c5bb56f78 100644
|
||||
--- a/src/xrt/drivers/solarxr/solarxr_device.c
|
||||
+++ b/src/xrt/drivers/solarxr/solarxr_device.c
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include "solarxr_interface.h"
|
||||
+#include "feeder.h"
|
||||
#include "protocol.h"
|
||||
#include "solarxr_ipc_message.h"
|
||||
#include "solarxr_ipc_socket.h"
|
||||
@@ -41,9 +42,10 @@ struct solarxr_generic_tracker
|
||||
struct solarxr_device
|
||||
{
|
||||
struct xrt_device base;
|
||||
+ struct feeder feeder;
|
||||
struct os_thread thread;
|
||||
struct solarxr_ipc_socket socket;
|
||||
- _Atomic(timepoint_ns) next_sync;
|
||||
+ _Atomic(timepoint_ns) last_feedback, next_sync;
|
||||
struct os_mutex mutex;
|
||||
_Atomic(timepoint_ns) timestamp;
|
||||
_Atomic(uint64_t) enabled_bones;
|
||||
@@ -271,6 +273,8 @@ solarxr_device_sync(struct solarxr_device *const device)
|
||||
},
|
||||
};
|
||||
|
||||
+ atomic_store(&device->last_feedback, time);
|
||||
+ feeder_send_feedback(&device->feeder, time);
|
||||
solarxr_ipc_socket_send_raw(
|
||||
&device->socket, (const uint8_t *)&poll_packet,
|
||||
solarxr_ipc_message_inline((uint8_t *)&poll_packet,
|
||||
@@ -515,14 +519,26 @@ solarxr_device_handle_trackers(struct solarxr_device *const device,
|
||||
}
|
||||
|
||||
static struct span
|
||||
-solarxr_device_receive_blocking(struct solarxr_device *const device)
|
||||
+solarxr_device_receive_blocking(struct solarxr_device *const device, const bool do_feedback)
|
||||
{
|
||||
+ const time_duration_ns timeout = debug_get_num_option_solarxr_sync_timeout_ms() * U_TIME_1MS_IN_NS;
|
||||
+ time_duration_ns time_since_feedback = 0;
|
||||
do {
|
||||
+ if (do_feedback) {
|
||||
+ const timepoint_ns time = os_monotonic_get_ns();
|
||||
+ time_since_feedback = time - atomic_load(&device->last_feedback);
|
||||
+ if (time_since_feedback > timeout) {
|
||||
+ // ensures tracker poses are updated even when no XR app is polling them
|
||||
+ atomic_store(&device->last_feedback, time);
|
||||
+ feeder_send_feedback(&device->feeder, time);
|
||||
+ time_since_feedback = 0;
|
||||
+ }
|
||||
+ }
|
||||
const uint32_t buffer_len = solarxr_ipc_socket_receive(&device->socket);
|
||||
if (buffer_len != 0) {
|
||||
return (struct span){buffer_len, device->socket.buffer};
|
||||
}
|
||||
- } while (solarxr_ipc_socket_wait_timeout(&device->socket, -1));
|
||||
+ } while (solarxr_ipc_socket_wait_timeout(&device->socket, do_feedback ? timeout - time_since_feedback : -1));
|
||||
return (struct span){0};
|
||||
}
|
||||
|
||||
@@ -530,7 +546,7 @@ static void *
|
||||
solarxr_network_thread(void *const ptr)
|
||||
{
|
||||
struct solarxr_device *const device = (struct solarxr_device *)ptr;
|
||||
- for (struct span buffer; (buffer = solarxr_device_receive_blocking(device)).length != 0;) {
|
||||
+ for (struct span buffer; (buffer = solarxr_device_receive_blocking(device, true)).length != 0;) {
|
||||
struct solarxr_message_bundle bundle;
|
||||
if (!read_solarxr_message_bundle(&bundle, buffer.data, buffer.length,
|
||||
(const solarxr_message_bundle_t *)buffer.data)) {
|
||||
@@ -715,6 +731,7 @@ solarxr_device_destroy(struct xrt_device *xdev)
|
||||
os_thread_join(&device->thread);
|
||||
os_thread_destroy(&device->thread);
|
||||
}
|
||||
+ feeder_fini(&device->feeder);
|
||||
for (size_t i = 0; i < ARRAY_SIZE(device->trackers); ++i) {
|
||||
m_relation_history_destroy(&device->trackers[i]);
|
||||
}
|
||||
@@ -810,7 +827,8 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
|
||||
struct solarxr_generic_tracker *trackers[MAX_GENERIC_TRACKERS];
|
||||
|
||||
// `solarxr_device_destroy()` asserts unless both have attempted initialization
|
||||
- if (os_mutex_init(&device->mutex) != 0) {
|
||||
+ if (((int)!feeder_init(&device->feeder, debug_get_log_option_solarxr_log()) | os_mutex_init(&device->mutex)) !=
|
||||
+ 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -1044,7 +1062,7 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
|
||||
}
|
||||
|
||||
if (use_trackers) {
|
||||
- const struct span buffer = solarxr_device_receive_blocking(device);
|
||||
+ const struct span buffer = solarxr_device_receive_blocking(device, false);
|
||||
if (buffer.length == 0) {
|
||||
U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "solarxr_ipc_socket_receive() failed");
|
||||
goto fail;
|
||||
@@ -1174,3 +1192,27 @@ fail:
|
||||
solarxr_device_destroy(&device->base);
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+bool
|
||||
+solarxr_device_set_feeder_devices(struct xrt_device *const device,
|
||||
+ struct xrt_device *const xdevs[const],
|
||||
+ const uint32_t xdev_count)
|
||||
+{
|
||||
+ struct solarxr_device *const solarxr = solarxr_device(device);
|
||||
+ if (solarxr == NULL) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ uint32_t filtered_xdevs_len = 0;
|
||||
+ struct xrt_device *filtered_xdevs[XRT_SYSTEM_MAX_DEVICES];
|
||||
+ for (uint32_t i = 0; i < xdev_count; ++i) {
|
||||
+ if (xdevs[i] == device || solarxr_generic_tracker(xdevs[i]) != NULL) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (filtered_xdevs_len >= ARRAY_SIZE(filtered_xdevs)) {
|
||||
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "too many feeder devices");
|
||||
+ return false;
|
||||
+ }
|
||||
+ filtered_xdevs[filtered_xdevs_len++] = xdevs[i];
|
||||
+ }
|
||||
+ return feeder_set_devices(&solarxr->feeder, filtered_xdevs, filtered_xdevs_len);
|
||||
+}
|
||||
diff --git a/src/xrt/drivers/solarxr/solarxr_interface.h b/src/xrt/drivers/solarxr/solarxr_interface.h
|
||||
index c56bb15b1..15916484f 100644
|
||||
--- a/src/xrt/drivers/solarxr/solarxr_interface.h
|
||||
+++ b/src/xrt/drivers/solarxr/solarxr_interface.h
|
||||
@@ -31,6 +31,9 @@ solarxr_device_create(struct xrt_tracking_origin *const tracking_origin)
|
||||
return out;
|
||||
}
|
||||
|
||||
+bool
|
||||
+solarxr_device_set_feeder_devices(struct xrt_device *solarxr, struct xrt_device *const xdevs[], uint32_t xdev_count);
|
||||
+
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
From a0c03b2f602311a8c4299e250ecb64be9528194b Mon Sep 17 00:00:00 2001
|
||||
From: rcelyte <rcelyte@battletrains.org>
|
||||
Date: Fri, 23 Aug 2024 20:54:53 +0000
|
||||
Subject: [PATCH] t/common: Load SolarXR driver
|
||||
|
||||
---
|
||||
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 b390af901..fc60c869c 100644
|
||||
--- a/src/xrt/drivers/qwerty/qwerty_device.c
|
||||
+++ b/src/xrt/drivers/qwerty/qwerty_device.c
|
||||
@@ -317,6 +317,8 @@ qwerty_hmd_create(void)
|
||||
|
||||
xd->inputs[0].name = XRT_INPUT_GENERIC_HEAD_POSE;
|
||||
|
||||
+ xd->supported.orientation_tracking = true;
|
||||
+ xd->supported.position_tracking = true;
|
||||
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;
|
||||
@@ -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);
|
||||
|
||||
+ xd->supported.orientation_tracking = true;
|
||||
+ xd->supported.position_tracking = true;
|
||||
xd->update_inputs = qwerty_update_inputs;
|
||||
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 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 @@
|
||||
#include "opengloves/opengloves_interface.h"
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#if defined(XRT_BUILD_DRIVER_SURVIVE)
|
||||
#define DEFAULT_DRIVER "survive"
|
||||
#else
|
||||
@@ -740,6 +744,16 @@ end_valve_index:
|
||||
try_add_opengloves(left, right, &unobstructed_left_ht, &unobstructed_right_ht);
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count = solarxr_device_create_xdevs(head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ 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->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
// Assign to role(s).
|
||||
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 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 @@
|
||||
|
||||
#include "qwerty/qwerty_interface.h"
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -100,6 +104,16 @@ qwerty_open_system_impl(struct xrt_builder *xb,
|
||||
ubrh->left = left;
|
||||
ubrh->right = right;
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count = solarxr_device_create_xdevs(head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ 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->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/src/xrt/targets/common/target_builder_rift_s.c b/src/xrt/targets/common/target_builder_rift_s.c
|
||||
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 @@
|
||||
#include "ht_ctrl_emu/ht_ctrl_emu_interface.h"
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#include "rift_s/rift_s_interface.h"
|
||||
#include "rift_s/rift_s.h"
|
||||
|
||||
@@ -200,6 +204,17 @@ rift_s_open_system_impl(struct xrt_builder *xb,
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count =
|
||||
+ solarxr_device_create_xdevs((hmd_xdev != NULL) ? hmd_xdev->tracking_origin : NULL,
|
||||
+ &xsysd->xdevs[xsysd->xdev_count], ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ 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->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
// Assign to role(s).
|
||||
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 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 @@
|
||||
#include "xrt/xrt_space.h"
|
||||
#include "util/u_space_overseer.h"
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#ifndef XRT_BUILD_DRIVER_STEAMVR_LIGHTHOUSE
|
||||
#error "This builder requires the SteamVR Lighthouse driver"
|
||||
#endif
|
||||
@@ -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 =
|
||||
+ solarxr_device_create_xdevs(xsysd->static_roles.head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ 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->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Space overseer.
|
||||
*/
|
||||
diff --git a/src/xrt/targets/common/target_builder_wmr.c b/src/xrt/targets/common/target_builder_wmr.c
|
||||
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 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+#include "solarxr/solarxr_interface.h"
|
||||
+#endif
|
||||
+
|
||||
#ifndef XRT_BUILD_DRIVER_WMR
|
||||
#error "Must only be built with XRT_BUILD_DRIVER_WMR set"
|
||||
#endif
|
||||
@@ -296,6 +300,16 @@ wmr_open_system_impl(struct xrt_builder *xb,
|
||||
right = ht_right;
|
||||
}
|
||||
|
||||
+#ifdef XRT_BUILD_DRIVER_SOLARXR
|
||||
+ const uint32_t count = solarxr_device_create_xdevs(head->tracking_origin, &xsysd->xdevs[xsysd->xdev_count],
|
||||
+ ARRAY_SIZE(xsysd->xdevs) - xsysd->xdev_count);
|
||||
+ 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->xdev_count += count;
|
||||
+#endif
|
||||
+
|
||||
|
||||
// Assign to role(s).
|
||||
ubrh->head = head;
|
||||
--
|
||||
2.50.1
|
||||
@@ -33,6 +33,7 @@ set(XRT_FEATURE_WINDOW_PEEK OFF)
|
||||
set(XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY ON)
|
||||
set(XRT_FEATURE_RENDERDOC ${WIVRN_FEATURE_RENDERDOC})
|
||||
|
||||
set(XRT_FEATURE_OPENXR_BODY_TRACKING_FB ON)
|
||||
set(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB ON)
|
||||
set(XRT_FEATURE_OPENXR_FACIAL_TRACKING_HTC ON)
|
||||
set(XRT_FEATURE_OPENXR_HAND_TRACKING_EXT ON)
|
||||
|
||||
@@ -57,7 +57,7 @@ std::filesystem::path active_runtime::openvr_compat_path()
|
||||
std::optional<std::filesystem::path> flatpak_root = flatpak_key(flatpak::section::instance, "app-path");
|
||||
// flatpak default
|
||||
if (flatpak_root)
|
||||
return *flatpak_root / "xrizer";
|
||||
return *flatpak_root / "OpenComposite";
|
||||
|
||||
for (auto path: std::ranges::split_view(std::string_view(OVR_COMPAT_SEARCH_PATH), std::string_view(":")))
|
||||
{
|
||||
|
||||
@@ -533,6 +533,8 @@ wivrn_controller::wivrn_controller(int hand_id,
|
||||
inputs_array(input_count, xrt_input{}),
|
||||
cnx(cnx)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
|
||||
inputs = inputs_array.data();
|
||||
|
||||
// Setup input.
|
||||
|
||||
@@ -57,6 +57,7 @@ wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd) :
|
||||
},
|
||||
gaze(device_id::EYE_GAZE)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
}
|
||||
|
||||
xrt_result_t wivrn_eye_tracker::update_inputs()
|
||||
|
||||
@@ -60,6 +60,7 @@ wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd,
|
||||
},
|
||||
cnx(cnx)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
}
|
||||
|
||||
xrt_result_t wivrn_fb_face2_tracker::update_inputs()
|
||||
|
||||
@@ -124,6 +124,8 @@ wivrn_generic_tracker::wivrn_generic_tracker(int index, xrt_device * hmd, wivrn_
|
||||
cnx(cnx),
|
||||
index(index)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
|
||||
auto unique_name = std::format("WiVRn Generic Tracker #{}", index + 1);
|
||||
strlcpy(str, unique_name.c_str(), std::size(str));
|
||||
auto unique_serial = std::format("wivrn-{}", index + 1);
|
||||
|
||||
@@ -198,6 +198,8 @@ wivrn_hand_interaction::wivrn_hand_interaction(int hand_id,
|
||||
inputs_array(input_count, xrt_input{}),
|
||||
cnx(cnx)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
|
||||
inputs = inputs_array.data();
|
||||
|
||||
// Setup input.
|
||||
|
||||
@@ -88,6 +88,8 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
|
||||
},
|
||||
cnx(cnx)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
|
||||
const auto config = configuration();
|
||||
|
||||
auto eye_width = info.recommended_eye_width;
|
||||
|
||||
@@ -42,13 +42,6 @@ class wivrn_hmd : public xrt_device
|
||||
.name = XRT_INPUT_GENERIC_HEAD_POSE,
|
||||
};
|
||||
xrt_hmd_parts hmd_parts{};
|
||||
xrt_tracking_origin tracking_origin{
|
||||
.name = "WiVRn origin",
|
||||
.type = XRT_TRACKING_TYPE_OTHER,
|
||||
.initial_offset = {
|
||||
.orientation = {0, 0, 0, 1},
|
||||
},
|
||||
};
|
||||
|
||||
view_list views;
|
||||
from_headset::battery battery{};
|
||||
@@ -66,6 +59,15 @@ class wivrn_hmd : public xrt_device
|
||||
|
||||
public:
|
||||
using base = xrt_device;
|
||||
|
||||
xrt_tracking_origin tracking_origin{
|
||||
.name = "WiVRn origin",
|
||||
.type = XRT_TRACKING_TYPE_OTHER,
|
||||
.initial_offset = {
|
||||
.orientation = {0, 0, 0, 1},
|
||||
},
|
||||
};
|
||||
|
||||
wivrn_hmd(wivrn::wivrn_session * cnx,
|
||||
const from_headset::headset_info_packet & info);
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ wivrn_htc_face_tracker::wivrn_htc_face_tracker(xrt_device * hmd,
|
||||
},
|
||||
cnx(cnx)
|
||||
{
|
||||
xrt_device_init(static_cast<xrt_device *>(this));
|
||||
|
||||
inputs = inputs_array.data();
|
||||
input_count = inputs_array.size();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#endif
|
||||
|
||||
#if WIVRN_FEATURE_SOLARXR
|
||||
#include "solarxr_device.h"
|
||||
#include "solarxr_interface.h"
|
||||
#endif
|
||||
|
||||
namespace wivrn
|
||||
@@ -269,15 +269,13 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
}
|
||||
|
||||
#if WIVRN_FEATURE_SOLARXR
|
||||
xrt_device * solar_devs[XRT_SYSTEM_MAX_DEVICES];
|
||||
uint32_t solar_devs_cap = XRT_SYSTEM_MAX_DEVICES - xdev_count;
|
||||
uint32_t num_devs = solarxr_device_create_xdevs(&hmd, solar_devs, XRT_SYSTEM_MAX_DEVICES - xdev_count);
|
||||
for (int i = 0; i < num_devs; i++)
|
||||
uint32_t num_devs = solarxr_device_create_xdevs(&hmd.tracking_origin, &xdevs[xdev_count], ARRAY_SIZE(xdevs) - xdev_count);
|
||||
if (num_devs != 0)
|
||||
{
|
||||
xdevs[xdev_count++] = solar_devs[i];
|
||||
if (i == 0)
|
||||
static_roles.body = solar_devs[i];
|
||||
static_roles.body = xdevs[xdev_count];
|
||||
solarxr_device_set_feeder_devices(static_roles.body, xdevs, xdev_count);
|
||||
}
|
||||
xdev_count += num_devs;
|
||||
#endif
|
||||
|
||||
if (roles.left >= 0)
|
||||
@@ -296,6 +294,10 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
|
||||
wivrn_session::~wivrn_session()
|
||||
{
|
||||
#if WIVRN_FEATURE_SOLARXR
|
||||
solarxr_device_set_feeder_devices(static_roles.body, nullptr, 0);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(xdevs); i++)
|
||||
{
|
||||
xrt_device_destroy(&xdevs[i]);
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
WIVRN_CLIENT_POT=$(mktemp)
|
||||
WIVRN_DASHBOARD_POT=$(mktemp)
|
||||
|
||||
xgettext \
|
||||
--c++ --from-code=UTF-8 \
|
||||
--keyword=_:1,1t \
|
||||
--keyword=_S:1,1t \
|
||||
--keyword=_cS:1c,2,2t \
|
||||
--keyword=_F:1,1t \
|
||||
--output=$WIVRN_CLIENT_POT \
|
||||
--package-name=WiVRn \
|
||||
$(find client/ -name "*.cpp" | sort)
|
||||
|
||||
xgettext \
|
||||
--c++ --kde --from-code=UTF-8 \
|
||||
--keyword=i18n:1 \
|
||||
--keyword=i18nc:1c,2 \
|
||||
--keyword=i18np:1,2 \
|
||||
--keyword=i18ncp:1c,2,3 \
|
||||
--output=$WIVRN_DASHBOARD_POT \
|
||||
--package-name=WiVRn-dashboard \
|
||||
$(find dashboard/ -name "*.qml" -o -name "*.cpp" | sort)
|
||||
|
||||
sed -i 's/charset=CHARSET/charset=UTF-8/g' $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT
|
||||
|
||||
RC=0
|
||||
|
||||
for i in locale/*
|
||||
do
|
||||
if [ -f $i/wivrn.po ]
|
||||
then
|
||||
tools/check_po.py $WIVRN_CLIENT_POT $i/wivrn.po $(basename $i)
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
RC=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $i/wivrn-dashboard.po ]
|
||||
then
|
||||
tools/check_po.py $WIVRN_DASHBOARD_POT $i/wivrn-dashboard.po $(basename $i)
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
RC=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
rm $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT
|
||||
|
||||
exit $RC
|
||||
Reference in New Issue
Block a user