Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Vindicus999
2025-09-27 17:14:46 +00:00
28 changed files with 1552 additions and 699 deletions
+112 -32
View File
@@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_impl.h"
#include "implot.h"
@@ -25,6 +26,7 @@
#include "image_loader.h"
#include "openxr/openxr.h"
#include "utils/ranges.h"
#include "utils/strings.h"
#include "vulkan/vulkan_enums.hpp"
#include "vulkan/vulkan_handles.hpp"
#include "vulkan/vulkan_to_string.hpp"
@@ -43,8 +45,6 @@
#include <spdlog/spdlog.h>
#include <string_view>
#include "IconsFontAwesome6.h"
#ifdef __ANDROID__
#include <android/font.h>
#include <android/font_matcher.h>
@@ -178,6 +178,31 @@ static float distance_to_window(ImGuiWindow * window, ImVec2 position)
return std::hypot(dx, dy);
}
static const std::array layout_bindings = {
vk::DescriptorSetLayoutBinding{
.binding = 0,
.descriptorType = vk::DescriptorType::eCombinedImageSampler,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eFragment,
}};
imgui_textures::imgui_textures(
vk::raii::PhysicalDevice physical_device,
vk::raii::Device & device,
uint32_t queue_family_index,
thread_safe<vk::raii::Queue> & queue) :
physical_device(physical_device),
device(device),
queue(queue),
ds_layout(device, vk::DescriptorSetLayoutCreateInfo{.bindingCount = layout_bindings.size(), .pBindings = layout_bindings.data()}),
command_pool(device,
vk::CommandPoolCreateInfo{
.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer | vk::CommandPoolCreateFlagBits::eTransient,
.queueFamilyIndex = queue_family_index,
}),
descriptor_pool(device, ds_layout, layout_bindings)
{}
std::vector<std::pair<ImVec2, float>> imgui_context::ray_plane_intersection(const imgui_context::controller_state & in) const
{
if (!in.active)
@@ -289,14 +314,6 @@ imgui_context::imgui_frame & imgui_context::get_frame(vk::Image destination)
return frame;
}
static const std::array layout_bindings = {
vk::DescriptorSetLayoutBinding{
.binding = 0,
.descriptorType = vk::DescriptorType::eCombinedImageSampler,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eFragment,
}};
imgui_context::imgui_context(
vk::raii::PhysicalDevice physical_device,
vk::raii::Device & device,
@@ -305,18 +322,13 @@ imgui_context::imgui_context(
std::span<controller> controllers_,
xr::swapchain & swapchain,
std::vector<viewport> layers) :
physical_device(physical_device),
device(device),
imgui_textures(
physical_device,
device,
queue_family_index,
queue),
queue_family_index(queue_family_index),
queue(queue),
ds_layout(device, vk::DescriptorSetLayoutCreateInfo{.bindingCount = layout_bindings.size(), .pBindings = layout_bindings.data()}),
descriptor_pool(device, ds_layout, layout_bindings),
renderpass(create_renderpass(device, swapchain.format(), true)),
command_pool(device,
vk::CommandPoolCreateInfo{
.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer | vk::CommandPoolCreateFlagBits::eTransient,
.queueFamilyIndex = queue_family_index,
}),
command_buffers(swapchain.images().size()),
size(swapchain.extent().width, swapchain.extent().height),
format(swapchain.format()),
@@ -1020,12 +1032,12 @@ imgui_context::~imgui_context()
ImGui::DestroyContext(context);
}
ImTextureID imgui_context::load_texture(const std::string & filename, vk::raii::Sampler && sampler)
ImTextureID imgui_textures::load_texture(const std::string & filename, vk::raii::Sampler && sampler)
{
return load_texture(std::span<const std::byte>{asset{filename}}, std::move(sampler));
}
ImTextureID imgui_context::load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler)
ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler)
{
bool srgb = true;
image_loader loader(physical_device, device, queue, command_pool);
@@ -1061,7 +1073,7 @@ ImTextureID imgui_context::load_texture(const std::span<const std::byte> & bytes
return id;
}
ImTextureID imgui_context::load_texture(const std::span<const std::byte> & bytes)
ImTextureID imgui_textures::load_texture(const std::span<const std::byte> & bytes)
{
return load_texture(
bytes,
@@ -1079,7 +1091,7 @@ ImTextureID imgui_context::load_texture(const std::span<const std::byte> & bytes
});
}
ImTextureID imgui_context::load_texture(const std::string & filename)
ImTextureID imgui_textures::load_texture(const std::string & filename)
{
return load_texture(
filename,
@@ -1097,15 +1109,8 @@ ImTextureID imgui_context::load_texture(const std::string & filename)
});
}
void imgui_context::free_texture(ImTextureID texture)
void imgui_textures::free_texture(ImTextureID texture)
{
// Make sure we are done using the texture
std::vector<vk::Fence> fences;
for (auto & f: command_buffers)
fences.push_back(*f.fence);
if (auto result = device.waitForFences(fences, true, 1'000'000'000); result != vk::Result::eSuccess)
spdlog::error("vkWaitForfences: {}", vk::to_string(result));
textures.erase(texture);
}
@@ -1182,3 +1187,78 @@ void imgui_context::tooltip(std::string_view text)
viewport->Pos = pos_backup;
viewport->Size = size_backup;
}
// https://github.com/ocornut/imgui/issues/3379#issuecomment-2943903877
void ScrollWhenDragging()
{
ImVec2 delta{0.0f, -ImGui::GetIO().MouseDelta.y};
const ImGuiMouseButton mouse_button = ImGuiMouseButton_Left;
ImGuiContext & g = *ImGui::GetCurrentContext();
ImGuiWindow * window = g.CurrentWindow;
ImGuiID id = window->GetID("##scrolldraggingoverlay");
ImGui::KeepAliveID(id);
static int active_id;
static ImVec2 cumulated_delta;
bool HoveredIdAllowOverlap_backup = std::exchange(g.HoveredIdAllowOverlap, true);
bool ActiveIdAllowOverlap_backup = std::exchange(g.ActiveIdAllowOverlap, true);
if (active_id == 0 and ImGui::ItemHoverable(window->Rect(), 0, g.CurrentItemFlags) and ImGui::IsMouseClicked(mouse_button, ImGuiInputFlags_None, /*id*/ ImGuiKeyOwner_Any))
{
active_id = id;
// Don't scroll on the first step, in case the active controller just changed
delta = {};
cumulated_delta = {};
}
if (not g.IO.MouseDown[mouse_button])
active_id = 0;
if (active_id == id)
{
if (delta.x != 0.0f)
ImGui::SetScrollX(window, window->Scroll.x + delta.x);
if (delta.y != 0.0f)
ImGui::SetScrollY(window, window->Scroll.y + delta.y);
cumulated_delta += delta;
if (std::max(std::abs(cumulated_delta.x), std::abs(cumulated_delta.y)) > 50)
ImGui::ClearActiveID();
}
g.HoveredIdAllowOverlap = HoveredIdAllowOverlap_backup;
g.ActiveIdAllowOverlap = ActiveIdAllowOverlap_backup;
}
void CenterTextH(const std::string & text)
{
float win_width = ImGui::GetWindowSize().x;
float text_width = ImGui::CalcTextSize(text.c_str()).x;
ImGui::SetCursorPosX((win_width - text_width) / 2);
ImGui::Text("%s", text.c_str());
}
void CenterTextHV(const std::string & text)
{
ImVec2 size = ImGui::GetWindowSize();
std::vector<std::string> lines = utils::split(text);
float text_height = 0;
for (const auto & i: lines)
text_height += ImGui::CalcTextSize(i.c_str()).y;
ImGui::SetCursorPosY((size.y - text_height) / 2);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {0, 0});
for (const auto & i: lines)
{
float text_width = ImGui::CalcTextSize(i.c_str()).x;
ImGui::SetCursorPosX((size.x - text_width) / 2);
ImGui::Text("%s", i.c_str());
}
ImGui::PopStyleVar();
}
+37 -20
View File
@@ -36,14 +36,8 @@
#include <vulkan/vulkan_raii.hpp>
#include <openxr/openxr.h>
class imgui_context
class imgui_textures
{
struct command_buffer
{
vk::raii::CommandBuffer command_buffer = nullptr;
vk::raii::Fence fence = nullptr;
};
struct texture_data
{
vk::raii::Sampler sampler;
@@ -51,6 +45,38 @@ class imgui_context
std::shared_ptr<vk::raii::DescriptorSet> descriptor_set;
};
protected:
vk::raii::PhysicalDevice physical_device;
vk::raii::Device & device;
thread_safe<vk::raii::Queue> & queue;
vk::raii::DescriptorSetLayout ds_layout;
vk::raii::CommandPool command_pool;
private:
growable_descriptor_pool descriptor_pool;
std::unordered_map<ImTextureID, texture_data> textures;
public:
imgui_textures(
vk::raii::PhysicalDevice physical_device,
vk::raii::Device & device,
uint32_t queue_family_index,
thread_safe<vk::raii::Queue> & queue);
ImTextureID load_texture(const std::string & filename, vk::raii::Sampler && sampler);
ImTextureID load_texture(const std::string & filename);
ImTextureID load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler);
ImTextureID load_texture(const std::span<const std::byte> & bytes);
void free_texture(ImTextureID);
};
class imgui_context : public imgui_textures
{
struct command_buffer
{
vk::raii::CommandBuffer command_buffer = nullptr;
vk::raii::Fence fence = nullptr;
};
public:
struct imgui_frame
{
@@ -117,18 +143,10 @@ public:
};
private:
vk::raii::PhysicalDevice physical_device;
vk::raii::Device & device;
uint32_t queue_family_index;
thread_safe<vk::raii::Queue> & queue;
vk::raii::Pipeline pipeline = nullptr;
vk::raii::DescriptorSetLayout ds_layout;
growable_descriptor_pool descriptor_pool;
vk::raii::RenderPass renderpass;
vk::raii::CommandPool command_pool;
std::unordered_map<ImTextureID, texture_data> textures;
std::vector<imgui_frame> frames;
imgui_frame & get_frame(vk::Image destination);
@@ -207,11 +225,6 @@ public:
// Convert position from viewport coordinates to real-world
glm::vec3 rw_from_vp(const ImVec2 & position);
ImTextureID load_texture(const std::string & filename, vk::raii::Sampler && sampler);
ImTextureID load_texture(const std::string & filename);
ImTextureID load_texture(const std::span<const std::byte> & bytes, vk::raii::Sampler && sampler);
ImTextureID load_texture(const std::span<const std::byte> & bytes);
void free_texture(ImTextureID);
void set_current();
bool is_modal_popup_shown() const;
@@ -221,3 +234,7 @@ public:
void set_controllers_enabled(bool value);
void tooltip(std::string_view text);
};
void ScrollWhenDragging();
void CenterTextH(const std::string & text);
void CenterTextHV(const std::string & text);
+1 -1
View File
@@ -47,8 +47,8 @@ scene::scene(key, const meta & current_meta, std::span<const vk::Format> support
device(application::instance().vk_device),
physical_device(application::instance().vk_physical_device),
queue(application::instance().vk_queue),
commandpool(application::instance().vk_cmdpool),
queue_family_index(application::instance().vk_queue_family_index),
commandpool(application::instance().vk_cmdpool),
current_meta(current_meta)
{
swapchain_format = vk::Format::eUndefined;
+4 -1
View File
@@ -86,13 +86,16 @@ protected:
XrViewConfigurationType viewconfig;
bool focused = false;
public:
vk::raii::Instance & vk_instance;
vk::raii::Device & device;
vk::raii::PhysicalDevice & physical_device;
thread_safe<vk::raii::Queue> & queue;
vk::raii::CommandPool & commandpool;
uint32_t queue_family_index;
protected:
vk::raii::CommandPool & commandpool;
const meta & current_meta;
std::optional<scene_renderer> renderer;
+284
View File
@@ -0,0 +1,284 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#define IMGUI_DEFINE_MATH_OPERATORS
#include "app_launcher.h"
#include "constants.h"
#include "imgui.h"
#include "imgui_internal.h"
#include "scenes/stream.h"
#include "utils/i18n.h"
#include "utils/ranges.h"
#include <imspinner.h>
#include <spdlog/fmt/fmt.h>
#include <uni_algo/case.h>
using namespace std::chrono_literals;
// Display a button with an image and a text centred horizontally
static bool icon(
const std::string & text,
ImTextureRef tex_ref,
const ImVec2 & image_size,
ImGuiButtonFlags flags = 0,
const ImVec2 & size_arg = ImVec2(0, 0),
const ImVec2 & uv0 = ImVec2(0, 0),
const ImVec2 & uv1 = ImVec2(1, 1),
const ImVec4 & tint_col = ImVec4(1, 1, 1, 1))
{
// Based on ImGui::ButtonEx and ImGui::ImageButtonEx
ImGuiWindow * window = ImGui::GetCurrentWindow();
const ImGuiStyle & style = ImGui::GetStyle();
if (window->SkipItems)
return false;
const ImVec2 label_size = ImGui::CalcTextSize(text.c_str(), nullptr, true);
ImVec2 size = ImGui::CalcItemSize(
size_arg,
std::max(image_size.x, label_size.x) + style.FramePadding.x * 2.0f,
image_size.y + style.ItemInnerSpacing.y + label_size.y + style.FramePadding.y * 2.0f);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ImRect image_pos(
{(bb.Min.x + bb.Max.x - image_size.x) / 2, bb.Min.y + style.FramePadding.y},
{(bb.Min.x + bb.Max.x + image_size.x) / 2, bb.Min.y + style.FramePadding.y + image_size.y});
ImRect label_pos(
{bb.Min.x + style.FramePadding.x, image_pos.Max.y + style.ItemInnerSpacing.y},
{bb.Max.x - style.FramePadding.x, bb.Max.y - style.FramePadding.y});
ImGui::ItemSize(bb);
ImGuiID id = window->GetID(text.c_str());
if (!ImGui::ItemAdd(bb, id))
return false;
bool hovered, held;
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, flags);
// Render
const ImU32 col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered
: ImGuiCol_Button);
ImGui::RenderNavCursor(bb, id);
ImGui::RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
window->DrawList->AddImage(tex_ref, image_pos.Min, image_pos.Max, uv0, uv1, ImGui::GetColorU32(tint_col));
ImGui::RenderTextClipped(label_pos.Min, label_pos.Max, text.c_str(), NULL, &label_size, style.ButtonTextAlign, &bb);
return pressed;
}
app_launcher::app_launcher(
scenes::stream & stream,
std::string server_name) :
server_name(std::move(server_name)),
stream(stream),
textures(
stream.physical_device,
stream.device,
stream.queue_family_index,
stream.queue)
{
try
{
default_icon = textures.load_texture("default_icon.ktx2");
}
catch (...)
{
default_icon = textures.load_texture("default_icon.png");
}
}
app_launcher::~app_launcher()
{
stream.device.waitIdle();
for (const auto & [app_id, app_icon]: app_icons)
textures.free_texture(app_icon);
textures.free_texture(default_icon);
}
app_launcher::clicked app_launcher::draw_gui(imgui_context & imgui_ctx, const std::string & cancel)
{
auto res = clicked::None;
auto t0 = std::chrono::steady_clock::now();
bool app_starting = start_time != std::chrono::steady_clock::time_point{} and
t0 - start_time < 10s and
stream.current_state() != scenes::stream::state::streaming;
auto cancel_size = ImGui::CalcTextSize(cancel.c_str());
auto apps = applications.lock();
ImGui::PushFont(nullptr, constants::gui::font_size_large);
if (server_name.empty())
CenterTextH(_("Connected to WiVRn server"));
else
CenterTextH(fmt::format(_F("Connected to {}"), server_name));
ImGui::PopFont();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {20, 20});
if (apps->empty())
{
CenterTextHV(_("Start an application on the server to start streaming."));
}
else
{
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {20, 0});
ImGui::BeginDisabled(app_starting);
ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, cancel_size.y + 80), 0, app_starting ? ImGuiWindowFlags_NoScrollWithMouse : 0);
ImGui::Indent(20);
if (server_name.empty())
ImGui::Text("%s", _S("Start an application on your computer or select one to start streaming."));
else
ImGui::Text("%s", fmt::format(_F("Start an application on {} or select one to start streaming."), server_name).c_str());
ImGui::Unindent();
float icon_width = 400;
float icon_spacing = ImGui::GetStyle().ItemSpacing.x;
float usable_window_width = ImGui::GetWindowSize().x - ImGui::GetCurrentWindow()->ScrollbarSizes.x;
int icons_per_line = (usable_window_width + icon_spacing) / (icon_width + icon_spacing);
float icon_line_width = icons_per_line * icon_width + (icons_per_line - 1) * icon_spacing;
ImGui::Indent((usable_window_width - icon_line_width) / 2);
for (const auto [index, app]: utils::enumerate(*apps))
{
ImTextureID texture = [&]() -> ImTextureID {
if (app.image.empty())
return default_icon;
else
{
auto it = app_icons.find(app.id);
if (it == app_icons.end())
{
// Don't load too many textures at the same time to keep the GUI responsive
if (std::chrono::steady_clock::now() - t0 > 10ms)
return default_icon;
try
{
it = app_icons.emplace(app.id, textures.load_texture(app.image)).first;
}
catch (std::exception & e)
{
spdlog::warn("Unable to load icon for \"{}\": {}", app.id, e.what());
app.image.clear();
return default_icon;
}
}
return it->second;
}
}();
ImGui::PushStyleColor(ImGuiCol_Button, 0);
if (icon(app.name + "##" + app.id, texture, {256, 256}, ImGuiButtonFlags_PressedOnClickRelease, {icon_width, 0}))
{
res = clicked::Start;
start_time = t0;
stream.start_application(app.id);
}
imgui_ctx.vibrate_on_hover();
ImGui::PopStyleColor(); // ImGuiCol_Button
if ((index + 1) % icons_per_line)
ImGui::SameLine();
}
ImGui::Unindent();
std::vector<std::pair<std::string, ImTextureID>> to_be_removed;
for (const auto & [app_id, app_icon]: app_icons)
{
if (not std::ranges::contains(*apps, app_id, &app::id))
to_be_removed.emplace_back(app_id, app_icon);
}
for (const auto & [app_id, app_icon]: to_be_removed)
{
imgui_ctx.free_texture(app_icon);
app_icons.erase(app_id);
}
ScrollWhenDragging();
ImGui::EndChild();
ImGui::EndDisabled();
if (app_starting)
{
ImGui::SetCursorPos(ImGui::GetWindowSize() / 2 - ImVec2{200, 200} - ImGui::GetStyle().FramePadding);
ImSpinner::SpinnerAng("App starting spinner",
200, // Radius
40, // Thickness
ImColor{1.f, 1.f, 1.f, 1.f}, // Colour
ImColor{1.f, 1.f, 1.f, 0.f}, // Background
6, // Velocity
0.75f * 2 * M_PI // Angle
);
}
ImGui::PopStyleVar(); // ImGuiStyleVar_WindowPadding
}
ImGui::PopStyleVar();
ImGui::SetCursorPos(ImGui::GetWindowSize() - cancel_size - ImVec2{50, 50});
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {10, 10});
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.2f, 0.2f, 0.40f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.2f, 0.2f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0.1f, 0.1f, 1.00f));
if (ImGui::Button(cancel.c_str()))
res = clicked::Cancel;
imgui_ctx.vibrate_on_hover();
ImGui::PopStyleColor(3); // ImGuiCol_Button, ImGuiCol_ButtonHovered, ImGuiCol_ButtonActive
ImGui::PopStyleVar(2);
return res;
}
void app_launcher::operator()(to_headset::application_list && apps)
{
std::ranges::sort(apps.applications, [](auto & l, auto & r) {
return una::casesens::collate_utf8(l.name, r.name) < 0;
});
auto locked = applications.lock();
locked->clear();
locked->reserve(apps.applications.size());
for (const auto & i: apps.applications)
{
locked->push_back(app{
.id = std::move(i.id),
.name = std::move(i.name),
});
}
}
void app_launcher::operator()(to_headset::application_icon && icon)
{
auto locked = applications.lock();
if (auto it = std::ranges::find(*locked, icon.id, &app::id); it != locked->end())
it->image = std::move(icon.image);
}
+65
View File
@@ -0,0 +1,65 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "imgui.h"
#include "render/imgui_impl.h"
#include "wivrn_packets.h"
#include <chrono>
#include <unordered_map>
namespace scenes
{
class stream;
}
class app_launcher
{
struct app
{
std::string id;
std::string name;
std::vector<std::byte> image;
};
std::chrono::steady_clock::time_point start_time{};
std::string server_name;
scenes::stream & stream;
imgui_textures textures;
ImTextureID default_icon;
std::unordered_map<std::string, ImTextureID> app_icons;
// Last application list received from server
thread_safe<std::vector<app>> applications;
public:
app_launcher(scenes::stream &, std::string server_name);
~app_launcher();
enum clicked
{
None,
Cancel,
Start,
};
// cancel: text to display on the quit/disconnect/cancel button
clicked draw_gui(imgui_context &, const std::string & cancel);
void operator()(wivrn::to_headset::application_list && apps);
void operator()(wivrn::to_headset::application_icon && icon);
};
+1 -12
View File
@@ -572,7 +572,7 @@ void scenes::lobby::render(const XrFrameState & frame_state)
{
auto session = async_session.get();
if (session)
next_scene = stream::create(std::move(session), 1'000'000'000.f / frame_state.predictedDisplayPeriod);
next_scene = stream::create(std::move(session), 1'000'000'000.f / frame_state.predictedDisplayPeriod, server_name);
async_session.reset();
}
@@ -923,15 +923,6 @@ void scenes::lobby::on_focused()
about_picture = imgui_ctx->load_texture(image + ".png");
}
try
{
default_icon = imgui_ctx->load_texture("default_icon.ktx2");
}
catch (...)
{
default_icon = imgui_ctx->load_texture("default_icon.png");
}
setup_passthrough();
session.set_refresh_rate(application::get_config().preferred_refresh_rate.value_or(0));
multicast = application::get_wifi_lock().get_multicast_lock();
@@ -952,8 +943,6 @@ void scenes::lobby::on_unfocused()
renderer->wait_idle(); // Must be before the scene data because the renderer uses its descriptor sets
about_picture = 0;
default_icon = 0;
app_icons.clear();
imgui_ctx.reset();
world.clear(); // Must be cleared before the renderer so that the descriptor sets are freed before their pools
-3
View File
@@ -127,9 +127,6 @@ class lobby : public scene_impl<lobby>
tab last_current_tab = tab::server_list;
int optional_feature_index = 0; // Which step of the first run screen are we in
ImTextureID about_picture;
ImTextureID default_icon;
std::unordered_map<std::string, ImTextureID> app_icons;
std::optional<XrTime> timestamp_start_application;
virtual_keyboard keyboard;
+2 -258
View File
@@ -30,15 +30,13 @@
#include "imgui.h"
#include "imgui_internal.h"
#include "lobby.h"
#include "stream.h"
#include "scenes/stream.h"
#include "utils/i18n.h"
#include "utils/overloaded.h"
#include "utils/ranges.h"
#include "version.h"
#include "xr/body_tracker.h"
#include <algorithm>
#include <cassert>
#include <chrono>
#include <filesystem>
#include <glm/gtc/quaternion.hpp>
#include <imspinner.h>
@@ -52,81 +50,6 @@
using namespace std::chrono_literals;
// https://github.com/ocornut/imgui/issues/3379#issuecomment-2943903877
static void ScrollWhenDragging()
{
ImVec2 delta{0.0f, -ImGui::GetIO().MouseDelta.y};
const ImGuiMouseButton mouse_button = ImGuiMouseButton_Left;
ImGuiContext & g = *ImGui::GetCurrentContext();
ImGuiWindow * window = g.CurrentWindow;
ImGuiID id = window->GetID("##scrolldraggingoverlay");
ImGui::KeepAliveID(id);
static int active_id;
static ImVec2 cumulated_delta;
bool HoveredIdAllowOverlap_backup = std::exchange(g.HoveredIdAllowOverlap, true);
bool ActiveIdAllowOverlap_backup = std::exchange(g.ActiveIdAllowOverlap, true);
if (active_id == 0 and ImGui::ItemHoverable(window->Rect(), 0, g.CurrentItemFlags) and ImGui::IsMouseClicked(mouse_button, ImGuiInputFlags_None, /*id*/ ImGuiKeyOwner_Any))
{
active_id = id;
// Don't scroll on the first step, in case the active controller just changed
delta = {};
cumulated_delta = {};
}
if (not g.IO.MouseDown[mouse_button])
active_id = 0;
if (active_id == id)
{
if (delta.x != 0.0f)
ImGui::SetScrollX(window, window->Scroll.x + delta.x);
if (delta.y != 0.0f)
ImGui::SetScrollY(window, window->Scroll.y + delta.y);
cumulated_delta += delta;
if (std::max(std::abs(cumulated_delta.x), std::abs(cumulated_delta.y)) > 50)
ImGui::ClearActiveID();
}
g.HoveredIdAllowOverlap = HoveredIdAllowOverlap_backup;
g.ActiveIdAllowOverlap = ActiveIdAllowOverlap_backup;
}
static void CenterTextH(const std::string & text)
{
float win_width = ImGui::GetWindowSize().x;
float text_width = ImGui::CalcTextSize(text.c_str()).x;
ImGui::SetCursorPosX((win_width - text_width) / 2);
ImGui::Text("%s", text.c_str());
}
static void CenterTextHV(const std::string & text)
{
ImVec2 size = ImGui::GetWindowSize();
std::vector<std::string> lines = utils::split(text);
float text_height = 0;
for (const auto & i: lines)
text_height += ImGui::CalcTextSize(i.c_str()).y;
ImGui::SetCursorPosY((size.y - text_height) / 2);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {0, 0});
for (const auto & i: lines)
{
float text_width = ImGui::CalcTextSize(i.c_str()).x;
ImGui::SetCursorPosX((size.x - text_width) / 2);
ImGui::Text("%s", i.c_str());
}
ImGui::PopStyleVar();
}
static void InputText(const char * label, std::string & text, const ImVec2 & size, ImGuiInputTextFlags flags)
{
auto callback = [](ImGuiInputTextCallbackData * data) -> int {
@@ -175,54 +98,6 @@ static void display_recentering_tip(imgui_context & ctx, const std::string & tip
ImGui::PopFont();
}
// Display a button with an image and a text centred horizontally
static bool icon(const std::string & text, ImTextureRef tex_ref, const ImVec2 & image_size, ImGuiButtonFlags flags = 0, const ImVec2 & size_arg = ImVec2(0, 0), const ImVec2 & uv0 = ImVec2(0, 0), const ImVec2 & uv1 = ImVec2(1, 1), const ImVec4 & tint_col = ImVec4(1, 1, 1, 1))
{
// Based on ImGui::ButtonEx and ImGui::ImageButtonEx
ImGuiWindow * window = ImGui::GetCurrentWindow();
const ImGuiStyle & style = ImGui::GetStyle();
if (window->SkipItems)
return false;
const ImVec2 label_size = ImGui::CalcTextSize(text.c_str(), nullptr, true);
ImVec2 size = ImGui::CalcItemSize(
size_arg,
std::max(image_size.x, label_size.x) + style.FramePadding.x * 2.0f,
image_size.y + style.ItemInnerSpacing.y + label_size.y + style.FramePadding.y * 2.0f);
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ImRect image_pos(
{(bb.Min.x + bb.Max.x - image_size.x) / 2, bb.Min.y + style.FramePadding.y},
{(bb.Min.x + bb.Max.x + image_size.x) / 2, bb.Min.y + style.FramePadding.y + image_size.y});
ImRect label_pos(
{bb.Min.x + style.FramePadding.x, image_pos.Max.y + style.ItemInnerSpacing.y},
{bb.Max.x - style.FramePadding.x, bb.Max.y - style.FramePadding.y});
ImGui::ItemSize(bb);
ImGuiID id = window->GetID(text.c_str());
if (!ImGui::ItemAdd(bb, id))
return false;
bool hovered, held;
bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, flags);
// Render
const ImU32 col = ImGui::GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered
: ImGuiCol_Button);
ImGui::RenderNavCursor(bb, id);
ImGui::RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
window->DrawList->AddImage(tex_ref, image_pos.Min, image_pos.Max, uv0, uv1, ImGui::GetColorU32(tint_col));
ImGui::RenderTextClipped(label_pos.Min, label_pos.Max, text.c_str(), NULL, &label_size, style.ButtonTextAlign, &bb);
return pressed;
}
std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag)
{
switch (flag)
@@ -248,7 +123,6 @@ void scenes::lobby::gui_connecting(locked_notifiable<pin_request_data> & pin_req
if (next_scene)
{
current_tab = tab::connected;
timestamp_start_application.reset();
ImGui::CloseCurrentPopup();
return;
}
@@ -384,144 +258,14 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
if (not next_scene)
{
current_tab = tab::server_list;
for (const auto & [app_id, app_icon]: app_icons)
imgui_ctx->free_texture(app_icon);
app_icons.clear();
return;
}
ImGui::PushFont(nullptr, constants::gui::font_size_large);
if (server_name.empty())
CenterTextH(_("Connected to WiVRn server"));
else
CenterTextH(fmt::format(_F("Connected to {}"), server_name));
ImGui::PopFont();
auto disconnect = _("Disconnect");
auto disconnect_size = ImGui::CalcTextSize(disconnect.c_str());
auto apps = next_scene->get_applications();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {20, 20});
if (apps->empty())
{
CenterTextHV(_("Start an application on the server to start streaming."));
}
else
{
bool app_starting = timestamp_start_application and (predicted_display_time - *timestamp_start_application < 10'000'000'000);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {20, 0});
ImGui::BeginDisabled(app_starting);
ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, disconnect_size.y + 80), 0, app_starting ? ImGuiWindowFlags_NoScrollWithMouse : 0);
ImGui::Indent(20);
if (server_name.empty())
ImGui::Text("%s", _S("Start an application on your computer or select one to start streaming."));
else
ImGui::Text("%s", fmt::format(_F("Start an application on {} or select one to start streaming."), server_name).c_str());
ImGui::Unindent();
float icon_width = 400;
float icon_spacing = ImGui::GetStyle().ItemSpacing.x;
float usable_window_width = ImGui::GetWindowSize().x - ImGui::GetCurrentWindow()->ScrollbarSizes.x;
int icons_per_line = (usable_window_width + icon_spacing) / (icon_width + icon_spacing);
float icon_line_width = icons_per_line * icon_width + (icons_per_line - 1) * icon_spacing;
ImGui::Indent((usable_window_width - icon_line_width) / 2);
auto t0 = std::chrono::steady_clock::now();
for (const auto [index, app]: utils::enumerate(*apps))
{
ImTextureID texture = [&]() -> ImTextureID {
if (app.image.empty())
return default_icon;
else
{
auto it = app_icons.find(app.id);
if (it == app_icons.end())
{
// Don't load too many textures at the same time to keep the GUI responsive
if (std::chrono::steady_clock::now() - t0 > 10ms)
return default_icon;
try
{
it = app_icons.emplace(app.id, imgui_ctx->load_texture(app.image)).first;
}
catch (std::exception & e)
{
spdlog::warn("Unable to load icon for \"{}\": {}", app.id, e.what());
app.image.clear();
return default_icon;
}
}
return it->second;
}
}();
ImGui::PushStyleColor(ImGuiCol_Button, 0);
if (icon(app.name + "##" + app.id, texture, {256, 256}, ImGuiButtonFlags_PressedOnClickRelease, {icon_width, 0}))
{
timestamp_start_application = predicted_display_time;
next_scene->start_application(app.id);
}
imgui_ctx->vibrate_on_hover();
ImGui::PopStyleColor(); // ImGuiCol_Button
if (index % 3 != 2)
ImGui::SameLine();
}
ImGui::Unindent();
std::vector<std::pair<std::string, ImTextureID>> to_be_removed;
for (const auto & [app_id, app_icon]: app_icons)
{
if (not std::ranges::contains(*apps, app_id, &scenes::stream::app::id))
to_be_removed.emplace_back(app_id, app_icon);
}
for (const auto & [app_id, app_icon]: to_be_removed)
{
imgui_ctx->free_texture(app_icon);
app_icons.erase(app_id);
}
ScrollWhenDragging();
ImGui::EndChild();
ImGui::EndDisabled();
if (app_starting)
{
ImGui::SetCursorPos(ImGui::GetWindowSize() / 2 - ImVec2{200, 200} - ImGui::GetStyle().FramePadding);
ImSpinner::SpinnerAng("App starting spinner",
200, // Radius
40, // Thickness
ImColor{1.f, 1.f, 1.f, 1.f}, // Colour
ImColor{1.f, 1.f, 1.f, 0.f}, // Background
6, // Velocity
0.75f * 2 * M_PI // Angle
);
}
ImGui::PopStyleVar(); // ImGuiStyleVar_WindowPadding
}
ImGui::PopStyleVar();
ImGui::SetCursorPos(ImGui::GetWindowSize() - disconnect_size - ImVec2{50, 50});
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.2f, 0.2f, 0.40f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.2f, 0.2f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0.1f, 0.1f, 1.00f));
if (ImGui::Button(disconnect.c_str()))
if (next_scene->apps.draw_gui(*imgui_ctx, _("Disconnect")) == app_launcher::Cancel)
{
next_scene.reset();
current_tab = tab::server_list;
}
imgui_ctx->vibrate_on_hover();
ImGui::PopStyleColor(3); // ImGuiCol_Button, ImGuiCol_ButtonHovered, ImGuiCol_ButtonActive
}
void scenes::lobby::gui_new_server()
+12 -4
View File
@@ -151,8 +151,9 @@ static const std::array supported_depth_formats{
vk::Format::eX8D24UnormPack32,
};
scenes::stream::stream() :
scenes::stream::stream(std::string server_name) :
scene_impl<stream>(supported_color_formats, supported_depth_formats),
apps{*this, std::move(server_name)},
blitters{blitter(device, 0), blitter(device, 1)}
{
}
@@ -185,9 +186,9 @@ static from_headset::visibility_mask_changed::masks get_visibility_mask(xr::inst
return res;
}
std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_session> network_session, float guessed_fps)
std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_session> network_session, float guessed_fps, std::string server_name)
{
std::shared_ptr<stream> self{new stream};
std::shared_ptr<stream> self{new stream{std::move(server_name)}};
self->network_session = std::move(network_session);
self->network_session->send_control([&]() {
@@ -730,6 +731,8 @@ bool scenes::stream::is_gui_interactable() const
case gui_status::stats:
case gui_status::settings:
case gui_status::foveation_settings:
case gui_status::applications:
case gui_status::application_launcher:
return true;
case gui_status::hidden:
@@ -777,6 +780,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
.variant = application::get_messages_info().variant,
});
gui_status = stream::gui_status::hidden;
application::pop_scene();
}
@@ -1000,6 +1004,8 @@ void scenes::stream::render(const XrFrameState & frame_state)
break;
case gui_status::stats:
case gui_status::settings:
case gui_status::applications:
case gui_status::application_launcher:
dimming = dimming + frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration);
break;
}
@@ -1085,12 +1091,14 @@ void scenes::stream::render(const XrFrameState & frame_state)
case gui_status::hidden:
case gui_status::compact:
case gui_status::overlay_only:
gui_status = gui_status::stats;
gui_status = next_gui_status;
break;
case gui_status::stats:
case gui_status::settings:
case gui_status::foveation_settings:
case gui_status::applications:
case gui_status::application_launcher:
gui_status = gui_status::hidden;
break;
}
+15 -16
View File
@@ -19,6 +19,7 @@
#pragma once
#include "app_launcher.h"
#include "audio/audio.h"
#include "decoder/shard_accumulator.h"
#include "render/imgui_impl.h"
@@ -49,12 +50,7 @@ public:
};
static const size_t image_buffer_size = 3;
struct app
{
std::string id;
std::string name;
std::vector<std::byte> image;
};
app_launcher apps;
private:
static const size_t view_count = 2;
@@ -136,13 +132,16 @@ private:
compact,
stats,
settings,
foveation_settings
foveation_settings,
applications,
application_launcher,
};
bool is_gui_interactable() const;
std::atomic<gui_status> gui_status = gui_status::hidden;
enum gui_status last_gui_status = gui_status::hidden;
enum gui_status next_gui_status = gui_status::stats;
XrTime gui_status_last_change;
float dimming = 0;
@@ -170,15 +169,18 @@ private:
// Keep a reference to the resources needed to blit the images until vkWaitForFences
std::vector<std::shared_ptr<wivrn::shard_accumulator::blit_handle>> current_blit_handles;
// Last application list received from server
thread_safe<std::vector<app>> applications;
XrTime running_application_req = 0;
thread_safe<to_headset::running_applications> running_applications;
stream();
stream(std::string server_name);
public:
~stream();
static std::shared_ptr<stream> create(std::unique_ptr<wivrn_session> session, float guessed_fps);
static std::shared_ptr<stream> create(
std::unique_ptr<wivrn_session> session,
float guessed_fps,
std::string server_name);
void render(const XrFrameState &) override;
void on_focused() override;
@@ -198,6 +200,7 @@ public:
void operator()(to_headset::refresh_rate_change &&);
void operator()(to_headset::application_list &&);
void operator()(to_headset::application_icon &&);
void operator()(to_headset::running_applications &&);
void operator()(audio_data &&);
void push_blit_handle(wivrn::shard_accumulator * decoder, std::shared_ptr<wivrn::shard_accumulator::blit_handle> handle);
@@ -214,11 +217,6 @@ public:
return !exiting;
}
auto get_applications()
{
return applications.lock();
}
void start_application(std::string appid);
static meta & get_meta_scene();
@@ -305,6 +303,7 @@ private:
void gui_compact_view();
void gui_settings();
void gui_foveation_settings(float predicted_display_period);
void gui_applications();
void draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period);
};
} // namespace scenes
+106
View File
@@ -603,6 +603,85 @@ void scenes::stream::gui_foveation_settings(float predicted_display_period)
});
}
void scenes::stream::gui_applications()
{
auto now = instance.now();
if (now - running_application_req > 1'000'000'000)
{
running_application_req = now;
network_session->send_control(from_headset::get_running_applications{});
}
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {10, 10});
ImGui::PushFont(nullptr, constants::gui::font_size_large);
CenterTextH(_("Running XR applications:"));
ImGui::PopFont();
auto apps = running_applications.lock();
ImVec2 button_size(ImGui::GetWindowSize().x - ImGui::GetCursorPosX() - 20, 0);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(ImGui::GetStyle().ItemSpacing.x, 20));
ImGui::Spacing();
std::ranges::sort(apps->applications, [](auto & l, auto & r) {
if (l.overlay == r.overlay)
return false;
return r.overlay;
});
bool overlay = false;
for (const auto & app: apps->applications)
{
if (app.overlay and not overlay)
{
ImGui::Separator();
CenterTextH(_S("Overlays"));
overlay = true;
}
int colors = 1;
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32_BLACK_TRANS);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10, 20));
if (app.active or app.overlay)
{
ImGui::PushStyleColor(ImGuiCol_ButtonActive, IM_COL32_BLACK_TRANS);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, IM_COL32_BLACK_TRANS);
colors += 2;
}
ImGui::SetNextItemAllowOverlap();
const bool clicked = RadioButtonWithoutCheckBox(
std::format("{}{}##{}", app.active ? ICON_FA_CHEVRON_RIGHT " " : " ", app.name, app.id).c_str(),
app.active,
button_size);
if (clicked and not(app.active or app.overlay))
{
network_session->send_control(from_headset::set_active_application{.id = app.id});
imgui_ctx->vibrate_on_hover();
}
ImGui::PopStyleColor(colors);
ImGui::PopStyleVar(2);
ImGui::SameLine();
auto right = ImGui::GetWindowSize().x;
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10);
ImGui::SetCursorPosX(right - ImGui::CalcTextSize(ICON_FA_XMARK).x - ImGui::GetStyle().FramePadding.x - 40);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.2f, 0.2f, 0.40f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.2f, 0.2f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0.1f, 0.1f, 1.00f));
if (ImGui::Button(std::format(ICON_FA_XMARK "##{}", app.id).c_str()))
network_session->send_control(from_headset::stop_application{.id = app.id});
imgui_ctx->vibrate_on_hover();
ImGui::PopStyleColor(3);
if (ImGui::IsItemHovered())
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()))
gui_status = gui_status::application_launcher;
imgui_ctx->vibrate_on_hover();
ImGui::PopStyleVar(3);
}
// Return the vector v such that dot(v, x) > 0 iff x is on the side where the composition layer is visible
static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
{
@@ -642,6 +721,8 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
break;
case gui_status::stats:
case gui_status::settings:
case gui_status::applications:
case gui_status::application_launcher:
break;
}
imgui_ctx->set_controllers_enabled(interactable);
@@ -662,6 +743,8 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
if (gui_status != last_gui_status)
{
last_gui_status = gui_status;
if (is_gui_interactable())
next_gui_status = gui_status;
gui_status_last_change = predicted_display_time;
// Override session state if the GUI is interactable
@@ -708,6 +791,8 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::compact:
case gui_status::stats:
case gui_status::settings:
case gui_status::applications:
case gui_status::application_launcher:
imgui_ctx->layers()[0].orientation = head_position->second * head_gui_orientation;
imgui_ctx->layers()[0].position = head_position->first + M * head_gui_position;
break;
@@ -748,11 +833,18 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::stats:
case gui_status::settings:
case gui_status::applications:
ImGui::SetNextWindowPos(margin_around_window);
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size - margin_around_window * 2);
always_auto_resize = false;
display_tabs = true;
break;
case gui_status::application_launcher:
ImGui::SetNextWindowPos(margin_around_window);
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size - margin_around_window * 2);
always_auto_resize = false;
display_tabs = false;
break;
}
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0);
@@ -804,6 +896,17 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::foveation_settings:
gui_foveation_settings(predicted_display_period * 1.e-9f);
break;
case gui_status::applications:
ImGui::SetCursorPos({tab_width + 20, 20});
ImGui::BeginChild("Main", ImVec2(ImGui::GetWindowSize().x - ImGui::GetCursorPosX(), 0));
gui_applications();
ImGui::EndChild();
break;
case gui_status::application_launcher:
if (apps.draw_gui(*imgui_ctx, _("Cancel")) != app_launcher::None)
gui_status = gui_status::applications;
}
ImGui::PopStyleVar(2); // ImGuiStyleVar_WindowPadding, ImGuiStyleVar_FrameRounding
@@ -822,6 +925,9 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
RadioButtonWithoutCheckBox(ICON_FA_GEARS " " + _("Settings"), gui_status, gui_status::settings, {tab_width, 0});
imgui_ctx->vibrate_on_hover();
RadioButtonWithoutCheckBox(ICON_FA_LIST " " + _("Applications"), gui_status, gui_status::applications, {tab_width, 0});
imgui_ctx->vibrate_on_hover();
int n_items_at_end = 4;
ImGui::SetCursorPosY(ImGui::GetContentRegionMax().y - n_items_at_end * ImGui::GetCurrentContext()->FontSize - (n_items_at_end * 2) * style.FramePadding.y - (n_items_at_end - 1) * style.ItemSpacing.y - style.WindowPadding.y);
+7 -19
View File
@@ -106,31 +106,19 @@ void scenes::stream::send_feedback(const wivrn::from_headset::feedback & feedbac
}
}
void scenes::stream::operator()(to_headset::application_list && apps)
void scenes::stream::operator()(to_headset::application_list && l)
{
std::ranges::sort(apps.applications, [](auto & l, auto & r) {
return una::casesens::collate_utf8(l.name, r.name) < 0;
});
auto locked = applications.lock();
locked->clear();
locked->reserve(apps.applications.size());
for (const auto & i: apps.applications)
{
locked->push_back(app{
.id = std::move(i.id),
.name = std::move(i.name),
});
}
apps(std::move(l));
}
void scenes::stream::operator()(to_headset::application_icon && icon)
{
auto locked = applications.lock();
apps(std::move(icon));
}
if (auto it = std::ranges::find(*locked, icon.id, &app::id); it != locked->end())
it->image = std::move(icon.image);
void scenes::stream::operator()(to_headset::running_applications && apps)
{
*running_applications.lock() = std::move(apps);
}
void scenes::stream::start_application(std::string appid)
+32 -2
View File
@@ -235,6 +235,7 @@ struct headset_info_packet
bool hand_tracking;
bool eye_gaze;
bool palm_pose;
bool user_presence;
bool passthrough;
face_type face_tracking;
uint32_t num_generic_trackers;
@@ -461,6 +462,19 @@ struct start_app
std::string app_id;
};
struct get_running_applications
{};
struct set_active_application
{
uint32_t id;
};
struct stop_application
{
uint32_t id;
};
using packets = std::variant<
crypto_handshake,
pin_check_1,
@@ -483,7 +497,10 @@ using packets = std::variant<
user_presence_changed,
override_foveation_center,
get_application_list,
start_app>;
start_app,
get_running_applications,
set_active_application,
stop_application>;
} // namespace from_headset
namespace to_headset
@@ -691,6 +708,18 @@ struct application_icon
std::vector<std::byte> image; // In PNG
};
struct running_applications
{
struct application
{
std::string name;
uint32_t id;
bool overlay;
bool active;
};
std::vector<application> applications;
};
using packets = std::variant<
crypto_handshake,
pin_check_2,
@@ -705,6 +734,7 @@ using packets = std::variant<
tracking_control,
refresh_rate_change,
application_list,
application_icon>;
application_icon,
running_applications>;
} // namespace to_headset
} // namespace wivrn
+138 -118
View File
@@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-09-18 00:05+0200\n"
"PO-Revision-Date: 2025-09-18 00:05+0200\n"
"POT-Creation-Date: 2025-09-27 16:57+0200\n"
"PO-Revision-Date: 2025-09-27 16:57+0200\n"
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
"Language-Team: French <>\n"
"Language: French\n"
@@ -19,6 +19,33 @@ msgstr ""
msgid "No supported swapchain format"
msgstr "Aucun format de swapchain supporté"
#: client/scenes/app_launcher.cpp:135
msgid "Connected to WiVRn server"
msgstr "Connecté au serveur WiVRn"
#: client/scenes/app_launcher.cpp:137
#, c++-format
msgid "Connected to {}"
msgstr "Connecté à {}"
#: client/scenes/app_launcher.cpp:143
msgid "Start an application on the server to start streaming."
msgstr ""
"Démarrez une application sur le serveur pour commencer la transmission."
#: client/scenes/app_launcher.cpp:153
msgid "Start an application on your computer or select one to start streaming."
msgstr ""
"Démarrez une application sur le serveur ou depuis la liste pour commencer la "
"transmission."
#: client/scenes/app_launcher.cpp:155
#, c++-format
msgid "Start an application on {} or select one to start streaming."
msgstr ""
"Démarrez une application sur {} ou depuis la liste pour commencer la "
"transmission."
#: client/scenes/lobby.cpp:185
msgid "Incompatible WiVRn server: no protocol field in TXT"
msgstr "Serveur WiVRn incompatible : pas de champ protocol dans le TXT"
@@ -43,99 +70,72 @@ msgstr "Impossible de se connecter à {} ({}): {}"
msgid "Waiting for connection"
msgstr "Attente de connexion"
#: client/scenes/lobby_gui.cpp:232
#: client/scenes/lobby_gui.cpp:107
msgctxt "openxr_post_processing"
msgid "Normal"
msgstr "Normal"
#: client/scenes/lobby_gui.cpp:235
#: client/scenes/lobby_gui.cpp:110
msgctxt "openxr_post_processing"
msgid "Quality"
msgstr "Qualité"
#: client/scenes/lobby_gui.cpp:237
#: client/scenes/lobby_gui.cpp:112
msgctxt "openxr_post_processing"
msgid "Disabled"
msgstr "Désactivé"
#: client/scenes/lobby_gui.cpp:245 client/scenes/lobby_gui.cpp:402
#: client/scenes/stream_gui.cpp:838
#: client/scenes/lobby_gui.cpp:120 client/scenes/lobby_gui.cpp:264
#: client/scenes/stream_gui.cpp:944
msgid "Disconnect"
msgstr "Déconnecter"
#: client/scenes/lobby_gui.cpp:266 client/scenes/stream_gui.cpp:834
#: client/scenes/lobby_gui.cpp:140 client/scenes/stream_gui.cpp:940
msgid "Close"
msgstr "Fermer"
#: client/scenes/lobby_gui.cpp:272
#: client/scenes/lobby_gui.cpp:146
msgid "Connection"
msgstr "Connexion en cours"
#: client/scenes/lobby_gui.cpp:274
#: client/scenes/lobby_gui.cpp:148
#, c++-format
msgid "Connection to {}"
msgstr "Connexion à {}"
#: client/scenes/lobby_gui.cpp:304
#: client/scenes/lobby_gui.cpp:178
msgid "PIN"
msgstr "Code PIN"
#: client/scenes/lobby_gui.cpp:326
#: client/scenes/lobby_gui.cpp:200
msgid "Input the PIN displayed on the dashboard"
msgstr "Entrez le code PIN affiché sur le tableau de bord"
#: client/scenes/lobby_gui.cpp:397
msgid "Connected to WiVRn server"
msgstr "Connecté au serveur WiVRn"
#: client/scenes/lobby_gui.cpp:399
#, c++-format
msgid "Connected to {}"
msgstr "Connecté à {}"
#: client/scenes/lobby_gui.cpp:409
msgid "Start an application on the server to start streaming."
msgstr ""
"Démarrez une application sur le serveur pour commencer la transmission."
#: client/scenes/lobby_gui.cpp:421
msgid "Start an application on your computer or select one to start streaming."
msgstr ""
"Démarrez une application sur le serveur ou depuis la liste pour commencer la "
"transmission."
#: client/scenes/lobby_gui.cpp:423
#, c++-format
msgid "Start an application on {} or select one to start streaming."
msgstr ""
"Démarrez une application sur {} ou depuis la liste pour commencer la "
"transmission."
#: client/scenes/lobby_gui.cpp:546
#: client/scenes/lobby_gui.cpp:290
msgid "Name"
msgstr "Nom"
#: client/scenes/lobby_gui.cpp:557
#: client/scenes/lobby_gui.cpp:301
msgid "Address"
msgstr "Adresse"
#: client/scenes/lobby_gui.cpp:566
#: client/scenes/lobby_gui.cpp:310
msgid "Port"
msgstr "Port"
#: client/scenes/lobby_gui.cpp:574
#: client/scenes/lobby_gui.cpp:318
msgid "TCP only"
msgstr "TCP seulement"
#: client/scenes/lobby_gui.cpp:581
#: client/scenes/lobby_gui.cpp:325 client/scenes/stream_gui.cpp:908
msgid "Cancel"
msgstr "Annuler"
#: client/scenes/lobby_gui.cpp:595
#: client/scenes/lobby_gui.cpp:339
msgid "Save"
msgstr "Enregistrer"
#: client/scenes/lobby_gui.cpp:648
#: client/scenes/lobby_gui.cpp:392
msgid ""
"Start a WiVRn server on your\n"
"local network"
@@ -143,45 +143,45 @@ msgstr ""
"Démarrez un serveur WiVRn sur\n"
"le réseau local"
#: client/scenes/lobby_gui.cpp:680
#: client/scenes/lobby_gui.cpp:424
msgid "Autoconnect"
msgstr "Autoconnexion"
#: client/scenes/lobby_gui.cpp:706
#: client/scenes/lobby_gui.cpp:450
msgid "Connect"
msgstr "Connexion"
#: client/scenes/lobby_gui.cpp:716 client/wivrn_client.cpp:186
#: client/scenes/lobby_gui.cpp:460 client/wivrn_client.cpp:186
msgid "Incompatible server version"
msgstr "Version du serveur incompatible"
#: client/scenes/lobby_gui.cpp:718
#: client/scenes/lobby_gui.cpp:462
msgid "Server not available"
msgstr "Serveur non disponible"
#: client/scenes/lobby_gui.cpp:800
#: client/scenes/lobby_gui.cpp:544
msgctxt "language selection, replace with the name of the language"
msgid "English"
msgstr "Français"
#: client/scenes/lobby_gui.cpp:814
#: client/scenes/lobby_gui.cpp:558
msgid "Language"
msgstr "Langue"
#: client/scenes/lobby_gui.cpp:814 client/scenes/lobby_gui.cpp:816
#: client/scenes/lobby_gui.cpp:558 client/scenes/lobby_gui.cpp:560
msgid "System language"
msgstr "Langue système"
#: client/scenes/lobby_gui.cpp:841
#: client/scenes/lobby_gui.cpp:585
msgid "Refresh rate"
msgstr "Taux de rafraichissement"
#: client/scenes/lobby_gui.cpp:841 client/scenes/lobby_gui.cpp:843
#: client/scenes/lobby_gui.cpp:585 client/scenes/lobby_gui.cpp:587
msgctxt "automatic refresh rate"
msgid "Automatic"
msgstr "Automatique"
#: client/scenes/lobby_gui.cpp:850
#: client/scenes/lobby_gui.cpp:594
msgid ""
"Select refresh rate based on measured application performance.\n"
"May cause flicker when a change happens."
@@ -190,59 +190,59 @@ msgstr ""
"des performances mesurées.\n"
"Peut causer des clignotements lors du changement de fréquence."
#: client/scenes/lobby_gui.cpp:867
#: client/scenes/lobby_gui.cpp:611
msgid "Minimum refresh rate"
msgstr "Taux minimal"
#: client/scenes/lobby_gui.cpp:890
#: client/scenes/lobby_gui.cpp:634
msgid "Resolution scale"
msgstr "Échelle"
#: client/scenes/lobby_gui.cpp:894
#: client/scenes/lobby_gui.cpp:638
#, c-format, c++-format
msgid "%d%% - {}x{} per eye"
msgstr "%d%% - {}x{} par œil"
#: client/scenes/lobby_gui.cpp:905
#: client/scenes/lobby_gui.cpp:649
#, c++-format
msgid "Resolution larger than {}x{} may not be supported by the headset"
msgstr "Les résolutions plus grandes que {}x{} pourraient ne pas fonctionner"
#: client/scenes/lobby_gui.cpp:911
#: client/scenes/lobby_gui.cpp:655
msgid "Enable microphone"
msgstr "Activer le micro"
#: client/scenes/lobby_gui.cpp:920
#: client/scenes/lobby_gui.cpp:664
msgid "Unprocessed Microphone Audio"
msgstr "Utiliser les données brutes du micro"
#: client/scenes/lobby_gui.cpp:926
#: client/scenes/lobby_gui.cpp:670
msgid "Force disable audio filters, such as noise cancellation"
msgstr "Désactive les traitements tels que la suppression du bruit"
#: client/scenes/lobby_gui.cpp:933
#: client/scenes/lobby_gui.cpp:677
msgid "Enable hand tracking"
msgstr "Activer le suivi des mains"
#: client/scenes/lobby_gui.cpp:939 client/scenes/lobby_gui.cpp:951
#: client/scenes/lobby_gui.cpp:963 client/scenes/lobby_gui.cpp:980
#: client/scenes/lobby_gui.cpp:1025
#: client/scenes/lobby_gui.cpp:683 client/scenes/lobby_gui.cpp:695
#: client/scenes/lobby_gui.cpp:707 client/scenes/lobby_gui.cpp:724
#: client/scenes/lobby_gui.cpp:769
msgid "This feature is not supported by your headset"
msgstr "Cette fonctionnalité n'est pas supportée par le casque"
#: client/scenes/lobby_gui.cpp:945
#: client/scenes/lobby_gui.cpp:689
msgid "Enable eye tracking"
msgstr "Activer le suivi des yeux"
#: client/scenes/lobby_gui.cpp:957
#: client/scenes/lobby_gui.cpp:701
msgid "Enable face tracking"
msgstr "Activer le suivi du visage"
#: client/scenes/lobby_gui.cpp:971
#: client/scenes/lobby_gui.cpp:715
msgid "Enable body tracking"
msgstr "Activer le suivi du corps"
#: client/scenes/lobby_gui.cpp:985
#: client/scenes/lobby_gui.cpp:729
msgid ""
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
"tracking settings,\n"
@@ -253,11 +253,11 @@ msgstr ""
"suivi des mouvements du casque.\n"
"Sinon les positions seront déduites de celles des manettes et casque."
#: client/scenes/lobby_gui.cpp:995
#: client/scenes/lobby_gui.cpp:739
msgid "Enable lower body tracking"
msgstr "Activer le suivi du bas du corps"
#: client/scenes/lobby_gui.cpp:1001
#: client/scenes/lobby_gui.cpp:745
msgid ""
"Estimate lower body joint positions using Generative Legs\n"
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
@@ -268,11 +268,11 @@ msgstr ""
"paramètres\n"
"de suivi de mouvements du casque."
#: client/scenes/lobby_gui.cpp:1004
#: client/scenes/lobby_gui.cpp:748
msgid "Enable hip tracking"
msgstr "Activer le suivi des hanches"
#: client/scenes/lobby_gui.cpp:1010
#: client/scenes/lobby_gui.cpp:754
msgid ""
"Only takes affect with lower body tracking enabled\n"
"May be desired when using another source of hip tracking"
@@ -280,15 +280,15 @@ msgstr ""
"N'a d'effet que si le suivi du bas du corps est activé.\n"
"Peut être utile si les hanches sont suivies via un autre moyen."
#: client/scenes/lobby_gui.cpp:1018
#: client/scenes/lobby_gui.cpp:762
msgid "Enable video passthrough in lobby"
msgstr "Activer la vue réelle dans l'accueil"
#: client/scenes/lobby_gui.cpp:1029
#: client/scenes/lobby_gui.cpp:773
msgid "Enable in-stream window"
msgstr "Activer la fenêtre WiVRn lors de la transmission"
#: client/scenes/lobby_gui.cpp:1032
#: client/scenes/lobby_gui.cpp:776
msgid ""
"Enables the configuration window to be shown while the game is streaming.\n"
"If enabled, the window is activated by pressing both thumbsticks."
@@ -298,15 +298,15 @@ msgstr ""
"Lorsque activé, la fenêtre peut être affichée en appuyant sur les deux "
"sticks."
#: client/scenes/lobby_gui.cpp:1046 client/scenes/stream_gui.cpp:445
#: client/scenes/lobby_gui.cpp:790 client/scenes/stream_gui.cpp:445
msgid "OpenXR post-processing"
msgstr "Post-traitement OpenXR"
#: client/scenes/lobby_gui.cpp:1050 client/scenes/stream_gui.cpp:449
#: client/scenes/lobby_gui.cpp:794 client/scenes/stream_gui.cpp:449
msgid "Supersampling"
msgstr "Suréchantillonnage"
#: client/scenes/lobby_gui.cpp:1070 client/scenes/stream_gui.cpp:470
#: client/scenes/lobby_gui.cpp:814 client/scenes/stream_gui.cpp:470
msgid ""
"Reduce flicker for high contrast edges.\n"
"Useful when the input resolution is high compared to the headset display"
@@ -314,11 +314,11 @@ msgstr ""
"Réduit le scintillement des contours à haut contraste.\n"
"Utile quand la résolution d’entrée est haute comparée à l’écran du casque"
#: client/scenes/lobby_gui.cpp:1075 client/scenes/stream_gui.cpp:475
#: client/scenes/lobby_gui.cpp:819 client/scenes/stream_gui.cpp:475
msgid "Sharpening"
msgstr "Affinage de netteté"
#: client/scenes/lobby_gui.cpp:1095 client/scenes/stream_gui.cpp:496
#: client/scenes/lobby_gui.cpp:839 client/scenes/stream_gui.cpp:496
msgid ""
"Improve clarity of high contrast edges and counteract blur.\n"
"Useful when the input resolution is low compared to the headset display"
@@ -326,125 +326,125 @@ msgstr ""
"Améliore la clarté des contours à haut contraste et réduit le flou.\n"
"Utile quand la résolution d’entrée est basse comparée à l’écran du casque"
#: client/scenes/lobby_gui.cpp:1191 client/scenes/lobby_gui.cpp:1199
#: client/scenes/lobby_gui.cpp:935 client/scenes/lobby_gui.cpp:943
#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:424
msgid "CPU time"
msgstr "Temps CPU"
#: client/scenes/lobby_gui.cpp:1195
#: client/scenes/lobby_gui.cpp:939
msgid "CPU time [ms]"
msgstr "Temps CPU [ms]"
#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1213
#: client/scenes/lobby_gui.cpp:949 client/scenes/lobby_gui.cpp:957
#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:425
msgid "GPU time"
msgstr "Temps GPU"
#: client/scenes/lobby_gui.cpp:1209
#: client/scenes/lobby_gui.cpp:953
msgid "GPU time [ms]"
msgstr "Temps GPU [ms]"
#: client/scenes/lobby_gui.cpp:1252
#: client/scenes/lobby_gui.cpp:996
msgid "Enable the microphone?"
msgstr "Activer le micro ?"
#: client/scenes/lobby_gui.cpp:1257
#: client/scenes/lobby_gui.cpp:1001
msgid "Enable eye tracking?"
msgstr "Activer le suivi des yeux ?"
#: client/scenes/lobby_gui.cpp:1262
#: client/scenes/lobby_gui.cpp:1006
msgid "Enable face tracking?"
msgstr "Activer le suivi du visage ?"
#: client/scenes/lobby_gui.cpp:1267
#: client/scenes/lobby_gui.cpp:1011
msgid "Enable body tracking?"
msgstr "Activer le suivi du corps ?"
#: client/scenes/lobby_gui.cpp:1275
#: client/scenes/lobby_gui.cpp:1019
msgid "Welcome to WiVRn"
msgstr "Bienvenue sur WiVRn"
#: client/scenes/lobby_gui.cpp:1299
#: client/scenes/lobby_gui.cpp:1043
msgid "Yes"
msgstr "Oui"
#: client/scenes/lobby_gui.cpp:1306
#: client/scenes/lobby_gui.cpp:1050
msgid "No"
msgstr "Non"
#: client/scenes/lobby_gui.cpp:1325 client/scenes/lobby_gui.cpp:1972
#: client/scenes/lobby_gui.cpp:1069 client/scenes/lobby_gui.cpp:1716
msgid "Licenses"
msgstr "Licences"
#: client/scenes/lobby_gui.cpp:1650
#: client/scenes/lobby_gui.cpp:1394
msgid "Microphone is enabled"
msgstr "Le micro est activé"
#: client/scenes/lobby_gui.cpp:1651
#: client/scenes/lobby_gui.cpp:1395
msgid "Microphone is disabled"
msgstr "Le micro est désactivé"
#: client/scenes/lobby_gui.cpp:1660
#: client/scenes/lobby_gui.cpp:1404
msgid "Hand tracking is enabled"
msgstr "Le suivi des mains est activé"
#: client/scenes/lobby_gui.cpp:1661
#: client/scenes/lobby_gui.cpp:1405
msgid "Hand tracking is disabled"
msgstr "Le suivi des mains est désactivé"
#: client/scenes/lobby_gui.cpp:1670
#: client/scenes/lobby_gui.cpp:1414
msgid "Eye tracking is enabled"
msgstr "Le suivi des yeux est activé"
#: client/scenes/lobby_gui.cpp:1671
#: client/scenes/lobby_gui.cpp:1415
msgid "Eye tracking is disabled"
msgstr "Le suivi des yeux est désactivé"
#: client/scenes/lobby_gui.cpp:1681
#: client/scenes/lobby_gui.cpp:1425
msgid "Face tracking is enabled"
msgstr "Le suivi du visage est activé"
#: client/scenes/lobby_gui.cpp:1682
#: client/scenes/lobby_gui.cpp:1426
msgid "Face tracking is disabled"
msgstr "Le suivi du visage est désactivé"
#: client/scenes/lobby_gui.cpp:1692
#: client/scenes/lobby_gui.cpp:1436
msgid "Body tracking is enabled"
msgstr "Le suivi du corps est activé"
#: client/scenes/lobby_gui.cpp:1693
#: client/scenes/lobby_gui.cpp:1437
msgid "Body tracking is disabled"
msgstr "Le suivi du corps est désactivé"
#: client/scenes/lobby_gui.cpp:1709
#: client/scenes/lobby_gui.cpp:1453
msgid "Add server"
msgstr "Ajouter un serveur"
#: client/scenes/lobby_gui.cpp:1954
#: client/scenes/lobby_gui.cpp:1698
msgid "Server list"
msgstr "Serveurs"
#: client/scenes/lobby_gui.cpp:1957 client/scenes/stream_gui.cpp:822
#: client/scenes/lobby_gui.cpp:1701 client/scenes/stream_gui.cpp:925
msgid "Settings"
msgstr "Paramètres"
#: client/scenes/lobby_gui.cpp:1960
#: client/scenes/lobby_gui.cpp:1704
msgid "Post-processing"
msgstr "Post-traitement"
#: client/scenes/lobby_gui.cpp:1964
#: client/scenes/lobby_gui.cpp:1708
msgid "Debug"
msgstr "Debug"
#: client/scenes/lobby_gui.cpp:1969
#: client/scenes/lobby_gui.cpp:1713
msgid "About"
msgstr "À propos"
#: client/scenes/lobby_gui.cpp:1975
#: client/scenes/lobby_gui.cpp:1719
msgid "Exit"
msgstr "Quitter"
#: client/scenes/lobby_gui.cpp:1992
#: client/scenes/lobby_gui.cpp:1736
msgid ""
"Press the grip button or put your palm up\n"
"to move the main window"
@@ -452,7 +452,7 @@ msgstr ""
"Serrez la gâchette latérale ou pointez la paume\n"
"vers le haut pour bouger la fenêtre principale"
#: client/scenes/lobby_gui.cpp:1994
#: client/scenes/lobby_gui.cpp:1738
msgid "Press the grip button to move the main window"
msgstr "Serrez la gâchette latérale pour bouger la fenêtre principale"
@@ -522,7 +522,7 @@ msgstr "Latence mouvement à photons estimée: {}ms"
msgid "Press the grip button to move the window"
msgstr "Serrez la gâchette latérale pour bouger la fenêtre"
#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:776
#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:868
msgid "Press both thumbsticks to display the WiVRn window"
msgstr "Appuyez sur les deux sticks pour afficher la fenêtre de WiVRn"
@@ -564,15 +564,35 @@ msgstr "Utiliser le stick pour bouger le centre de fovéation"
msgid "Press A to save or B to cancel"
msgstr "A pour sauvegarder, B pour annuler"
#: client/scenes/stream_gui.cpp:819
#: client/scenes/stream_gui.cpp:618
msgid "Running XR applications:"
msgstr "Applications XR lancées :"
#: client/scenes/stream_gui.cpp:635
msgid "Overlays"
msgstr "Surcouches"
#: client/scenes/stream_gui.cpp:674
msgid "Request to quit, may be ignored by the application"
msgstr "Demande de quitter, peut être ignoré par l'application"
#: client/scenes/stream_gui.cpp:677
msgid "Start"
msgstr "Démarrer"
#: client/scenes/stream_gui.cpp:922
msgid "Stats"
msgstr "Statistiques"
#: client/scenes/stream_gui.cpp:828
#: client/scenes/stream_gui.cpp:928
msgid "Applications"
msgstr "Applications"
#: client/scenes/stream_gui.cpp:934
msgid "Statistics overlay"
msgstr "Statistiques seules"
#: client/scenes/stream_gui.cpp:831
#: client/scenes/stream_gui.cpp:937
msgid "Compact view"
msgstr "Vue compacte"
+137 -117
View File
@@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-09-18 00:05+0200\n"
"PO-Revision-Date: 2025-09-18 00:05+0200\n"
"POT-Creation-Date: 2025-09-27 16:57+0200\n"
"PO-Revision-Date: 2025-09-27 16:57+0200\n"
"Last-Translator: Albano Battistella <albanobattistella@gmail.com>\n"
"Language-Team: Italian <>\n"
"Language: Italian\n"
@@ -19,6 +19,32 @@ msgstr ""
msgid "No supported swapchain format"
msgstr "Nessun formato swapchain supportato"
#: client/scenes/app_launcher.cpp:135
msgid "Connected to WiVRn server"
msgstr "Connesso al server WiVRn"
#: client/scenes/app_launcher.cpp:137
#, c++-format
msgid "Connected to {}"
msgstr "Connesso a {}"
#: client/scenes/app_launcher.cpp:143
msgid "Start an application on the server to start streaming."
msgstr "Avvia un applicazione sul server per incominciare a trasmettere."
#: client/scenes/app_launcher.cpp:153
msgid "Start an application on your computer or select one to start streaming."
msgstr ""
"Avvia un applicazione sul computer o scegli dalla lista per incominciare a "
"trasmettere."
#: client/scenes/app_launcher.cpp:155
#, c++-format
msgid "Start an application on {} or select one to start streaming."
msgstr ""
"Avvia un applicazione su {} o scegli dalla lista per incominciare a "
"trasmettere."
#: client/scenes/lobby.cpp:185
msgid "Incompatible WiVRn server: no protocol field in TXT"
msgstr "Server WiVRn incompatibile: nessun campo protocollo in TXT"
@@ -42,98 +68,72 @@ msgstr "Impossibile connettersi a {} ({}): {}"
msgid "Waiting for connection"
msgstr "In attesa di connessione"
#: client/scenes/lobby_gui.cpp:232
#: client/scenes/lobby_gui.cpp:107
msgctxt "openxr_post_processing"
msgid "Normal"
msgstr "Normale"
#: client/scenes/lobby_gui.cpp:235
#: client/scenes/lobby_gui.cpp:110
msgctxt "openxr_post_processing"
msgid "Quality"
msgstr "Alta qualità"
#: client/scenes/lobby_gui.cpp:237
#: client/scenes/lobby_gui.cpp:112
msgctxt "openxr_post_processing"
msgid "Disabled"
msgstr "Disattivato"
#: client/scenes/lobby_gui.cpp:245 client/scenes/lobby_gui.cpp:402
#: client/scenes/stream_gui.cpp:838
#: client/scenes/lobby_gui.cpp:120 client/scenes/lobby_gui.cpp:264
#: client/scenes/stream_gui.cpp:944
msgid "Disconnect"
msgstr "Sconnetti"
#: client/scenes/lobby_gui.cpp:266 client/scenes/stream_gui.cpp:834
#: client/scenes/lobby_gui.cpp:140 client/scenes/stream_gui.cpp:940
msgid "Close"
msgstr "Chiudi"
#: client/scenes/lobby_gui.cpp:272
#: client/scenes/lobby_gui.cpp:146
msgid "Connection"
msgstr "Connessione"
#: client/scenes/lobby_gui.cpp:274
#: client/scenes/lobby_gui.cpp:148
#, c++-format
msgid "Connection to {}"
msgstr "Connessione a {}"
#: client/scenes/lobby_gui.cpp:304
#: client/scenes/lobby_gui.cpp:178
msgid "PIN"
msgstr "PIN"
#: client/scenes/lobby_gui.cpp:326
#: client/scenes/lobby_gui.cpp:200
msgid "Input the PIN displayed on the dashboard"
msgstr "Digitare il PIN visibile sul server"
#: client/scenes/lobby_gui.cpp:397
msgid "Connected to WiVRn server"
msgstr "Connesso al server WiVRn"
#: client/scenes/lobby_gui.cpp:399
#, c++-format
msgid "Connected to {}"
msgstr "Connesso a {}"
#: client/scenes/lobby_gui.cpp:409
msgid "Start an application on the server to start streaming."
msgstr "Avvia un applicazione sul server per incominciare a trasmettere."
#: client/scenes/lobby_gui.cpp:421
msgid "Start an application on your computer or select one to start streaming."
msgstr ""
"Avvia un applicazione sul computer o scegli dalla lista per incominciare a "
"trasmettere."
#: client/scenes/lobby_gui.cpp:423
#, c++-format
msgid "Start an application on {} or select one to start streaming."
msgstr ""
"Avvia un applicazione su {} o scegli dalla lista per incominciare a "
"trasmettere."
#: client/scenes/lobby_gui.cpp:546
#: client/scenes/lobby_gui.cpp:290
msgid "Name"
msgstr "Nome"
#: client/scenes/lobby_gui.cpp:557
#: client/scenes/lobby_gui.cpp:301
msgid "Address"
msgstr "Indirizzo"
#: client/scenes/lobby_gui.cpp:566
#: client/scenes/lobby_gui.cpp:310
msgid "Port"
msgstr "Porta"
#: client/scenes/lobby_gui.cpp:574
#: client/scenes/lobby_gui.cpp:318
msgid "TCP only"
msgstr "Solo TCP"
#: client/scenes/lobby_gui.cpp:581
#: client/scenes/lobby_gui.cpp:325 client/scenes/stream_gui.cpp:908
msgid "Cancel"
msgstr "Annulla"
#: client/scenes/lobby_gui.cpp:595
#: client/scenes/lobby_gui.cpp:339
msgid "Save"
msgstr "Salva"
#: client/scenes/lobby_gui.cpp:648
#: client/scenes/lobby_gui.cpp:392
msgid ""
"Start a WiVRn server on your\n"
"local network"
@@ -141,45 +141,45 @@ msgstr ""
"Avvia un server WiVRn sulla\n"
"rete locale"
#: client/scenes/lobby_gui.cpp:680
#: client/scenes/lobby_gui.cpp:424
msgid "Autoconnect"
msgstr "Connessione automatica"
#: client/scenes/lobby_gui.cpp:706
#: client/scenes/lobby_gui.cpp:450
msgid "Connect"
msgstr "Connetti"
#: client/scenes/lobby_gui.cpp:716 client/wivrn_client.cpp:186
#: client/scenes/lobby_gui.cpp:460 client/wivrn_client.cpp:186
msgid "Incompatible server version"
msgstr "Versione del server incompatibile"
#: client/scenes/lobby_gui.cpp:718
#: client/scenes/lobby_gui.cpp:462
msgid "Server not available"
msgstr "Server non disponibile"
#: client/scenes/lobby_gui.cpp:800
#: client/scenes/lobby_gui.cpp:544
msgctxt "language selection, replace with the name of the language"
msgid "English"
msgstr "Italiano"
#: client/scenes/lobby_gui.cpp:814
#: client/scenes/lobby_gui.cpp:558
msgid "Language"
msgstr "Lingua"
#: client/scenes/lobby_gui.cpp:814 client/scenes/lobby_gui.cpp:816
#: client/scenes/lobby_gui.cpp:558 client/scenes/lobby_gui.cpp:560
msgid "System language"
msgstr "Lingua del sistema"
#: client/scenes/lobby_gui.cpp:841
#: client/scenes/lobby_gui.cpp:585
msgid "Refresh rate"
msgstr "Frequenza di aggiornamento"
#: client/scenes/lobby_gui.cpp:841 client/scenes/lobby_gui.cpp:843
#: client/scenes/lobby_gui.cpp:585 client/scenes/lobby_gui.cpp:587
msgctxt "automatic refresh rate"
msgid "Automatic"
msgstr "Automatica"
#: client/scenes/lobby_gui.cpp:850
#: client/scenes/lobby_gui.cpp:594
msgid ""
"Select refresh rate based on measured application performance.\n"
"May cause flicker when a change happens."
@@ -188,60 +188,60 @@ msgstr ""
"misurate dell'applicazione.\n"
"Può causare un flash quando avviene il cambiamento."
#: client/scenes/lobby_gui.cpp:867
#: client/scenes/lobby_gui.cpp:611
msgid "Minimum refresh rate"
msgstr "Frequenza minima"
#: client/scenes/lobby_gui.cpp:890
#: client/scenes/lobby_gui.cpp:634
msgid "Resolution scale"
msgstr "Scala di risoluzione"
#: client/scenes/lobby_gui.cpp:894
#: client/scenes/lobby_gui.cpp:638
#, c-format, c++-format
msgid "%d%% - {}x{} per eye"
msgstr "%d%% - {}x{} per occhio"
#: client/scenes/lobby_gui.cpp:905
#: client/scenes/lobby_gui.cpp:649
#, c++-format
msgid "Resolution larger than {}x{} may not be supported by the headset"
msgstr ""
"Le risoluzioni superiori a {}x{} potrebbero non essere supportate dal visore"
#: client/scenes/lobby_gui.cpp:911
#: client/scenes/lobby_gui.cpp:655
msgid "Enable microphone"
msgstr "Attiva il microfono"
#: client/scenes/lobby_gui.cpp:920
#: client/scenes/lobby_gui.cpp:664
msgid "Unprocessed Microphone Audio"
msgstr "Usare dati grezzi del microfono"
#: client/scenes/lobby_gui.cpp:926
#: client/scenes/lobby_gui.cpp:670
msgid "Force disable audio filters, such as noise cancellation"
msgstr "Disattiva gli effetti come la cancellazione del rumore"
#: client/scenes/lobby_gui.cpp:933
#: client/scenes/lobby_gui.cpp:677
msgid "Enable hand tracking"
msgstr "Abilita il tracciamento delle mani"
#: client/scenes/lobby_gui.cpp:939 client/scenes/lobby_gui.cpp:951
#: client/scenes/lobby_gui.cpp:963 client/scenes/lobby_gui.cpp:980
#: client/scenes/lobby_gui.cpp:1025
#: client/scenes/lobby_gui.cpp:683 client/scenes/lobby_gui.cpp:695
#: client/scenes/lobby_gui.cpp:707 client/scenes/lobby_gui.cpp:724
#: client/scenes/lobby_gui.cpp:769
msgid "This feature is not supported by your headset"
msgstr "Questa funzionalità non è supportata dal visore"
#: client/scenes/lobby_gui.cpp:945
#: client/scenes/lobby_gui.cpp:689
msgid "Enable eye tracking"
msgstr "Abilita il tracciamento oculare"
#: client/scenes/lobby_gui.cpp:957
#: client/scenes/lobby_gui.cpp:701
msgid "Enable face tracking"
msgstr "Abilita il tracciamento facciale"
#: client/scenes/lobby_gui.cpp:971
#: client/scenes/lobby_gui.cpp:715
msgid "Enable body tracking"
msgstr "Abilita il tracciamento del corpo"
#: client/scenes/lobby_gui.cpp:985
#: client/scenes/lobby_gui.cpp:729
msgid ""
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
"tracking settings,\n"
@@ -254,11 +254,11 @@ msgstr ""
"controller e\n"
"del visore."
#: client/scenes/lobby_gui.cpp:995
#: client/scenes/lobby_gui.cpp:739
msgid "Enable lower body tracking"
msgstr "Abilita il tracciamento del basso del corpo"
#: client/scenes/lobby_gui.cpp:1001
#: client/scenes/lobby_gui.cpp:745
msgid ""
"Estimate lower body joint positions using Generative Legs\n"
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
@@ -269,11 +269,11 @@ msgstr ""
"impostazioni,\n"
"sezione \"Tracking dei movimenti\"."
#: client/scenes/lobby_gui.cpp:1004
#: client/scenes/lobby_gui.cpp:748
msgid "Enable hip tracking"
msgstr "Abilitia il tracciamento delle anche"
#: client/scenes/lobby_gui.cpp:1010
#: client/scenes/lobby_gui.cpp:754
msgid ""
"Only takes affect with lower body tracking enabled\n"
"May be desired when using another source of hip tracking"
@@ -282,15 +282,15 @@ msgstr ""
"Può essere utile se un altro metodo viene usato per il tracciamento\n"
"delle anche."
#: client/scenes/lobby_gui.cpp:1018
#: client/scenes/lobby_gui.cpp:762
msgid "Enable video passthrough in lobby"
msgstr "Abilita la visualizzazione reale in ingresso"
#: client/scenes/lobby_gui.cpp:1029
#: client/scenes/lobby_gui.cpp:773
msgid "Enable in-stream window"
msgstr "Attiva la finestra di WiVRn durante la trasmissione"
#: client/scenes/lobby_gui.cpp:1032
#: client/scenes/lobby_gui.cpp:776
msgid ""
"Enables the configuration window to be shown while the game is streaming.\n"
"If enabled, the window is activated by pressing both thumbsticks."
@@ -298,15 +298,15 @@ msgstr ""
"Abilita la finestra di configurazione quando il gioco viene trasmesso.\n"
"Se selezionato, la finestra può essere attivata premendo entrambi gli stick."
#: client/scenes/lobby_gui.cpp:1046 client/scenes/stream_gui.cpp:445
#: client/scenes/lobby_gui.cpp:790 client/scenes/stream_gui.cpp:445
msgid "OpenXR post-processing"
msgstr "Post-trattamento OpenXR"
#: client/scenes/lobby_gui.cpp:1050 client/scenes/stream_gui.cpp:449
#: client/scenes/lobby_gui.cpp:794 client/scenes/stream_gui.cpp:449
msgid "Supersampling"
msgstr "Supersamping"
#: client/scenes/lobby_gui.cpp:1070 client/scenes/stream_gui.cpp:470
#: client/scenes/lobby_gui.cpp:814 client/scenes/stream_gui.cpp:470
msgid ""
"Reduce flicker for high contrast edges.\n"
"Useful when the input resolution is high compared to the headset display"
@@ -314,11 +314,11 @@ msgstr ""
"Riduce i lampeggiamenti sui bordi ad alto contrasto.\n"
"Utile quando la risoluzine d'entrata è alta in confronto a quella del visore"
#: client/scenes/lobby_gui.cpp:1075 client/scenes/stream_gui.cpp:475
#: client/scenes/lobby_gui.cpp:819 client/scenes/stream_gui.cpp:475
msgid "Sharpening"
msgstr "Miglioramento della nitidezza"
#: client/scenes/lobby_gui.cpp:1095 client/scenes/stream_gui.cpp:496
#: client/scenes/lobby_gui.cpp:839 client/scenes/stream_gui.cpp:496
msgid ""
"Improve clarity of high contrast edges and counteract blur.\n"
"Useful when the input resolution is low compared to the headset display"
@@ -327,125 +327,125 @@ msgstr ""
"Utile quando la risoluzione d'entrate è bassa in contronto a quella del "
"visore"
#: client/scenes/lobby_gui.cpp:1191 client/scenes/lobby_gui.cpp:1199
#: client/scenes/lobby_gui.cpp:935 client/scenes/lobby_gui.cpp:943
#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:424
msgid "CPU time"
msgstr "Tempo CPU"
#: client/scenes/lobby_gui.cpp:1195
#: client/scenes/lobby_gui.cpp:939
msgid "CPU time [ms]"
msgstr "Tempo CPU [ms]"
#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1213
#: client/scenes/lobby_gui.cpp:949 client/scenes/lobby_gui.cpp:957
#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:425
msgid "GPU time"
msgstr "Tempo GPU"
#: client/scenes/lobby_gui.cpp:1209
#: client/scenes/lobby_gui.cpp:953
msgid "GPU time [ms]"
msgstr "Tempo GPU [ms]"
#: client/scenes/lobby_gui.cpp:1252
#: client/scenes/lobby_gui.cpp:996
msgid "Enable the microphone?"
msgstr "Attivare il microfono?"
#: client/scenes/lobby_gui.cpp:1257
#: client/scenes/lobby_gui.cpp:1001
msgid "Enable eye tracking?"
msgstr "Attivare il tracciamento oculare?"
#: client/scenes/lobby_gui.cpp:1262
#: client/scenes/lobby_gui.cpp:1006
msgid "Enable face tracking?"
msgstr "Attivare il tracciamento facciale?"
#: client/scenes/lobby_gui.cpp:1267
#: client/scenes/lobby_gui.cpp:1011
msgid "Enable body tracking?"
msgstr "Attivare il tracciamento del corpo?"
#: client/scenes/lobby_gui.cpp:1275
#: client/scenes/lobby_gui.cpp:1019
msgid "Welcome to WiVRn"
msgstr "Benvenuto su WiVRn"
#: client/scenes/lobby_gui.cpp:1299
#: client/scenes/lobby_gui.cpp:1043
msgid "Yes"
msgstr "Sì"
#: client/scenes/lobby_gui.cpp:1306
#: client/scenes/lobby_gui.cpp:1050
msgid "No"
msgstr "No"
#: client/scenes/lobby_gui.cpp:1325 client/scenes/lobby_gui.cpp:1972
#: client/scenes/lobby_gui.cpp:1069 client/scenes/lobby_gui.cpp:1716
msgid "Licenses"
msgstr "Licenze"
#: client/scenes/lobby_gui.cpp:1650
#: client/scenes/lobby_gui.cpp:1394
msgid "Microphone is enabled"
msgstr "Microfono attivo"
#: client/scenes/lobby_gui.cpp:1651
#: client/scenes/lobby_gui.cpp:1395
msgid "Microphone is disabled"
msgstr "Microfono disattivato"
#: client/scenes/lobby_gui.cpp:1660
#: client/scenes/lobby_gui.cpp:1404
msgid "Hand tracking is enabled"
msgstr "Tracciamento delle mani attivo"
#: client/scenes/lobby_gui.cpp:1661
#: client/scenes/lobby_gui.cpp:1405
msgid "Hand tracking is disabled"
msgstr "Tracciamento delle mani disattivato"
#: client/scenes/lobby_gui.cpp:1670
#: client/scenes/lobby_gui.cpp:1414
msgid "Eye tracking is enabled"
msgstr "Tracciamento oculare attivo"
#: client/scenes/lobby_gui.cpp:1671
#: client/scenes/lobby_gui.cpp:1415
msgid "Eye tracking is disabled"
msgstr "Tracciamento oculare disattivato"
#: client/scenes/lobby_gui.cpp:1681
#: client/scenes/lobby_gui.cpp:1425
msgid "Face tracking is enabled"
msgstr "Tracciamento facciale attivato"
#: client/scenes/lobby_gui.cpp:1682
#: client/scenes/lobby_gui.cpp:1426
msgid "Face tracking is disabled"
msgstr "Tracciamento facciale disattivato"
#: client/scenes/lobby_gui.cpp:1692
#: client/scenes/lobby_gui.cpp:1436
msgid "Body tracking is enabled"
msgstr "Tracciamento del corpo attivato"
#: client/scenes/lobby_gui.cpp:1693
#: client/scenes/lobby_gui.cpp:1437
msgid "Body tracking is disabled"
msgstr "Tracciamento del corpo disattivato"
#: client/scenes/lobby_gui.cpp:1709
#: client/scenes/lobby_gui.cpp:1453
msgid "Add server"
msgstr "Aggiungi server"
#: client/scenes/lobby_gui.cpp:1954
#: client/scenes/lobby_gui.cpp:1698
msgid "Server list"
msgstr "Elenco dei server"
#: client/scenes/lobby_gui.cpp:1957 client/scenes/stream_gui.cpp:822
#: client/scenes/lobby_gui.cpp:1701 client/scenes/stream_gui.cpp:925
msgid "Settings"
msgstr "Impostazioni"
#: client/scenes/lobby_gui.cpp:1960
#: client/scenes/lobby_gui.cpp:1704
msgid "Post-processing"
msgstr "Post-trattamento"
#: client/scenes/lobby_gui.cpp:1964
#: client/scenes/lobby_gui.cpp:1708
msgid "Debug"
msgstr "Debug"
#: client/scenes/lobby_gui.cpp:1969
#: client/scenes/lobby_gui.cpp:1713
msgid "About"
msgstr "Informazioni"
#: client/scenes/lobby_gui.cpp:1975
#: client/scenes/lobby_gui.cpp:1719
msgid "Exit"
msgstr "Esci"
#: client/scenes/lobby_gui.cpp:1992
#: client/scenes/lobby_gui.cpp:1736
msgid ""
"Press the grip button or put your palm up\n"
"to move the main window"
@@ -453,7 +453,7 @@ msgstr ""
"Premi il pulsante laterale o punta il palmo della\n"
"mano verso l'alto per spostare la finestra principale"
#: client/scenes/lobby_gui.cpp:1994
#: client/scenes/lobby_gui.cpp:1738
msgid "Press the grip button to move the main window"
msgstr "Premi il pulsante laterale per spostare la finestra principale"
@@ -523,7 +523,7 @@ msgstr "Latenza stimata da movimento a fotoni: {}ms"
msgid "Press the grip button to move the window"
msgstr "Premi il pulsante laterale per spostare la finestra"
#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:776
#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:868
msgid "Press both thumbsticks to display the WiVRn window"
msgstr "Premi entrabli gli stick per mostrare la finestra di WiVRn"
@@ -565,15 +565,35 @@ msgstr "Usa gli stick per spostare il centro di foveazione"
msgid "Press A to save or B to cancel"
msgstr "A per salvare, B per annullare"
#: client/scenes/stream_gui.cpp:819
#: client/scenes/stream_gui.cpp:618
msgid "Running XR applications:"
msgstr "Applicazioni XR avviate:"
#: client/scenes/stream_gui.cpp:635
msgid "Overlays"
msgstr "Overlays"
#: client/scenes/stream_gui.cpp:674
msgid "Request to quit, may be ignored by the application"
msgstr "Chiede di chiudere, può essere ignorato dall'applicazione"
#: client/scenes/stream_gui.cpp:677
msgid "Start"
msgstr "Avvio"
#: client/scenes/stream_gui.cpp:922
msgid "Stats"
msgstr "Statistiche"
#: client/scenes/stream_gui.cpp:828
#: client/scenes/stream_gui.cpp:928
msgid "Applications"
msgstr "Applicazioni"
#: client/scenes/stream_gui.cpp:934
msgid "Statistics overlay"
msgstr "Solo statistiche"
#: client/scenes/stream_gui.cpp:831
#: client/scenes/stream_gui.cpp:937
msgid "Compact view"
msgstr "Modalità compatta"
+312
View File
@@ -0,0 +1,312 @@
From 36c63e58e4d54c31872b95fdc7fb431c8cfc57ab Mon Sep 17 00:00:00 2001
From: Jakob Bornecrantz <tbornecrantz@nvidia.com>
Date: Fri, 15 Nov 2024 22:51:32 +0000
Subject: [PATCH] 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 b870a52c8c..1b44af8a82 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 f972d6835a..32bad0ec56 100644
--- a/src/xrt/ipc/server/ipc_server_process.c
+++ b/src/xrt/ipc/server/ipc_server_process.c
@@ -972,9 +972,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;
@@ -1002,11 +1003,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;
@@ -1015,13 +1013,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);
@@ -1038,39 +1038,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 45877803d3..71c581da6b 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;
--
GitLab
+1
View File
@@ -79,6 +79,7 @@ if (WIVRN_BUILD_SERVER)
main.cpp
sleep_inhibitor.cpp
start_application.cpp
ipc_server_cb.cpp
target_instance_wivrn.cpp
wivrn_ipc.cpp
+4 -19
View File
@@ -75,7 +75,7 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
.supported = {
.orientation_tracking = true,
.position_tracking = true,
.presence = true,
.presence = info.user_presence,
.battery_status = true,
},
.update_inputs = [](xrt_device *) { return XRT_SUCCESS; },
@@ -231,28 +231,13 @@ void wivrn_hmd::update_visibility_mask(const from_headset::visibility_mask_chang
m->at(mask.view_index) = mask.data;
}
bool wivrn_hmd::update_presence(bool new_presence, bool real)
bool wivrn_hmd::update_presence(bool new_presence)
{
// if this presence change comes from headset, always honor it,
// otherwise try to keep it in sync with the real presence,
// while still changing presence to false when session is not
// visible
if (real || new_presence == this->real_presence || !new_presence)
if (this->presence.exchange(new_presence) != new_presence)
{
if (real && this->real_presence != new_presence)
{
U_LOG_I("Updating real user presence: %s -> %s", real_presence ? "true" : "false", new_presence ? "true" : "false");
this->real_presence = new_presence;
}
if (this->presence == new_presence)
return false;
U_LOG_I("Updating user presence: %s -> %s", this->presence ? "true" : "false", new_presence ? "true" : "false");
this->presence = new_presence;
U_LOG_I("user presence changed to %s", new_presence ? "true" : "false");
return true;
}
return false;
}
} // namespace wivrn
+1 -6
View File
@@ -54,10 +54,6 @@ class wivrn_hmd : public xrt_device
from_headset::battery battery{};
std::atomic<bool> presence{true};
// last XR_EVENT_DATA_USER_PRESENCE_CHANGED_EXT from headset
// we must keep track of this to not go out of sync with headset when
// a session state change also triggers presence change
std::atomic<bool> real_presence{true};
thread_safe<std::array<std::optional<from_headset::visibility_mask_changed::masks>, 2>> visibility_mask;
wivrn::wivrn_session * cnx;
@@ -86,7 +82,6 @@ public:
void update_battery(const from_headset::battery &);
void update_tracking(const from_headset::tracking &, const clock_offset &);
void update_visibility_mask(const from_headset::visibility_mask_changed &);
// real if this update comes from a presence changed event
bool update_presence(bool new_presence, bool real);
bool update_presence(bool);
};
} // namespace wivrn
+90 -28
View File
@@ -25,6 +25,8 @@
#include "main/comp_compositor.h"
#include "main/comp_main_interface.h"
#include "main/comp_target.h"
#include "server/ipc_server.h"
#include "target_instance_wivrn.h"
#include "util/u_builders.h"
#include "util/u_logging.h"
#include "util/u_system.h"
@@ -139,7 +141,7 @@ bool wivrn::tracking_control_t::set_enabled(to_headset::tracking_control::id id,
return changed;
}
wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection, u_system & system) :
wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection, instance & inst, u_system & system) :
xrt_system_devices{
.get_roles = [](xrt_system_devices * self, xrt_system_roles * out_roles) { return ((wivrn_session *)self)->get_roles(out_roles); },
.feature_inc = [](xrt_system_devices * self, xrt_device_feature_type f) { return ((wivrn_session *)self)->feature_inc(f); },
@@ -147,6 +149,7 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
.destroy = [](xrt_system_devices * self) { delete ((wivrn_session *)self); },
},
connection(std::move(connection)),
inst(inst),
xrt_system(system),
hmd(this, get_info()),
left_controller(0, &hmd, this),
@@ -305,6 +308,7 @@ wivrn_session::~wivrn_session()
}
xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connection> connection,
instance & inst,
u_system & system,
xrt_system_devices ** out_xsysd,
xrt_space_overseer ** out_xspovrs,
@@ -313,7 +317,7 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connecti
std::unique_ptr<wivrn_session> self;
try
{
self.reset(new wivrn_session(std::move(connection), system));
self.reset(new wivrn_session(std::move(connection), inst, system));
}
catch (std::exception & e)
{
@@ -330,6 +334,7 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connecti
U_LOG_E("Failed to create system compositor");
return xret;
}
self->system_compositor = *out_xsysc;
u_builder_create_space_overseer_legacy(
&self->xrt_system.broadcast,
@@ -668,49 +673,34 @@ void wivrn_session::operator()(from_headset::session_state_changed && event)
{
U_LOG_I("Session state changed: %s", xr::to_string(event.state));
bool visible, focused;
bool changed = false;
switch (event.state)
{
case XR_SESSION_STATE_SYNCHRONIZED:
visible = false;
focused = false;
changed = hmd.update_presence(false, false);
break;
case XR_SESSION_STATE_VISIBLE:
visible = true;
focused = false;
changed = hmd.update_presence(true, false);
break;
case XR_SESSION_STATE_FOCUSED:
visible = true;
focused = true;
changed = hmd.update_presence(true, false);
break;
default:
return;
visible = false;
focused = false;
break;
}
if (changed)
scoped_lock lock(inst.server->global_state.lock);
for (auto & t: inst.server->threads)
{
xrt_session_event_user_presence_change event = {
.type = XRT_SESSION_EVENT_USER_PRESENCE_CHANGE,
};
hmd.get_presence(&event.is_user_present);
push_event({.presence_change = event});
if (t.ics.server_thread_index < 0 or t.ics.xc == nullptr)
continue;
bool current = t.ics.client_state.session_overlay or
inst.server->global_state.active_client_index == t.ics.server_thread_index;
xrt_syscomp_set_state(system_compositor, t.ics.xc, visible and current, focused and current);
}
push_event(
{
.state = {
.type = XRT_SESSION_EVENT_STATE_CHANGE,
.visible = visible,
.focused = focused,
},
});
}
void wivrn_session::operator()(from_headset::user_presence_changed && event)
{
if (hmd.update_presence(event.present, true))
if (hmd.update_presence(event.present))
push_event(
{
.presence_change = {
@@ -793,6 +783,54 @@ void wivrn_session::operator()(const from_headset::start_app & request)
send_to_main(request);
}
void wivrn_session::operator()(const from_headset::get_running_applications &)
{
scoped_lock lock(inst.server->global_state.lock);
to_headset::running_applications msg{};
for (auto & t: inst.server->threads)
{
if (t.ics.server_thread_index < 0 or t.ics.xc == nullptr)
continue;
// nasty volatile
std::array<char, sizeof(t.ics.client_state.info.application_name)> tmp;
for (size_t i = 0; i + 1 < tmp.size(); ++i)
tmp[i] = t.ics.client_state.info.application_name[i];
tmp.back() = 0;
msg.applications.push_back(
{
.name = std::string(tmp.data()),
.id = t.ics.client_state.id,
.overlay = t.ics.client_state.session_overlay,
.active = t.ics.server_thread_index == inst.server->global_state.active_client_index,
});
}
connection->send_control(std::move(msg));
}
void wivrn_session::operator()(const from_headset::set_active_application & req)
{
ipc_server_set_active_client(inst.server, req.id);
ipc_server_update_state(inst.server);
// Send a refreshed application list
(*this)(from_headset::get_running_applications{});
}
void wivrn_session::operator()(const from_headset::stop_application & req)
{
scoped_lock lock(inst.server->global_state.lock);
for (auto & t: inst.server->threads)
{
if (t.ics.client_state.id == req.id)
{
U_LOG_I("Notify session loss pending for %s", t.ics.client_state.info.application_name);
auto when = os_monotonic_get_ns() + 200 * U_TIME_1MS_IN_NS;
xrt_syscomp_notify_loss_pending(system_compositor, t.ics.xc, when);
session_loss.lock()->emplace(when, req.id);
break;
}
}
}
void wivrn_session::operator()(audio_data && data)
{
if (audio_handle)
@@ -877,6 +915,7 @@ void wivrn_session::run(std::stop_token stop)
refresh.adjust(*connection);
}
}
poll_session_loss();
connection->poll(*this, 20);
}
catch (const std::exception & e)
@@ -980,6 +1019,29 @@ void wivrn_session::reconnect()
}
}
void wivrn_session::poll_session_loss()
{
auto locked = session_loss.lock();
auto now = os_monotonic_get_ns();
if (locked->empty())
return;
auto it = locked->begin();
scoped_lock lock(inst.server->global_state.lock);
while (it != locked->end() and it->first <= now)
{
for (auto & t: inst.server->threads)
{
if (t.ics.client_state.id == it->second)
{
U_LOG_I("Terminating %s", t.ics.client_state.info.application_name);
xrt_syscomp_notify_lost(system_compositor, t.ics.xc);
break;
}
}
it = locked->erase(it);
}
}
xrt_result_t wivrn_session::get_roles(xrt_system_roles * out_roles)
{
std::lock_guard lock(roles_mutex);
+15 -1
View File
@@ -21,6 +21,7 @@
#include "clock_offset.h"
#include "driver/app_pacer.h"
#include "utils/thread_safe.h"
#include "wivrn_connection.h"
#include "wivrn_controller.h"
#include "wivrn_hand_interaction.h"
@@ -31,6 +32,7 @@
#include "xrt/xrt_system.h"
#include <atomic>
#include <fstream>
#include <map>
#include <memory>
#include <mutex>
#include <shared_mutex>
@@ -43,6 +45,7 @@ union xrt_session_event;
namespace wivrn
{
class instance;
class wivrn_eye_tracker;
class wivrn_fb_face2_tracker;
class wivrn_htc_face_tracker;
@@ -92,10 +95,12 @@ class wivrn_session : public xrt_system_devices
{
friend wivrn_comp_target_factory;
std::unique_ptr<wivrn_connection> connection;
instance & inst;
pacing_app_factory app_pacers;
u_system & xrt_system;
xrt_space_overseer * space_overseer;
xrt_system_compositor * system_compositor;
std::mutex roles_mutex;
xrt_system_roles roles{
@@ -131,14 +136,18 @@ class wivrn_session : public xrt_system_devices
std::shared_ptr<audio_device> audio_handle;
// when sessions shall be destroyed, key is timestap, value is client id
thread_safe<std::map<int64_t, int32_t>> session_loss;
std::jthread thread;
wivrn_session(std::unique_ptr<wivrn_connection> connection, u_system &);
wivrn_session(std::unique_ptr<wivrn_connection> connection, instance &, u_system &);
public:
~wivrn_session();
static xrt_result_t create_session(std::unique_ptr<wivrn_connection> connection,
instance & instance,
u_system & system,
xrt_system_devices ** out_xsysd,
xrt_space_overseer ** out_xspovrs,
@@ -188,6 +197,9 @@ public:
void operator()(from_headset::override_foveation_center &&);
void operator()(from_headset::get_application_list &&);
void operator()(const from_headset::start_app &);
void operator()(const from_headset::get_running_applications &);
void operator()(const from_headset::set_active_application &);
void operator()(const from_headset::stop_application &);
void operator()(audio_data &&);
void operator()(to_monado::disconnect &&);
@@ -219,6 +231,8 @@ private:
void run(std::stop_token stop);
void reconnect();
void poll_session_loss();
// xrt_system implementation
xrt_result_t get_roles(xrt_system_roles * out_roles);
xrt_result_t feature_inc(xrt_device_feature_type type);
+48
View File
@@ -0,0 +1,48 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ipc_server_cb.h"
#include "target_instance_wivrn.h"
#include "utils/method.h"
namespace wivrn
{
void ipc_server_cb::init_failed(xrt_result res)
{
}
void ipc_server_cb::mainloop_entering(ipc_server * server, xrt_instance * xrt_inst)
{
auto inst = static_cast<wivrn::instance *>(xrt_inst);
inst->server = server;
}
void ipc_server_cb::mainloop_leaving(ipc_server * server, xrt_instance * xrt_inst)
{
auto inst = static_cast<wivrn::instance *>(xrt_inst);
inst->server = nullptr;
}
ipc_server_cb::ipc_server_cb() :
ipc_server_callbacks{
.init_failed = method_pointer2<&ipc_server_cb::init_failed>,
.mainloop_entering = method_pointer2<&ipc_server_cb::mainloop_entering>,
.mainloop_leaving = method_pointer2<&ipc_server_cb::mainloop_leaving>,
}
{}
} // namespace wivrn
+35
View File
@@ -0,0 +1,35 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "server/ipc_server_interface.h"
namespace wivrn
{
class ipc_server_cb : public ipc_server_callbacks
{
void init_failed(xrt_result);
void mainloop_entering(ipc_server *, xrt_instance *);
void mainloop_leaving(ipc_server *, xrt_instance *);
public:
using base = void;
ipc_server_cb();
};
} // namespace wivrn
+4 -3
View File
@@ -16,6 +16,7 @@
#include "driver/wivrn_connection.h"
#include "exit_codes.h"
#include "hostname.h"
#include "ipc_server_cb.h"
#include "protocol_version.h"
#include "start_application.h"
#include "utils/overloaded.h"
@@ -48,7 +49,6 @@
#include <glib.h>
#include <libnotify/notify.h>
#include <server/ipc_server_interface.h>
#include <shared/ipc_protocol.h>
#include <util/u_file.h>
@@ -249,11 +249,12 @@ void start_server(configuration config)
// foveation code does not allow oversampling
setenv("XRT_COMPOSITOR_SCALE_PERCENTAGE", "100", true);
// FIXME: synchronization fails on gfx pipeline
setenv("XRT_COMPOSITOR_COMPUTE", "1", true);
setenv("AMD_DEBUG", "lowlatencyenc", false);
wivrn::ipc_server_cb server_cb;
ipc_server_main_info server_info{
.udgci = {
.window_title = "WiVRn",
@@ -267,7 +268,7 @@ void start_server(configuration config)
try
{
exit(ipc_server_main(0, 0, &server_info /*argc, argv, ismi*/));
exit(ipc_server_main_common(&server_info, &server_cb, nullptr));
}
catch (std::exception & e)
{
+40 -39
View File
@@ -1,16 +1,28 @@
// Copyright 2020-2022, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Shared default implementation of the instance with compositor.
* @author Jakob Bornecrantz <jakob@collabora.com>
/*
* WiVRn VR streaming
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "target_instance_wivrn.h"
#include "utils/method.h"
#include "xrt/xrt_instance.h"
#include "xrt/xrt_system.h"
#include "os/os_time.h"
#include "util/u_system.h"
#include "util/u_trace_marker.h"
@@ -19,18 +31,13 @@
#include "driver/wivrn_session.h"
#include "wivrn_ipc.h"
/*
*
* Internal functions.
*
*/
static xrt_result_t
wivrn_instance_create_system(struct xrt_instance * xinst,
struct xrt_system ** out_xsys,
struct xrt_system_devices ** out_xsysd,
struct xrt_space_overseer ** out_xspovrs,
struct xrt_system_compositor ** out_xsysc)
namespace wivrn
{
xrt_result_t instance::create_system(
struct xrt_system ** out_xsys,
struct xrt_system_devices ** out_xsysd,
struct xrt_space_overseer ** out_xspovrs,
struct xrt_system_compositor ** out_xsysc)
{
assert(out_xsysd != NULL);
assert(*out_xsysd == NULL);
@@ -41,6 +48,7 @@ wivrn_instance_create_system(struct xrt_instance * xinst,
struct xrt_system_compositor * xsysc = NULL;
auto res = wivrn::wivrn_session::create_session(
std::move(connection),
*this,
*u_sys,
out_xsysd,
out_xspovrs,
@@ -49,36 +57,29 @@ wivrn_instance_create_system(struct xrt_instance * xinst,
return res;
}
static void
wivrn_instance_destroy(struct xrt_instance * xinst)
{
delete xinst;
}
static xrt_result_t
wivrn_instance_get_prober(struct xrt_instance * xinst, struct xrt_prober ** out_xp)
xrt_result_t instance::get_prober(struct xrt_prober ** out_xp)
{
*out_xp = nullptr;
return XRT_ERROR_PROBER_NOT_SUPPORTED;
}
/*
*
* Exported function(s).
*
*/
instance::instance() :
xrt_instance{
.create_system = method_pointer<&instance::create_system>,
.get_prober = method_pointer<&instance::get_prober>,
.destroy = [](xrt_instance * ptr) { delete (instance *)ptr; },
.startup_timestamp = os_monotonic_get_ns(),
}
{
}
} // namespace wivrn
xrt_result_t
xrt_instance_create(struct xrt_instance_info * ii, struct xrt_instance ** out_xinst)
{
u_trace_marker_init();
*out_xinst = new xrt_instance{
.create_system = wivrn_instance_create_system,
.get_prober = wivrn_instance_get_prober,
.destroy = wivrn_instance_destroy,
.startup_timestamp = os_monotonic_get_ns(),
};
*out_xinst = new wivrn::instance();
return XRT_SUCCESS;
}
+41
View File
@@ -0,0 +1,41 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "server/ipc_server.h"
#include "xrt/xrt_instance.h"
namespace wivrn
{
class instance : public xrt_instance
{
xrt_result_t create_system(
xrt_system **,
xrt_system_devices **,
xrt_space_overseer **,
xrt_system_compositor **);
xrt_result_t get_prober(xrt_prober **);
public:
ipc_server * server = nullptr;
using base = xrt_instance;
instance();
};
} // namespace wivrn
+8
View File
@@ -32,6 +32,10 @@ struct method_trait<Method, Result (Class::*)(Args...)>
{
return std::invoke(Method, static_cast<Class *>(arg), args...);
}
static Result magic2(Args... args, Class::base * arg)
{
return std::invoke(Method, static_cast<Class *>(arg), args...);
}
};
} // namespace details
@@ -54,4 +58,8 @@ namespace wivrn
// }
template <auto Method>
auto method_pointer = ::details::method_trait<Method>::magic;
// same, but "this" argument is last
template <auto Method>
auto method_pointer2 = ::details::method_trait<Method>::magic2;
} // namespace wivrn