Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+2
-2
@@ -118,8 +118,8 @@ constexpr float fade_delay = 3;
|
|||||||
constexpr float fade_duration = 0.25;
|
constexpr float fade_duration = 0.25;
|
||||||
|
|
||||||
// Dimming for the streamed video when the GUI is interactable
|
// Dimming for the streamed video when the GUI is interactable
|
||||||
constexpr float dimming_scale = 0.7;
|
constexpr float dimming_scale = 0.4;
|
||||||
constexpr float dimming_bias = 0.15;
|
constexpr float dimming_bias = 0.01;
|
||||||
} // namespace constants::stream
|
} // namespace constants::stream
|
||||||
|
|
||||||
namespace constants::style
|
namespace constants::style
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ private:
|
|||||||
|
|
||||||
std::atomic<gui_status> gui_status = gui_status::hidden;
|
std::atomic<gui_status> gui_status = gui_status::hidden;
|
||||||
enum gui_status last_gui_status = gui_status::hidden;
|
enum gui_status last_gui_status = gui_status::hidden;
|
||||||
enum gui_status next_gui_status = gui_status::stats;
|
enum gui_status next_gui_status = gui_status::applications;
|
||||||
XrTime gui_status_last_change;
|
XrTime gui_status_last_change;
|
||||||
float dimming = 0;
|
float dimming = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -691,19 +691,6 @@ void scenes::stream::gui_applications()
|
|||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
imgui_ctx->tooltip(_S("Request to quit, may be ignored by the application"));
|
imgui_ctx->tooltip(_S("Request to quit, may be ignored by the application"));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto btn = _("Start");
|
|
||||||
ImGui::SetCursorPos(ImGui::GetWindowSize() - ImGui::CalcTextSize(btn.c_str()) - ImVec2(50, 50));
|
|
||||||
if (ImGui::Button(btn.c_str()))
|
|
||||||
{
|
|
||||||
network_session->send_control(from_headset::get_application_list{
|
|
||||||
.language = application::get_messages_info().language,
|
|
||||||
.country = application::get_messages_info().country,
|
|
||||||
.variant = application::get_messages_info().variant,
|
|
||||||
});
|
|
||||||
gui_status = gui_status::application_launcher;
|
|
||||||
}
|
|
||||||
imgui_ctx->vibrate_on_hover();
|
|
||||||
ImGui::PopStyleVar(3);
|
ImGui::PopStyleVar(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,13 +931,24 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
|||||||
ImGui::BeginChild("Tabs", {tab_width, ImGui::GetContentRegionMax().y - ImGui::GetWindowContentRegionMin().y});
|
ImGui::BeginChild("Tabs", {tab_width, ImGui::GetContentRegionMax().y - ImGui::GetWindowContentRegionMin().y});
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10, 10));
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10, 10));
|
||||||
RadioButtonWithoutCheckBox(ICON_FA_COMPUTER " " + _("Stats"), gui_status, gui_status::stats, {tab_width, 0});
|
|
||||||
|
RadioButtonWithoutCheckBox(ICON_FA_LIST " " + _("Applications"), gui_status, gui_status::applications, {tab_width, 0});
|
||||||
|
imgui_ctx->vibrate_on_hover();
|
||||||
|
|
||||||
|
if (RadioButtonWithoutCheckBox(ICON_FA_ROCKET " " + _("Start"), gui_status, gui_status::application_launcher, {tab_width, 0}))
|
||||||
|
{
|
||||||
|
network_session->send_control(from_headset::get_application_list{
|
||||||
|
.language = application::get_messages_info().language,
|
||||||
|
.country = application::get_messages_info().country,
|
||||||
|
.variant = application::get_messages_info().variant,
|
||||||
|
});
|
||||||
|
}
|
||||||
imgui_ctx->vibrate_on_hover();
|
imgui_ctx->vibrate_on_hover();
|
||||||
|
|
||||||
RadioButtonWithoutCheckBox(ICON_FA_GEARS " " + _("Settings"), gui_status, gui_status::settings, {tab_width, 0});
|
RadioButtonWithoutCheckBox(ICON_FA_GEARS " " + _("Settings"), gui_status, gui_status::settings, {tab_width, 0});
|
||||||
imgui_ctx->vibrate_on_hover();
|
imgui_ctx->vibrate_on_hover();
|
||||||
|
|
||||||
RadioButtonWithoutCheckBox(ICON_FA_LIST " " + _("Applications"), gui_status, gui_status::applications, {tab_width, 0});
|
RadioButtonWithoutCheckBox(ICON_FA_COMPUTER " " + _("Stats"), gui_status, gui_status::stats, {tab_width, 0});
|
||||||
imgui_ctx->vibrate_on_hover();
|
imgui_ctx->vibrate_on_hover();
|
||||||
|
|
||||||
int n_items_at_end = 4;
|
int n_items_at_end = 4;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
# Keep in sync with CMakeLists.txt monado rev
|
# Keep in sync with CMakeLists.txt monado rev
|
||||||
rev = builtins.readFile ./monado-rev;
|
rev = builtins.readFile ./monado-rev;
|
||||||
# Nix will output the correct hash when it doesn't match
|
# Nix will output the correct hash when it doesn't match
|
||||||
hash = "sha256-0ALB9eLY4NAUqNOYZMwpvYnLxVpHsQDJc1er8Txdezs=";
|
hash = "sha256-2JoiXstPUl5bK8xK8F4csSQOOm7b+ut9acSwK24zPTo=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ modules:
|
|||||||
- type: git
|
- type: git
|
||||||
url: https://github.com/crosstool-ng/crosstool-ng.git
|
url: https://github.com/crosstool-ng/crosstool-ng.git
|
||||||
tag: 70c2b00ad79a0a21a48e5a0eedc9f91c374af21d
|
tag: 70c2b00ad79a0a21a48e5a0eedc9f91c374af21d
|
||||||
|
- type: shell
|
||||||
|
commands:
|
||||||
|
- sed -i 's/-O2 -g/-O2/' scripts/crosstool-NG.sh
|
||||||
|
- sed -i 's/-g -O2/-O2/' scripts/build/cc/gcc.sh
|
||||||
cleanup:
|
cleanup:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
06e62fc7d9c5cbcbc43405bb86dfde3bf01ce043
|
7d5fa81a91340ced18a3e012ebcf5da7f9a6903c
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From e35ee68a6940d12646c8f0918e71f82a1c3e5604 Mon Sep 17 00:00:00 2001
|
From a618d3b2625205cea5500f55a7638555e0e90afd Mon Sep 17 00:00:00 2001
|
||||||
From: Patrick Nicolas <patricknicolas@laposte.net>
|
From: Patrick Nicolas <patricknicolas@laposte.net>
|
||||||
Date: Tue, 22 Oct 2024 15:23:19 +0200
|
Date: Tue, 22 Oct 2024 15:23:19 +0200
|
||||||
Subject: [PATCH 1/9] c/multi: early wake of compositor
|
Subject: [PATCH 1/6] c/multi: early wake of compositor
|
||||||
|
|
||||||
---
|
---
|
||||||
.../compositor/multi/comp_multi_compositor.c | 14 +++++++++
|
.../compositor/multi/comp_multi_compositor.c | 14 +++++++++
|
||||||
@@ -51,10 +51,10 @@ index 3351defa4..e8f0c8295 100644
|
|||||||
{
|
{
|
||||||
int64_t predicted_display_time_ns;
|
int64_t predicted_display_time_ns;
|
||||||
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
|
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
|
||||||
index cf8e2e525..94413b090 100644
|
index 199025a13..35ca4aa29 100644
|
||||||
--- a/src/xrt/compositor/multi/comp_multi_system.c
|
--- a/src/xrt/compositor/multi/comp_multi_system.c
|
||||||
+++ b/src/xrt/compositor/multi/comp_multi_system.c
|
+++ b/src/xrt/compositor/multi/comp_multi_system.c
|
||||||
@@ -23,6 +23,8 @@
|
@@ -24,6 +24,8 @@
|
||||||
#include "util/u_trace_marker.h"
|
#include "util/u_trace_marker.h"
|
||||||
#include "util/u_distortion_mesh.h"
|
#include "util/u_distortion_mesh.h"
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ index cf8e2e525..94413b090 100644
|
|||||||
#ifdef XRT_OS_LINUX
|
#ifdef XRT_OS_LINUX
|
||||||
#include "util/u_linux.h"
|
#include "util/u_linux.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -392,17 +394,24 @@ broadcast_timings_to_pacers(struct multi_system_compositor *msc,
|
@@ -393,17 +395,24 @@ broadcast_timings_to_pacers(struct multi_system_compositor *msc,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -93,7 +93,7 @@ index cf8e2e525..94413b090 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -528,10 +537,13 @@ multi_main_loop(struct multi_system_compositor *msc)
|
@@ -529,10 +538,13 @@ multi_main_loop(struct multi_system_compositor *msc)
|
||||||
broadcast_timings_to_clients(msc, predicted_display_time_ns);
|
broadcast_timings_to_clients(msc, predicted_display_time_ns);
|
||||||
|
|
||||||
// Now we can wait.
|
// Now we can wait.
|
||||||
@@ -109,7 +109,7 @@ index cf8e2e525..94413b090 100644
|
|||||||
|
|
||||||
// Now we know the diff, broadcast to pacers.
|
// Now we know the diff, broadcast to pacers.
|
||||||
broadcast_timings_to_pacers(msc, predicted_display_time_ns, predicted_display_period_ns, diff_ns);
|
broadcast_timings_to_pacers(msc, predicted_display_time_ns, predicted_display_period_ns, diff_ns);
|
||||||
@@ -708,6 +720,8 @@ system_compositor_destroy(struct xrt_system_compositor *xsc)
|
@@ -718,6 +730,8 @@ system_compositor_destroy(struct xrt_system_compositor *xsc)
|
||||||
xrt_comp_native_destroy(&msc->xcn);
|
xrt_comp_native_destroy(&msc->xcn);
|
||||||
|
|
||||||
os_mutex_destroy(&msc->list_and_timing_lock);
|
os_mutex_destroy(&msc->list_and_timing_lock);
|
||||||
@@ -118,7 +118,7 @@ index cf8e2e525..94413b090 100644
|
|||||||
|
|
||||||
free(msc);
|
free(msc);
|
||||||
}
|
}
|
||||||
@@ -762,6 +776,8 @@ comp_multi_create_system_compositor(struct xrt_compositor_native *xcn,
|
@@ -772,6 +786,8 @@ comp_multi_create_system_compositor(struct xrt_compositor_native *xcn,
|
||||||
msc->sessions.state = do_warm_start ? MULTI_SYSTEM_STATE_INIT_WARM_START : MULTI_SYSTEM_STATE_STOPPED;
|
msc->sessions.state = do_warm_start ? MULTI_SYSTEM_STATE_INIT_WARM_START : MULTI_SYSTEM_STATE_STOPPED;
|
||||||
|
|
||||||
os_mutex_init(&msc->list_and_timing_lock);
|
os_mutex_init(&msc->list_and_timing_lock);
|
||||||
@@ -128,5 +128,5 @@ index cf8e2e525..94413b090 100644
|
|||||||
//! @todo Make the clients not go from IDLE to READY before we have completed a first frame.
|
//! @todo Make the clients not go from IDLE to READY before we have completed a first frame.
|
||||||
// Make sure there is at least some sort of valid frame data here.
|
// Make sure there is at least some sort of valid frame data here.
|
||||||
--
|
--
|
||||||
2.51.1
|
2.51.2
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -1,26 +1,26 @@
|
|||||||
From fdb9b8a8762d08100dcd85060491565f59e12c4b Mon Sep 17 00:00:00 2001
|
From 0f7dfb63b174206483cdd00e50c41e2cab95f801 Mon Sep 17 00:00:00 2001
|
||||||
From: Patrick Nicolas <patricknicolas@laposte.net>
|
From: Patrick Nicolas <patricknicolas@laposte.net>
|
||||||
Date: Tue, 8 Oct 2024 22:13:15 +0200
|
Date: Tue, 8 Oct 2024 22:13:15 +0200
|
||||||
Subject: [PATCH 3/9] Use extern socket fd
|
Subject: [PATCH 2/6] Use extern socket fd
|
||||||
|
|
||||||
---
|
---
|
||||||
src/xrt/ipc/server/ipc_server_mainloop_linux.c | 8 ++++++++
|
src/xrt/ipc/server/ipc_server_mainloop_linux.c | 8 ++++++++
|
||||||
1 file changed, 8 insertions(+)
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
diff --git a/src/xrt/ipc/server/ipc_server_mainloop_linux.c b/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
diff --git a/src/xrt/ipc/server/ipc_server_mainloop_linux.c b/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
||||||
index ad6b473b7..ea6fad65b 100644
|
index 36bf3e31d..e40447bb2 100644
|
||||||
--- a/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
--- a/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
||||||
+++ b/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
+++ b/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
||||||
@@ -55,6 +55,8 @@
|
@@ -48,6 +48,8 @@
|
||||||
*/
|
#endif
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(skip_stdin, "XRT_NO_STDIN", false)
|
|
||||||
|
|
||||||
+extern int listen_socket;
|
+extern int listen_socket;
|
||||||
+
|
+
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Static functions.
|
* Static functions.
|
||||||
@@ -63,6 +65,12 @@ DEBUG_GET_ONCE_BOOL_OPTION(skip_stdin, "XRT_NO_STDIN", false)
|
@@ -56,6 +58,12 @@
|
||||||
static int
|
static int
|
||||||
get_systemd_socket(struct ipc_server_mainloop *ml, int *out_fd)
|
get_systemd_socket(struct ipc_server_mainloop *ml, int *out_fd)
|
||||||
{
|
{
|
||||||
@@ -34,5 +34,5 @@ index ad6b473b7..ea6fad65b 100644
|
|||||||
// We may have been launched with socket activation
|
// We may have been launched with socket activation
|
||||||
int num_fds = sd_listen_fds(0);
|
int num_fds = sd_listen_fds(0);
|
||||||
--
|
--
|
||||||
2.51.1
|
2.51.2
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
From 9d1515a0f4774faf9943f988fc3f76af3f74d614 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Patrick Nicolas <patricknicolas@laposte.net>
|
|
||||||
Date: Tue, 2 Apr 2024 17:14:42 +0200
|
|
||||||
Subject: [PATCH 2/9] ipc/server: Always listen to stdin
|
|
||||||
|
|
||||||
---
|
|
||||||
src/xrt/ipc/server/ipc_server_mainloop_linux.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/xrt/ipc/server/ipc_server_mainloop_linux.c b/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
|
||||||
index d364fbed3..ad6b473b7 100644
|
|
||||||
--- a/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
|
||||||
+++ b/src/xrt/ipc/server/ipc_server_mainloop_linux.c
|
|
||||||
@@ -186,7 +186,7 @@ init_epoll(struct ipc_server_mainloop *ml)
|
|
||||||
|
|
||||||
struct epoll_event ev = {0};
|
|
||||||
|
|
||||||
- if (!ml->launched_by_socket && !debug_get_bool_option_skip_stdin()) {
|
|
||||||
+ if (!debug_get_bool_option_skip_stdin()) {
|
|
||||||
// Can't do this when launched by systemd socket activation by
|
|
||||||
// default.
|
|
||||||
// This polls stdin.
|
|
||||||
--
|
|
||||||
2.51.1
|
|
||||||
|
|
||||||
+5
-5
@@ -1,17 +1,17 @@
|
|||||||
From 534ad7365e94abc6045b82a113ec4422754bf2f1 Mon Sep 17 00:00:00 2001
|
From 25de6ae03b6ece4ca726da848f4e468887ba3e0b Mon Sep 17 00:00:00 2001
|
||||||
From: galister <85970-galister@users.noreply.gitlab.freedesktop.org>
|
From: galister <85970-galister@users.noreply.gitlab.freedesktop.org>
|
||||||
Date: Sat, 23 Nov 2024 02:42:12 +0900
|
Date: Sat, 23 Nov 2024 02:42:12 +0900
|
||||||
Subject: [PATCH 4/9] change environment blend mode selection logic
|
Subject: [PATCH 3/6] change environment blend mode selection logic
|
||||||
|
|
||||||
---
|
---
|
||||||
src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++-------
|
src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++-------
|
||||||
1 file changed, 17 insertions(+), 9 deletions(-)
|
1 file changed, 17 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
|
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
|
||||||
index 94413b090..0d958c3af 100644
|
index 35ca4aa29..1d162a45d 100644
|
||||||
--- a/src/xrt/compositor/multi/comp_multi_system.c
|
--- a/src/xrt/compositor/multi/comp_multi_system.c
|
||||||
+++ b/src/xrt/compositor/multi/comp_multi_system.c
|
+++ b/src/xrt/compositor/multi/comp_multi_system.c
|
||||||
@@ -232,23 +232,31 @@ find_active_blend_mode(struct multi_compositor **overlay_sorted_clients, size_t
|
@@ -233,23 +233,31 @@ find_active_blend_mode(struct multi_compositor **overlay_sorted_clients, size_t
|
||||||
if (overlay_sorted_clients == NULL)
|
if (overlay_sorted_clients == NULL)
|
||||||
return XRT_BLEND_MODE_OPAQUE;
|
return XRT_BLEND_MODE_OPAQUE;
|
||||||
|
|
||||||
@@ -53,5 +53,5 @@ index 94413b090..0d958c3af 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
--
|
--
|
||||||
2.51.1
|
2.51.2
|
||||||
|
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
From f3d43c212df9c88472c79f98e1e7b5b2772e61a7 Mon Sep 17 00:00:00 2001
|
From 205bc81e5d5620ad993298791ee1331734027df0 Mon Sep 17 00:00:00 2001
|
||||||
From: Patrick Nicolas <patricknicolas@laposte.net>
|
From: Patrick Nicolas <patricknicolas@laposte.net>
|
||||||
Date: Sat, 15 Mar 2025 22:19:48 +0100
|
Date: Sat, 15 Mar 2025 22:19:48 +0100
|
||||||
Subject: [PATCH 5/9] st/oxr: forward 0 refresh rate
|
Subject: [PATCH 4/6] st/oxr: forward 0 refresh rate
|
||||||
|
|
||||||
---
|
---
|
||||||
src/xrt/compositor/main/comp_compositor.c | 2 +-
|
src/xrt/compositor/main/comp_compositor.c | 2 +-
|
||||||
@@ -43,5 +43,5 @@ index 9c5889f12..c4cdaf8c3 100644
|
|||||||
if ((int)(displayRefreshRate * 100.0f) == (int)(sess->sys->xsysc->info.refresh_rates_hz[i] * 100.0f)) {
|
if ((int)(displayRefreshRate * 100.0f) == (int)(sess->sys->xsysc->info.refresh_rates_hz[i] * 100.0f)) {
|
||||||
found = true;
|
found = true;
|
||||||
--
|
--
|
||||||
2.51.1
|
2.51.2
|
||||||
|
|
||||||
+557
-212
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
From 1025812acf7086c471cfe0c2ae4d85106794051b Mon Sep 17 00:00:00 2001
|
From 2465ef4bdb091830488d2518c233ee94a2e7c426 Mon Sep 17 00:00:00 2001
|
||||||
From: no name <git-am@invalid>
|
From: no name <git-am@invalid>
|
||||||
Date: Sun, 28 Sep 2025 11:33:10 +0200
|
Date: Sun, 28 Sep 2025 11:33:10 +0200
|
||||||
Subject: [PATCH 9/9] d/steamvr_lh: prevent crash on vive pro2/WiVRn
|
Subject: [PATCH 6/6] d/steamvr_lh: prevent crash on vive pro2/WiVRn
|
||||||
|
|
||||||
---
|
---
|
||||||
src/xrt/drivers/steamvr_lh/steamvr_lh.cpp | 2 +-
|
src/xrt/drivers/steamvr_lh/steamvr_lh.cpp | 2 +-
|
||||||
@@ -21,5 +21,5 @@ index 8a4c55ed4..723cbb196 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
--
|
--
|
||||||
2.51.1
|
2.51.2
|
||||||
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
From f1e9385f7b0f9148d0ae2ef147b3d96d5dbf3573 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Patrick Nicolas <patricknicolas@laposte.net>
|
|
||||||
Date: Sun, 31 Aug 2025 17:05:49 +0200
|
|
||||||
Subject: [PATCH 7/9] Limit foveation samples per pixel
|
|
||||||
|
|
||||||
---
|
|
||||||
src/xrt/compositor/shaders/distortion.comp | 12 +++++++++---
|
|
||||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/xrt/compositor/shaders/distortion.comp b/src/xrt/compositor/shaders/distortion.comp
|
|
||||||
index cd1828ac9..41de849e6 100644
|
|
||||||
--- a/src/xrt/compositor/shaders/distortion.comp
|
|
||||||
+++ b/src/xrt/compositor/shaders/distortion.comp
|
|
||||||
@@ -12,6 +12,7 @@
|
|
||||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
|
||||||
|
|
||||||
#define MAX_DIM 4097
|
|
||||||
+#define MAX_SAMPLES 4
|
|
||||||
|
|
||||||
layout(set = 0, binding = 0) uniform sampler2D source[2];
|
|
||||||
layout(set = 0, binding = 1, std430) buffer restrict Foveation
|
|
||||||
@@ -67,13 +68,18 @@ void main()
|
|
||||||
if (xmin == xmax)
|
|
||||||
return;
|
|
||||||
|
|
||||||
+ uint xstep = (xmax - xmin + MAX_SAMPLES - 1) / MAX_SAMPLES;
|
|
||||||
+ uint ystep = (ymax - ymin + MAX_SAMPLES - 1) / MAX_SAMPLES;
|
|
||||||
+
|
|
||||||
vec4 colour = vec4(0);
|
|
||||||
- for (uint y = ymin ; y < ymax; y += 1) {
|
|
||||||
- for (uint x = xmin ; x < xmax; x += 1) {
|
|
||||||
+ uint count = 0;
|
|
||||||
+ for (uint y = ymin ; y < ymax; y += ystep) {
|
|
||||||
+ for (uint x = xmin ; x < xmax; x += xstep) {
|
|
||||||
colour += texelFetch(source[iz], ivec2(x, y), 0);
|
|
||||||
+ ++count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- colour /= (xmax - xmin) * (ymax - ymin);
|
|
||||||
+ colour /= count;
|
|
||||||
colour.xyz = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb));
|
|
||||||
|
|
||||||
imageStore(luma, ivec3(offset.x + ix, offset.y + iy, 0), vec4(colour.x));
|
|
||||||
--
|
|
||||||
2.51.1
|
|
||||||
|
|
||||||
@@ -1,312 +0,0 @@
|
|||||||
From 495681b6f4ceb94e7b26f53d3f8704a45b74003d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jakob Bornecrantz <tbornecrantz@nvidia.com>
|
|
||||||
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<std::mutex> 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<std::thread>(
|
|
||||||
- [&]() { ipc_server_main_android(&server, signalStartupCompleteTrampoline, this); });
|
|
||||||
+ server_thread =
|
|
||||||
+ std::make_unique<std::thread>([&]() { ipc_server_main_common(&ismi, &callbacks, this); });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
- signalStartupCompleteTrampoline(void *data)
|
|
||||||
+ signalInitFailed(xrt_result_t xret, void *data)
|
|
||||||
{
|
|
||||||
- static_cast<IpcServerHelper *>(data)->signalStartupComplete();
|
|
||||||
+ static_cast<IpcServerHelper *>(data)->signalStartupComplete(nullptr);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ static void
|
|
||||||
+ signalStartupCompleteTrampoline(ipc_server *s, xrt_instance *xsint, void *data)
|
|
||||||
+ {
|
|
||||||
+ static_cast<IpcServerHelper *>(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.1
|
|
||||||
|
|
||||||
@@ -19,23 +19,17 @@
|
|||||||
|
|
||||||
#include "accept_connection.h"
|
#include "accept_connection.h"
|
||||||
|
|
||||||
|
#include "server/ipc_server_interface.h"
|
||||||
|
|
||||||
|
#include "utils/overloaded.h"
|
||||||
|
|
||||||
#include "wivrn_config.h"
|
#include "wivrn_config.h"
|
||||||
#include "wivrn_ipc.h"
|
#include "wivrn_ipc.h"
|
||||||
#include "wivrn_sockets.h"
|
#include "wivrn_sockets.h"
|
||||||
|
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
|
|
||||||
static void handle_event_from_main_loop(to_monado::disconnect)
|
std::unique_ptr<wivrn::TCP> wivrn::accept_connection(ipc_server * server, int watch_fd, std::function<bool()> quit)
|
||||||
{
|
|
||||||
// Ignore disconnect request when no headset is connected
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_event_from_main_loop(to_monado::set_bitrate)
|
|
||||||
{
|
|
||||||
// Ignore bitrate request when no headset is connected
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<wivrn::TCP> wivrn::accept_connection(int watch_fd, std::function<bool()> quit)
|
|
||||||
{
|
{
|
||||||
wivrn_ipc_socket_monado->send(from_monado::headset_disconnected{});
|
wivrn_ipc_socket_monado->send(from_monado::headset_disconnected{});
|
||||||
|
|
||||||
@@ -68,7 +62,15 @@ std::unique_ptr<wivrn::TCP> wivrn::accept_connection(int watch_fd, std::function
|
|||||||
{
|
{
|
||||||
auto packet = receive_from_main();
|
auto packet = receive_from_main();
|
||||||
if (packet)
|
if (packet)
|
||||||
std::visit([](auto && x) { handle_event_from_main_loop(x); }, *packet);
|
std::visit(utils::overloaded{
|
||||||
|
[server](to_monado::stop) {
|
||||||
|
ipc_server_stop(server);
|
||||||
|
},
|
||||||
|
[](auto &&) {
|
||||||
|
// Ignore request when no headset is connected
|
||||||
|
},
|
||||||
|
},
|
||||||
|
*packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "server/ipc_server.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace wivrn
|
namespace wivrn
|
||||||
{
|
{
|
||||||
class TCP;
|
class TCP;
|
||||||
std::unique_ptr<wivrn::TCP> accept_connection(int watch_fd, std::function<bool()> quit = std::function<bool()>());
|
std::unique_ptr<wivrn::TCP> accept_connection(ipc_server * server, int watch_fd, std::function<bool()> quit = std::function<bool()>());
|
||||||
} // namespace wivrn
|
} // namespace wivrn
|
||||||
|
|||||||
@@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
static void handle_event_from_main_loop(to_monado::stop)
|
||||||
|
{
|
||||||
|
// Ignore stop request when no headset is connected
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_event_from_main_loop(to_monado::disconnect)
|
static void handle_event_from_main_loop(to_monado::disconnect)
|
||||||
{
|
{
|
||||||
// Ignore disconnect request when no headset is connected
|
// Ignore disconnect request when no headset is connected
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ xrt_result_t wivrn_hmd::get_presence(bool * out_presence)
|
|||||||
|
|
||||||
xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||||
int64_t at_timestamp_ns,
|
int64_t at_timestamp_ns,
|
||||||
|
xrt_view_type view_type,
|
||||||
uint32_t view_count,
|
uint32_t view_count,
|
||||||
xrt_space_relation * out_head_relation,
|
xrt_space_relation * out_head_relation,
|
||||||
xrt_fov * out_fovs,
|
xrt_fov * out_fovs,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "utils/thread_safe.h"
|
#include "utils/thread_safe.h"
|
||||||
|
#include "xrt/xrt_compositor.h"
|
||||||
#include "xrt/xrt_device.h"
|
#include "xrt/xrt_device.h"
|
||||||
#include "xrt/xrt_tracking.h"
|
#include "xrt/xrt_tracking.h"
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@ public:
|
|||||||
xrt_result_t get_presence(bool * out_presence);
|
xrt_result_t get_presence(bool * out_presence);
|
||||||
xrt_result_t get_view_poses(const xrt_vec3 * default_eye_relation,
|
xrt_result_t get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||||
int64_t at_timestamp_ns,
|
int64_t at_timestamp_ns,
|
||||||
|
xrt_view_type view_type,
|
||||||
uint32_t view_count,
|
uint32_t view_count,
|
||||||
xrt_space_relation * out_head_relation,
|
xrt_space_relation * out_head_relation,
|
||||||
xrt_fov * out_fovs,
|
xrt_fov * out_fovs,
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connecti
|
|||||||
|
|
||||||
void wivrn_session::start(ipc_server * server)
|
void wivrn_session::start(ipc_server * server)
|
||||||
{
|
{
|
||||||
assert(not thread);
|
assert(not thread.joinable());
|
||||||
mnd_ipc_server = server;
|
mnd_ipc_server = server;
|
||||||
thread = std::jthread([this](auto stop_token) { return run(stop_token); });
|
thread = std::jthread([this](auto stop_token) { return run(stop_token); });
|
||||||
}
|
}
|
||||||
@@ -721,7 +721,7 @@ void wivrn_session::operator()(from_headset::visibility_mask_changed && mask)
|
|||||||
|
|
||||||
void wivrn_session::operator()(from_headset::session_state_changed && event)
|
void wivrn_session::operator()(from_headset::session_state_changed && event)
|
||||||
{
|
{
|
||||||
assert(server);
|
assert(mnd_ipc_server);
|
||||||
U_LOG_I("Session state changed: %s", xr::to_string(event.state));
|
U_LOG_I("Session state changed: %s", xr::to_string(event.state));
|
||||||
bool visible, focused;
|
bool visible, focused;
|
||||||
switch (event.state)
|
switch (event.state)
|
||||||
@@ -836,7 +836,7 @@ void wivrn_session::operator()(const from_headset::start_app & request)
|
|||||||
|
|
||||||
void wivrn_session::operator()(const from_headset::get_running_applications &)
|
void wivrn_session::operator()(const from_headset::get_running_applications &)
|
||||||
{
|
{
|
||||||
assert(server);
|
assert(mnd_ipc_server);
|
||||||
scoped_lock lock(mnd_ipc_server->global_state.lock);
|
scoped_lock lock(mnd_ipc_server->global_state.lock);
|
||||||
to_headset::running_applications msg{};
|
to_headset::running_applications msg{};
|
||||||
for (auto & t: mnd_ipc_server->threads)
|
for (auto & t: mnd_ipc_server->threads)
|
||||||
@@ -861,7 +861,7 @@ void wivrn_session::operator()(const from_headset::get_running_applications &)
|
|||||||
|
|
||||||
void wivrn_session::operator()(const from_headset::set_active_application & req)
|
void wivrn_session::operator()(const from_headset::set_active_application & req)
|
||||||
{
|
{
|
||||||
assert(server);
|
assert(mnd_ipc_server);
|
||||||
ipc_server_set_active_client(mnd_ipc_server, req.id);
|
ipc_server_set_active_client(mnd_ipc_server, req.id);
|
||||||
ipc_server_update_state(mnd_ipc_server);
|
ipc_server_update_state(mnd_ipc_server);
|
||||||
// Send a refreshed application list
|
// Send a refreshed application list
|
||||||
@@ -870,7 +870,7 @@ void wivrn_session::operator()(const from_headset::set_active_application & req)
|
|||||||
|
|
||||||
void wivrn_session::operator()(const from_headset::stop_application & req)
|
void wivrn_session::operator()(const from_headset::stop_application & req)
|
||||||
{
|
{
|
||||||
assert(server);
|
assert(mnd_ipc_server);
|
||||||
scoped_lock lock(mnd_ipc_server->global_state.lock);
|
scoped_lock lock(mnd_ipc_server->global_state.lock);
|
||||||
for (auto & t: mnd_ipc_server->threads)
|
for (auto & t: mnd_ipc_server->threads)
|
||||||
{
|
{
|
||||||
@@ -891,6 +891,12 @@ void wivrn_session::operator()(audio_data && data)
|
|||||||
audio_handle->process_mic_data(std::move(data));
|
audio_handle->process_mic_data(std::move(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wivrn_session::operator()(to_monado::stop &&)
|
||||||
|
{
|
||||||
|
assert(mnd_ipc_server);
|
||||||
|
ipc_server_stop(mnd_ipc_server);
|
||||||
|
}
|
||||||
|
|
||||||
void wivrn_session::operator()(to_monado::disconnect &&)
|
void wivrn_session::operator()(to_monado::disconnect &&)
|
||||||
{
|
{
|
||||||
connection->shutdown();
|
connection->shutdown();
|
||||||
@@ -1007,6 +1013,7 @@ static bool quit_if_no_client(u_system & xrt_system)
|
|||||||
|
|
||||||
void wivrn_session::reconnect()
|
void wivrn_session::reconnect()
|
||||||
{
|
{
|
||||||
|
assert(mnd_ipc_server);
|
||||||
// Notify clients about disconnected status
|
// Notify clients about disconnected status
|
||||||
xrt_session_event event{
|
xrt_session_event event{
|
||||||
.state = {
|
.state = {
|
||||||
@@ -1022,7 +1029,7 @@ void wivrn_session::reconnect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
U_LOG_I("Waiting for new connection");
|
U_LOG_I("Waiting for new connection");
|
||||||
auto tcp = accept_connection(0 /*stdin*/, [this]() { return quit_if_no_client(xrt_system); });
|
auto tcp = accept_connection(mnd_ipc_server, 0 /*stdin*/, [this]() { return quit_if_no_client(xrt_system); });
|
||||||
if (not tcp)
|
if (not tcp)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
@@ -1069,7 +1076,7 @@ void wivrn_session::reconnect()
|
|||||||
|
|
||||||
void wivrn_session::poll_session_loss()
|
void wivrn_session::poll_session_loss()
|
||||||
{
|
{
|
||||||
assert(server);
|
assert(mnd_ipc_server);
|
||||||
auto locked = session_loss.lock();
|
auto locked = session_loss.lock();
|
||||||
auto now = os_monotonic_get_ns();
|
auto now = os_monotonic_get_ns();
|
||||||
if (locked->empty())
|
if (locked->empty())
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ public:
|
|||||||
void operator()(const from_headset::stop_application &);
|
void operator()(const from_headset::stop_application &);
|
||||||
void operator()(audio_data &&);
|
void operator()(audio_data &&);
|
||||||
|
|
||||||
|
void operator()(to_monado::stop &&);
|
||||||
void operator()(to_monado::disconnect &&);
|
void operator()(to_monado::disconnect &&);
|
||||||
void operator()(to_monado::set_bitrate &&);
|
void operator()(to_monado::set_bitrate &&);
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ video_encoder::video_encoder(uint8_t stream_idx, to_headset::video_stream_descri
|
|||||||
shared_sender(async_send ? sender::get() : nullptr),
|
shared_sender(async_send ? sender::get() : nullptr),
|
||||||
idr(std::move(idr))
|
idr(std::move(idr))
|
||||||
{
|
{
|
||||||
assert(idr);
|
assert(this->idr);
|
||||||
}
|
}
|
||||||
|
|
||||||
video_encoder::~video_encoder()
|
video_encoder::~video_encoder()
|
||||||
|
|||||||
@@ -39,11 +39,22 @@ void ipc_server_cb::mainloop_leaving(ipc_server * server, xrt_instance * xrt_ins
|
|||||||
inst->set_ipc_server(nullptr);
|
inst->set_ipc_server(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ipc_server_cb::client_connected(ipc_server * server, uint32_t client_id)
|
||||||
|
{
|
||||||
|
IPC_INFO(server, "Client %u connected", client_id);
|
||||||
|
}
|
||||||
|
void ipc_server_cb::client_disconnected(ipc_server * server, uint32_t client_id)
|
||||||
|
{
|
||||||
|
IPC_INFO(server, "Client %u disconnected", client_id);
|
||||||
|
}
|
||||||
|
|
||||||
ipc_server_cb::ipc_server_cb() :
|
ipc_server_cb::ipc_server_cb() :
|
||||||
ipc_server_callbacks{
|
ipc_server_callbacks{
|
||||||
.init_failed = method_pointer2<&ipc_server_cb::init_failed>,
|
.init_failed = method_pointer2<&ipc_server_cb::init_failed>,
|
||||||
.mainloop_entering = method_pointer2<&ipc_server_cb::mainloop_entering>,
|
.mainloop_entering = method_pointer2<&ipc_server_cb::mainloop_entering>,
|
||||||
.mainloop_leaving = method_pointer2<&ipc_server_cb::mainloop_leaving>,
|
.mainloop_leaving = method_pointer2<&ipc_server_cb::mainloop_leaving>,
|
||||||
|
.client_connected = method_pointer2<&ipc_server_cb::client_connected>,
|
||||||
|
.client_disconnected = method_pointer2<&ipc_server_cb::client_disconnected>,
|
||||||
}
|
}
|
||||||
{}
|
{}
|
||||||
} // namespace wivrn
|
} // namespace wivrn
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ class ipc_server_cb : public ipc_server_callbacks
|
|||||||
void init_failed(xrt_result);
|
void init_failed(xrt_result);
|
||||||
void mainloop_entering(ipc_server *, xrt_instance *);
|
void mainloop_entering(ipc_server *, xrt_instance *);
|
||||||
void mainloop_leaving(ipc_server *, xrt_instance *);
|
void mainloop_leaving(ipc_server *, xrt_instance *);
|
||||||
|
void client_connected(ipc_server *, uint32_t);
|
||||||
|
void client_disconnected(ipc_server *, uint32_t);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using base = void;
|
using base = void;
|
||||||
|
|||||||
+2
-22
@@ -178,7 +178,6 @@ static std::string steam_command()
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
int stdin_pipe_fds[2];
|
|
||||||
int control_pipe_fds[2];
|
int control_pipe_fds[2];
|
||||||
|
|
||||||
GMainLoop * main_loop;
|
GMainLoop * main_loop;
|
||||||
@@ -238,14 +237,6 @@ void start_server(configuration config)
|
|||||||
}
|
}
|
||||||
else if (server_pid == 0)
|
else if (server_pid == 0)
|
||||||
{
|
{
|
||||||
if (do_fork)
|
|
||||||
{
|
|
||||||
// Redirect stdin
|
|
||||||
dup2(stdin_pipe_fds[0], 0);
|
|
||||||
close(stdin_pipe_fds[0]);
|
|
||||||
close(stdin_pipe_fds[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// foveation code does not allow oversampling
|
// foveation code does not allow oversampling
|
||||||
setenv("XRT_COMPOSITOR_SCALE_PERCENTAGE", "100", true);
|
setenv("XRT_COMPOSITOR_SCALE_PERCENTAGE", "100", true);
|
||||||
|
|
||||||
@@ -264,6 +255,7 @@ void start_server(configuration config)
|
|||||||
.open = U_DEBUG_GUI_OPEN_NEVER,
|
.open = U_DEBUG_GUI_OPEN_NEVER,
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
|
.no_stdin = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -302,10 +294,7 @@ void start_server(configuration config)
|
|||||||
|
|
||||||
void kill_server()
|
void kill_server()
|
||||||
{
|
{
|
||||||
// Write to the server's stdin to make it quit
|
wivrn_ipc_socket_main_loop->send(to_monado::stop{});
|
||||||
char buffer[] = "\n";
|
|
||||||
if (write(stdin_pipe_fds[1], &buffer, strlen(buffer)) < 0)
|
|
||||||
std::cerr << "Cannot stop monado properly." << std::endl;
|
|
||||||
|
|
||||||
// Send SIGTERM after 1s if it is still running
|
// Send SIGTERM after 1s if it is still running
|
||||||
server_kill_watch = g_timeout_add(1000, [](void *) {
|
server_kill_watch = g_timeout_add(1000, [](void *) {
|
||||||
@@ -917,15 +906,6 @@ int inner_main(int argc, char * argv[], bool show_instructions)
|
|||||||
AvahiGLibPoll * glib_poll = avahi_glib_poll_new(main_context, G_PRIORITY_DEFAULT);
|
AvahiGLibPoll * glib_poll = avahi_glib_poll_new(main_context, G_PRIORITY_DEFAULT);
|
||||||
poll_api = avahi_glib_poll_get(glib_poll);
|
poll_api = avahi_glib_poll_get(glib_poll);
|
||||||
|
|
||||||
// Create a pipe to quit monado properly
|
|
||||||
if (pipe(stdin_pipe_fds) < 0)
|
|
||||||
{
|
|
||||||
perror("pipe");
|
|
||||||
return wivrn_exit_code::cannot_create_pipe;
|
|
||||||
}
|
|
||||||
fcntl(stdin_pipe_fds[0], F_SETFD, FD_CLOEXEC);
|
|
||||||
fcntl(stdin_pipe_fds[1], F_SETFD, FD_CLOEXEC);
|
|
||||||
|
|
||||||
// Create a socket to report monado status to the main loop
|
// Create a socket to report monado status to the main loop
|
||||||
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, control_pipe_fds) < 0)
|
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, control_pipe_fds) < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,13 @@
|
|||||||
|
|
||||||
namespace wivrn
|
namespace wivrn
|
||||||
{
|
{
|
||||||
|
xrt_result_t instance::is_system_available(bool * out_available)
|
||||||
|
{
|
||||||
|
assert(out_available != NULL);
|
||||||
|
*out_available = true;
|
||||||
|
return XRT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
xrt_result_t instance::create_system(
|
xrt_result_t instance::create_system(
|
||||||
struct xrt_system ** out_xsys,
|
struct xrt_system ** out_xsys,
|
||||||
struct xrt_system_devices ** out_xsysd,
|
struct xrt_system_devices ** out_xsysd,
|
||||||
@@ -42,6 +49,7 @@ xrt_result_t instance::create_system(
|
|||||||
assert(out_xsysd != NULL);
|
assert(out_xsysd != NULL);
|
||||||
assert(*out_xsysd == NULL);
|
assert(*out_xsysd == NULL);
|
||||||
assert(out_xsysc == NULL || *out_xsysc == NULL);
|
assert(out_xsysc == NULL || *out_xsysc == NULL);
|
||||||
|
assert(server);
|
||||||
auto u_sys = u_system_create();
|
auto u_sys = u_system_create();
|
||||||
*out_xsys = &u_sys->base;
|
*out_xsys = &u_sys->base;
|
||||||
|
|
||||||
@@ -55,6 +63,7 @@ xrt_result_t instance::create_system(
|
|||||||
if (res != XRT_SUCCESS)
|
if (res != XRT_SUCCESS)
|
||||||
return res;
|
return res;
|
||||||
session = (wivrn_session *)*out_xsysd;
|
session = (wivrn_session *)*out_xsysd;
|
||||||
|
session->start(server);
|
||||||
u_system_set_system_compositor(u_sys, *out_xsysc);
|
u_system_set_system_compositor(u_sys, *out_xsysc);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -67,6 +76,7 @@ xrt_result_t instance::get_prober(struct xrt_prober ** out_xp)
|
|||||||
|
|
||||||
instance::instance() :
|
instance::instance() :
|
||||||
xrt_instance{
|
xrt_instance{
|
||||||
|
.is_system_available = method_pointer<&instance::is_system_available>,
|
||||||
.create_system = method_pointer<&instance::create_system>,
|
.create_system = method_pointer<&instance::create_system>,
|
||||||
.get_prober = method_pointer<&instance::get_prober>,
|
.get_prober = method_pointer<&instance::get_prober>,
|
||||||
.destroy = [](xrt_instance * ptr) { delete (instance *)ptr; },
|
.destroy = [](xrt_instance * ptr) { delete (instance *)ptr; },
|
||||||
@@ -77,11 +87,12 @@ instance::instance() :
|
|||||||
|
|
||||||
void instance::set_ipc_server(ipc_server * server)
|
void instance::set_ipc_server(ipc_server * server)
|
||||||
{
|
{
|
||||||
assert(session);
|
this->server = server;
|
||||||
if (server)
|
if (!server)
|
||||||
session->start(server);
|
{
|
||||||
else
|
assert(session);
|
||||||
session->stop();
|
session->stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace wivrn
|
} // namespace wivrn
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace wivrn
|
|||||||
class wivrn_session;
|
class wivrn_session;
|
||||||
class instance : public xrt_instance
|
class instance : public xrt_instance
|
||||||
{
|
{
|
||||||
|
xrt_result_t is_system_available(bool *);
|
||||||
xrt_result_t create_system(
|
xrt_result_t create_system(
|
||||||
xrt_system **,
|
xrt_system **,
|
||||||
xrt_system_devices **,
|
xrt_system_devices **,
|
||||||
@@ -35,6 +36,7 @@ class instance : public xrt_instance
|
|||||||
xrt_result_t get_prober(xrt_prober **);
|
xrt_result_t get_prober(xrt_prober **);
|
||||||
|
|
||||||
wivrn_session * session = nullptr;
|
wivrn_session * session = nullptr;
|
||||||
|
ipc_server * server = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using base = xrt_instance;
|
using base = xrt_instance;
|
||||||
|
|||||||
+4
-1
@@ -64,6 +64,9 @@ using packets = std::variant<
|
|||||||
|
|
||||||
namespace to_monado
|
namespace to_monado
|
||||||
{
|
{
|
||||||
|
struct stop
|
||||||
|
{};
|
||||||
|
|
||||||
struct disconnect
|
struct disconnect
|
||||||
{};
|
{};
|
||||||
|
|
||||||
@@ -72,7 +75,7 @@ struct set_bitrate
|
|||||||
uint32_t bitrate_bps;
|
uint32_t bitrate_bps;
|
||||||
};
|
};
|
||||||
|
|
||||||
using packets = std::variant<disconnect, set_bitrate>;
|
using packets = std::variant<stop, disconnect, set_bitrate>;
|
||||||
} // namespace to_monado
|
} // namespace to_monado
|
||||||
|
|
||||||
extern std::optional<wivrn::typed_socket<wivrn::UnixDatagram, to_monado::packets, from_monado::packets>> wivrn_ipc_socket_monado;
|
extern std::optional<wivrn::typed_socket<wivrn::UnixDatagram, to_monado::packets, from_monado::packets>> wivrn_ipc_socket_monado;
|
||||||
|
|||||||
Reference in New Issue
Block a user