From e21b1adf1d58b993689c5e8373d00e2b6ae008f6 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 27 Apr 2026 10:26:58 +0200 Subject: [PATCH 1/5] Send both frame rate and refresh rate in description --- client/decoder/android/android_decoder.cpp | 2 +- client/scenes/stream.cpp | 4 ++-- client/scenes/stream_network.cpp | 4 ++-- common/wivrn_packets.h | 5 +++-- server/compositor/compositor.cpp | 5 +++-- server/driver/wivrn_session.cpp | 7 ++++--- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/client/decoder/android/android_decoder.cpp b/client/decoder/android/android_decoder.cpp index 22e41533..b1ca1616 100644 --- a/client/decoder/android/android_decoder.cpp +++ b/client/decoder/android/android_decoder.cpp @@ -140,7 +140,7 @@ decoder::decoder( // latency mode AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, width); AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_HEIGHT, height); - AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_OPERATING_RATE, std::ceil(description.fps)); + AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_OPERATING_RATE, std::ceil(description.frame_rate)); AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_PRIORITY, 0); media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec[stream_index]))); diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 70af6748..6884d36d 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -1165,7 +1165,7 @@ void scenes::stream::exit() void scenes::stream::setup(const to_headset::video_stream_description & description) { - session.set_refresh_rate(description.fps); + session.set_refresh_rate(description.refresh_rate); std::unique_lock lock(decoder_mutex); if (video_stream_description == description) @@ -1189,7 +1189,7 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint assert(swapchain_width); assert(swapchain_height); device.waitIdle(); - session.set_refresh_rate(video_stream_description->fps); + session.set_refresh_rate(video_stream_description->refresh_rate); auto views = system.view_configuration_views(viewconfig); diff --git a/client/scenes/stream_network.cpp b/client/scenes/stream_network.cpp index 5fa2ee67..ec74f0d2 100644 --- a/client/scenes/stream_network.cpp +++ b/client/scenes/stream_network.cpp @@ -111,10 +111,10 @@ void scenes::stream::operator()(to_headset::video_stream_description && desc) void scenes::stream::operator()(to_headset::refresh_rate_change && rate) { - session.set_refresh_rate(rate.fps); + session.set_refresh_rate(rate.hz); std::shared_lock lock(decoder_mutex); if (video_stream_description) - video_stream_description->fps = rate.fps; + video_stream_description->refresh_rate = rate.hz; } void scenes::stream::operator()(to_headset::stream_tab_change && tab) diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 348270be..8a01f2c7 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -678,7 +678,8 @@ struct video_stream_description uint16_t width; uint16_t height; std::array codec; // left, right, alpha - float fps; + float frame_rate; + float refresh_rate; bool operator==(const video_stream_description &) const = default; }; @@ -765,7 +766,7 @@ struct feature_control struct refresh_rate_change { - float fps; + float hz; }; struct stream_tab_change diff --git a/server/compositor/compositor.cpp b/server/compositor/compositor.cpp index 06386d98..571fc9a7 100644 --- a/server/compositor/compositor.cpp +++ b/server/compositor/compositor.cpp @@ -550,7 +550,7 @@ xrt_result_t compositor::request_display_refresh_rate(float hz) try { requested_refresh_rate = hz; - session.send_control(to_headset::refresh_rate_change{.fps = hz}); + session.send_control(to_headset::refresh_rate_change{.hz = hz}); } catch (std::exception & e) { @@ -641,8 +641,9 @@ void compositor::send_video_stream_description() to_headset::video_stream_description desc{ .width = uint16_t(images[0].image.info().extent.width), .height = uint16_t(images[0].image.info().extent.height), - .fps = settings[0].fps, + .frame_rate = settings[0].fps, }; + get_display_refresh_rate(&desc.refresh_rate); static_assert(std::tuple_size_v == std::tuple_size_v); std::ranges::transform(settings, desc.codec.begin(), &encoder_settings::codec); session.send_control(std::move(desc)); diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index 2a40e13d..8eb2f52f 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -401,9 +401,10 @@ void wivrn_session::resume_session() if (target_fps != current_fps) { + auto s = settings.lock(); (*this)(from_headset::refresh_rate_changed{ - .from = current_fps, - .to = target_fps, + .from = current_fps * s->fps_divider, + .to = target_fps * s->fps_divider, }); } } @@ -964,7 +965,7 @@ struct refresh_rate_adjuster if (requested != last) { U_LOG_I("requesting refresh rate: %.0f (app rate %.1f)", requested, app_rate); - cnx.send_control(to_headset::refresh_rate_change{.fps = requested}); + cnx.send_control(to_headset::refresh_rate_change{.hz = requested}); last = requested; } } From 63a22d32dbf1f14fd5cd1ac982d98fb8d56fdcb9 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 27 Apr 2026 10:48:26 +0200 Subject: [PATCH 2/5] Allow headset timewarp --- client/scenes/stream.cpp | 280 ++++++++++++++++++++------------------- 1 file changed, 142 insertions(+), 138 deletions(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 6884d36d..2a3adfd9 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -823,8 +823,6 @@ void scenes::stream::render(const XrFrameState & frame_state) if (device.waitForFences(*fence, VK_TRUE, UINT64_MAX) == vk::Result::eTimeout) throw std::runtime_error("Vulkan fence timeout"); - device.resetFences(*fence); - // We don't need those after vkWaitForFences current_blit_handles.fill(nullptr); @@ -942,159 +940,165 @@ void scenes::stream::render(const XrFrameState & frame_state) } } - XrExtent2Di extents[view_count]; + // Allow the headset to time warp if we are redisplaying a frame + if (std::ranges::any_of(current_blit_handles, [](const auto & h) { return h and h->feedback.times_displayed < 2; }) or + is_gui_interactable()) { - int32_t max_width = 0; - int32_t max_height = 0; - for (size_t i = 0; i < view_count; ++i) + XrExtent2Di extents[view_count]; { - extents[i] = stream_defoveator::defoveated_size(foveation[i]); - max_width = std::max(max_width, extents[i].width); - max_height = std::max(max_height, extents[i].height); - } - if (not swapchain) - setup_reprojection_swapchain(max_width, max_height); - else if (swapchain.width() < max_width or swapchain.height() < max_height) - { - // If the defoveated image is larger than the swapchain, try to reallocate one - try + int32_t max_width = 0; + int32_t max_height = 0; + for (size_t i = 0; i < view_count; ++i) { - spdlog::info("Recreating swapchain, from {}x{} to {}x{}", - swapchain.width(), - swapchain.height(), - max_width, - max_height); - setup_reprojection_swapchain(max_width, max_height); + extents[i] = stream_defoveator::defoveated_size(foveation[i]); + max_width = std::max(max_width, extents[i].width); + max_height = std::max(max_height, extents[i].height); } - catch (std::exception & e) + if (not swapchain) + setup_reprojection_swapchain(max_width, max_height); + else if (swapchain.width() < max_width or swapchain.height() < max_height) { - spdlog::warn("failed to increase swapchain size"); - for (size_t i = 0; i < view_count; ++i) + // If the defoveated image is larger than the swapchain, try to reallocate one + try { - extents[i].width = std::min(extents[i].width, swapchain.width()); - extents[i].height = std::min(extents[i].height, swapchain.height()); + spdlog::info("Recreating swapchain, from {}x{} to {}x{}", + swapchain.width(), + swapchain.height(), + max_width, + max_height); + setup_reprojection_swapchain(max_width, max_height); + } + catch (std::exception & e) + { + spdlog::warn("failed to increase swapchain size"); + for (size_t i = 0; i < view_count; ++i) + { + extents[i].width = std::min(extents[i].width, swapchain.width()); + extents[i].height = std::min(extents[i].height, swapchain.height()); + } } } } - } - assert(swapchain); - // defoveate the image, apply scale/bias - int image_index = swapchain.acquire(); - swapchain.wait(); + assert(swapchain); + // defoveate the image, apply scale/bias + int image_index = swapchain.acquire(); + swapchain.wait(); - switch (gui_status) - { - case stream_tab::hidden: - case stream_tab::bitrate_settings: - case stream_tab::foveation_settings: - case stream_tab::compact: - case stream_tab::overlay_only: - dimming = dimming - frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration); - break; - case stream_tab::stats: - case stream_tab::settings: - case stream_tab::applications: - case stream_tab::application_launcher: - dimming = dimming + frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration); - break; - } - - dimming = std::clamp(dimming, 0, 1); - float x = dimming * dimming * (3 - 2 * dimming); // Easing function - - const float scale = std::lerp(1, constants::stream::dimming_scale, x); - const float bias = std::lerp(0, constants::stream::dimming_bias, x); - - defoveator->defoveate(command_buffer, - foveation, - images, - {scale, scale, scale, 1.}, - {bias, bias, bias, 0.}, - image_index); - - command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 1); - - command_buffer.end(); - vk::SubmitInfo submit_info; - submit_info.setCommandBuffers(*command_buffer); - - inplace_vector semaphores; - inplace_vector semaphore_vals; - inplace_vector wait_stages; - for (auto b: current_blit_handles) - { - if (b and b->semaphore) + switch (gui_status) { - assert(b->semaphore_val); - semaphores.push_back(b->semaphore); - semaphore_vals.push_back(*b->semaphore_val); - wait_stages.push_back(vk::PipelineStageFlagBits::eFragmentShader); + case stream_tab::hidden: + case stream_tab::bitrate_settings: + case stream_tab::foveation_settings: + case stream_tab::compact: + case stream_tab::overlay_only: + dimming = dimming - frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration); + break; + case stream_tab::stats: + case stream_tab::settings: + case stream_tab::applications: + case stream_tab::application_launcher: + dimming = dimming + frame_state.predictedDisplayPeriod / (1e9 * constants::stream::fade_duration); + break; } - } - submit_info.setWaitDstStageMask(wait_stages); - submit_info.setWaitSemaphores(semaphores); - vk::TimelineSemaphoreSubmitInfo sem_info{ - .waitSemaphoreValueCount = uint32_t(semaphore_vals.size()), - .pWaitSemaphoreValues = semaphore_vals.data(), - }; - submit_info.pNext = &sem_info; - queue.lock()->submit(submit_info, *fence); + dimming = std::clamp(dimming, 0, 1); + float x = dimming * dimming * (3 - 2 * dimming); // Easing function + + const float scale = std::lerp(1, constants::stream::dimming_scale, x); + const float bias = std::lerp(0, constants::stream::dimming_bias, x); + + defoveator->defoveate(command_buffer, + foveation, + images, + {scale, scale, scale, 1.}, + {bias, bias, bias, 0.}, + image_index); + + command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 1); + + command_buffer.end(); + vk::SubmitInfo submit_info; + submit_info.setCommandBuffers(*command_buffer); + + inplace_vector semaphores; + inplace_vector semaphore_vals; + inplace_vector wait_stages; + for (auto b: current_blit_handles) + { + if (b and b->semaphore) + { + assert(b->semaphore_val); + semaphores.push_back(b->semaphore); + semaphore_vals.push_back(*b->semaphore_val); + wait_stages.push_back(vk::PipelineStageFlagBits::eFragmentShader); + } + } + submit_info.setWaitDstStageMask(wait_stages); + submit_info.setWaitSemaphores(semaphores); + vk::TimelineSemaphoreSubmitInfo sem_info{ + .waitSemaphoreValueCount = uint32_t(semaphore_vals.size()), + .pWaitSemaphoreValues = semaphore_vals.data(), + }; + submit_info.pNext = &sem_info; + + device.resetFences(*fence); + queue.lock()->submit(submit_info, *fence); #if WIVRN_FEATURE_RENDERDOC - renderdoc_end(*vk_instance); + renderdoc_end(*vk_instance); #endif - swapchain.release(); + swapchain.release(); - if (use_alpha) - session.enable_passthrough(system); - else - session.disable_passthrough(); - - render_start(use_alpha, frame_state.predictedDisplayTime); - - // Add the layer with the streamed content - std::array layer_view; - for (uint32_t view = 0; view < view_count; view++) - { - layer_view[view] = - { - .type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW, - .pose = pose[view], - .fov = fov[view], - - .subImage = { - .swapchain = swapchain, - .imageRect = { - .offset = {0, 0}, - .extent = extents[view], - }, - .imageArrayIndex = view, - }, - }; - } - add_projection_layer( - use_alpha ? XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT : 0, - application::space(xr::spaces::world), - layer_view); - - if (const configuration::openxr_post_processing_settings openxr_post_processing = application::get_config().openxr_post_processing; - (openxr_post_processing.sharpening | openxr_post_processing.super_sampling) > 0) - set_layer_settings(openxr_post_processing.sharpening | openxr_post_processing.super_sampling); - - accumulate_metrics(frame_state.predictedDisplayTime, current_blit_handles, timestamps); - - draw_gui(frame_state.predictedDisplayTime, frame_state.predictedDisplayPeriod); - - try - { - render_end(); - } - catch (std::system_error & e) - { - if (e.code().category() == xr::error_category() and e.code().value() == XR_ERROR_POSE_INVALID) - spdlog::info("Invalid pose submitted"); + if (use_alpha) + session.enable_passthrough(system); else - throw; + session.disable_passthrough(); + + render_start(use_alpha, frame_state.predictedDisplayTime); + + // Add the layer with the streamed content + std::array layer_view; + for (uint32_t view = 0; view < view_count; view++) + { + layer_view[view] = + { + .type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW, + .pose = pose[view], + .fov = fov[view], + + .subImage = { + .swapchain = swapchain, + .imageRect = { + .offset = {0, 0}, + .extent = extents[view], + }, + .imageArrayIndex = view, + }, + }; + } + add_projection_layer( + use_alpha ? XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT : 0, + application::space(xr::spaces::world), + layer_view); + + if (const configuration::openxr_post_processing_settings openxr_post_processing = application::get_config().openxr_post_processing; + (openxr_post_processing.sharpening | openxr_post_processing.super_sampling) > 0) + set_layer_settings(openxr_post_processing.sharpening | openxr_post_processing.super_sampling); + + accumulate_metrics(frame_state.predictedDisplayTime, current_blit_handles, timestamps); + + draw_gui(frame_state.predictedDisplayTime, frame_state.predictedDisplayPeriod); + + try + { + render_end(); + } + catch (std::system_error & e) + { + if (e.code().category() == xr::error_category() and e.code().value() == XR_ERROR_POSE_INVALID) + spdlog::info("Invalid pose submitted"); + else + throw; + } } // Network operations may be blocking, do them once everything was submitted From 51e3dd5adcf574088e58a76099f359c11aac0180 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 27 Apr 2026 11:22:44 +0200 Subject: [PATCH 3/5] factorize post-processing GUI code --- client/scenes/gui_common.cpp | 83 ++++++++++++++++++++++++++++++++++++ client/scenes/gui_common.h | 6 ++- client/scenes/lobby_gui.cpp | 76 +-------------------------------- client/scenes/stream_gui.cpp | 74 ++++---------------------------- 4 files changed, 97 insertions(+), 142 deletions(-) diff --git a/client/scenes/gui_common.cpp b/client/scenes/gui_common.cpp index 550ff8a4..95d00334 100644 --- a/client/scenes/gui_common.cpp +++ b/client/scenes/gui_common.cpp @@ -19,6 +19,7 @@ #include "gui_common.h" +#include "application.h" #include "configuration.h" #include "render/imgui_impl.h" #include "utils/i18n.h" @@ -114,4 +115,86 @@ bool refresh_rate( } return changed; } + +static std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag) +{ + switch (flag) + { + case XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB: + case XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB: + return _C("openxr_post_processing", "Normal"); + case XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB: + case XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB: + return _C("openxr_post_processing", "Quality"); + default: + return _C("openxr_post_processing", "Disabled"); + } +} + +bool post_processing( + imgui_context & imgui_ctx, + configuration & config) +{ + bool changed = false; + if (not application::get_openxr_post_processing_supported()) + return changed; + + ImGui::Text("%s", _S("OpenXR post-processing")); + ImGui::Indent(); + + { + XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.super_sampling; + if (ImGui::BeginCombo(_S("Supersampling"), openxr_post_processing_flag_name(current).c_str())) + { + const XrCompositionLayerSettingsFlagsFB selectable_options[]{ + 0, + XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB, + XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB}; + for (XrCompositionLayerSettingsFlagsFB option: selectable_options) + { + if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease)) + { + spdlog::info("Setting OpenXR super sampling to {}", openxr_post_processing_flag_name(option)); + config.openxr_post_processing.super_sampling = option; + config.save(); + changed = true; + } + imgui_ctx.vibrate_on_hover(); + } + ImGui::EndCombo(); + } + imgui_ctx.vibrate_on_hover(); + if (ImGui::IsItemHovered()) + imgui_ctx.tooltip(_("Reduce flicker for high contrast edges.\nUseful when the input resolution is high compared to the headset display")); + } + + { + XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.sharpening; + if (ImGui::BeginCombo(_S("Sharpening"), openxr_post_processing_flag_name(current).c_str())) + { + const XrCompositionLayerSettingsFlagsFB selectable_options[]{ + 0, + XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB, + XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB}; + for (XrCompositionLayerSettingsFlagsFB option: selectable_options) + { + if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease)) + { + spdlog::info("Setting OpenXR sharpening to {}", openxr_post_processing_flag_name(option)); + config.openxr_post_processing.sharpening = option; + config.save(); + changed = true; + } + imgui_ctx.vibrate_on_hover(); + } + ImGui::EndCombo(); + } + imgui_ctx.vibrate_on_hover(); + if (ImGui::IsItemHovered()) + imgui_ctx.tooltip(_("Improve clarity of high contrast edges and counteract blur.\nUseful when the input resolution is low compared to the headset display")); + } + + ImGui::Unindent(); + return changed; +} } // namespace wivrn::gui diff --git a/client/scenes/gui_common.h b/client/scenes/gui_common.h index 5475207b..e75ef9ab 100644 --- a/client/scenes/gui_common.h +++ b/client/scenes/gui_common.h @@ -40,5 +40,9 @@ bool refresh_rate( imgui_context & imgui_ctx, configuration & config); -} +bool post_processing( + imgui_context & imgui_ctx, + configuration & config); + +} // namespace gui } // namespace wivrn diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 2a5c3af9..b835f477 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -93,21 +93,6 @@ static void display_recentering_tip(imgui_context & ctx, const std::string & tip ImGui::PopFont(); } -std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag) -{ - switch (flag) - { - case XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB: - case XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB: - return _cS("openxr_post_processing", "Normal"); - case XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB: - case XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB: - return _cS("openxr_post_processing", "Quality"); - default: - return _cS("openxr_post_processing", "Disabled"); - } -} - void scenes::lobby::gui_connecting(locked_notifiable & pin_request) { using constants::style::button_size; @@ -883,67 +868,8 @@ void scenes::lobby::gui_settings() void scenes::lobby::gui_post_processing() { - auto & config = application::get_config(); - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(20, 20)); - - if (application::get_openxr_post_processing_supported()) - { - ImGui::Text("%s", _S("OpenXR post-processing")); - ImGui::Indent(); - { - XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.super_sampling; - if (ImGui::BeginCombo(_S("Supersampling"), openxr_post_processing_flag_name(current).c_str())) - { - const XrCompositionLayerSettingsFlagsFB selectable_options[]{ - 0, - XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB, - XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB}; - for (XrCompositionLayerSettingsFlagsFB option: selectable_options) - { - if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease)) - { - config.openxr_post_processing.super_sampling = option; - config.save(); - } - imgui_ctx->vibrate_on_hover(); - } - ImGui::EndCombo(); - } - imgui_ctx->vibrate_on_hover(); - if (ImGui::IsItemHovered()) - { - imgui_ctx->tooltip(_("Reduce flicker for high contrast edges.\nUseful when the input resolution is high compared to the headset display")); - } - } - { - XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.sharpening; - if (ImGui::BeginCombo(_S("Sharpening"), openxr_post_processing_flag_name(current).c_str())) - { - const XrCompositionLayerSettingsFlagsFB selectable_options[]{ - 0, - XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB, - XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB}; - for (XrCompositionLayerSettingsFlagsFB option: selectable_options) - { - if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease)) - { - config.openxr_post_processing.sharpening = option; - config.save(); - } - imgui_ctx->vibrate_on_hover(); - } - ImGui::EndCombo(); - } - imgui_ctx->vibrate_on_hover(); - if (ImGui::IsItemHovered()) - { - imgui_ctx->tooltip(_("Improve clarity of high contrast edges and counteract blur.\nUseful when the input resolution is low compared to the headset display")); - } - } - ImGui::Unindent(); - } - + gui::post_processing(*imgui_ctx, application::get_config()); ImGui::PopStyleVar(); } diff --git a/client/scenes/stream_gui.cpp b/client/scenes/stream_gui.cpp index dcceadb9..659cd8ed 100644 --- a/client/scenes/stream_gui.cpp +++ b/client/scenes/stream_gui.cpp @@ -380,16 +380,15 @@ void scenes::stream::gui_compact_view() static void send_settings_changed_packet(xr::session & session, wivrn_session * network, const configuration & config) { - from_headset::settings_changed packet{ - .preferred_refresh_rate = config.preferred_refresh_rate, - .minimum_refresh_rate = config.minimum_refresh_rate.value_or(0), - .fps_divider = config.fps_divider, - .bitrate_bps = config.bitrate_bps, - }; - network->send_control(std::move(packet)); + network->send_control( + from_headset::settings_changed{ + .preferred_refresh_rate = config.preferred_refresh_rate, + .minimum_refresh_rate = config.minimum_refresh_rate.value_or(0), + .fps_divider = config.fps_divider, + .bitrate_bps = config.bitrate_bps, + }); } -std::string openxr_post_processing_flag_name(XrCompositionLayerSettingsFlagsFB flag); // TODO declaration in a .h file void scenes::stream::gui_settings(float predicted_display_period) { const ImGuiStyle & style = ImGui::GetStyle(); @@ -414,64 +413,7 @@ void scenes::stream::gui_settings(float predicted_display_period) imgui_ctx->tooltip(_("Click to adjust bitrate")); } - if (application::get_openxr_post_processing_supported()) - { - ImGui::Text("%s", _S("OpenXR post-processing")); - ImGui::Indent(); - { - XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.super_sampling; - if (ImGui::BeginCombo(_S("Supersampling"), openxr_post_processing_flag_name(current).c_str())) - { - const XrCompositionLayerSettingsFlagsFB selectable_options[]{ - 0, - XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SUPER_SAMPLING_BIT_FB, - XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SUPER_SAMPLING_BIT_FB}; - for (XrCompositionLayerSettingsFlagsFB option: selectable_options) - { - if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease)) - { - spdlog::info("Setting OpenXR super sampling to {}", openxr_post_processing_flag_name(option)); - config.openxr_post_processing.super_sampling = option; - config.save(); - } - imgui_ctx->vibrate_on_hover(); - } - ImGui::EndCombo(); - } - imgui_ctx->vibrate_on_hover(); - if (ImGui::IsItemHovered()) - { - imgui_ctx->tooltip(_("Reduce flicker for high contrast edges.\nUseful when the input resolution is high compared to the headset display")); - } - } - { - XrCompositionLayerSettingsFlagsFB current = config.openxr_post_processing.sharpening; - if (ImGui::BeginCombo(_S("Sharpening"), openxr_post_processing_flag_name(current).c_str())) - { - const XrCompositionLayerSettingsFlagsFB selectable_options[]{ - 0, - XR_COMPOSITION_LAYER_SETTINGS_NORMAL_SHARPENING_BIT_FB, - XR_COMPOSITION_LAYER_SETTINGS_QUALITY_SHARPENING_BIT_FB}; - for (XrCompositionLayerSettingsFlagsFB option: selectable_options) - { - if (ImGui::Selectable(openxr_post_processing_flag_name(option).c_str(), current == option, ImGuiSelectableFlags_SelectOnRelease)) - { - spdlog::info("Setting OpenXR sharpening to {}", openxr_post_processing_flag_name(option)); - config.openxr_post_processing.sharpening = option; - config.save(); - } - imgui_ctx->vibrate_on_hover(); - } - ImGui::EndCombo(); - } - imgui_ctx->vibrate_on_hover(); - if (ImGui::IsItemHovered()) - { - imgui_ctx->tooltip(_("Improve clarity of high contrast edges and counteract blur.\nUseful when the input resolution is low compared to the headset display")); - } - } - ImGui::Unindent(); - } + gui::post_processing(*imgui_ctx, config); bool send_packet = false; bool save_config = false; From 5a205c15aef830865781e8ff149ede35445a1f7a Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 27 Apr 2026 13:56:09 +0200 Subject: [PATCH 4/5] Manually reload selectgame --- dashboard/qml/SelectGame.qml | 14 -------------- dashboard/qml/SettingsPage.qml | 2 ++ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/dashboard/qml/SelectGame.qml b/dashboard/qml/SelectGame.qml index 58728728..a80ff625 100644 --- a/dashboard/qml/SelectGame.qml +++ b/dashboard/qml/SelectGame.qml @@ -28,21 +28,12 @@ ColumnLayout { "is_custom": false }); } - - select_game.load(); } ListModel { id: apps } - Connections { - target: WivrnServer - function onJsonConfigurationChanged() { - select_game.load(); - } - } - Dialogs.FileDialog { id: app_browse onAccepted: { @@ -74,11 +65,6 @@ ColumnLayout { } function load() { - if (WivrnServer.jsonConfiguration == "") - return; - - Settings.load(WivrnServer); - var found = false; var custom_idx = -1; for (var i = 0; i < apps.count; i++) { diff --git a/dashboard/qml/SettingsPage.qml b/dashboard/qml/SettingsPage.qml index 49bc7482..db96d8b2 100644 --- a/dashboard/qml/SettingsPage.qml +++ b/dashboard/qml/SettingsPage.qml @@ -85,6 +85,7 @@ Kirigami.ScrollablePage { } SelectGame { + id: select_game Kirigami.FormData.label: i18n("Autostart application:") } @@ -287,6 +288,7 @@ Kirigami.ScrollablePage { } function load() { + select_game.load(); debug_gui.checked = Settings.debugGui; steamvr_lh.checked = Settings.steamVrLh; hid_forwarding.checked = Settings.hidForwarding; From 74c360ebe1e94e475b1691b3f1e793fc77572f18 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 27 Apr 2026 14:59:41 +0200 Subject: [PATCH 5/5] Fix nvenc max encode size check --- server/encoder/video_encoder_nvenc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/encoder/video_encoder_nvenc.cpp b/server/encoder/video_encoder_nvenc.cpp index 26a03541..04600fc3 100644 --- a/server/encoder/video_encoder_nvenc.cpp +++ b/server/encoder/video_encoder_nvenc.cpp @@ -603,12 +603,12 @@ std::array video_encoder_nvenc::get_max_size(video_codec codec) auto encodeGUID = encode_guid(codec); for (auto [cap, res]: { std::pair{NV_ENC_CAPS_WIDTH_MAX, &result[0]}, - {NV_ENC_CAPS_WIDTH_MAX, &result[1]}, + {NV_ENC_CAPS_HEIGHT_MAX, &result[1]}, }) { NV_ENC_CAPS_PARAM cap_params{ .version = NV_ENC_CAPS_PARAM_VER, - .capsToQuery = NV_ENC_CAPS_WIDTH_MAX, + .capsToQuery = cap, }; check_encode_guid_supported(state, session_handle, encodeGUID);