Fix refresh resh adjusting after quitting an app

This commit is contained in:
Patrick Nicolas
2026-01-29 09:51:59 +01:00
parent f5597a81fd
commit 30f472bdb4
+11 -3
View File
@@ -941,7 +941,7 @@ struct refresh_rate_adjuster
void adjust(wivrn_connection & cnx)
{
auto locked = settings.lock();
if (locked->preferred_refresh_rate != 0 or info.available_refresh_rates.size() < 2 or std::chrono::steady_clock::now() < next)
if (locked->preferred_refresh_rate != 0 or info.available_refresh_rates.size() < 2)
return;
// Maximum refresh rate the application can reach
@@ -1008,8 +1008,16 @@ void wivrn_session::run_worker(std::stop_token stop)
std::shared_lock lock(comp_target_mutex);
if (comp_target)
{
if (do_refresh and comp_target->requested_refresh_rate == 0)
refresh.adjust(*connection);
if (do_refresh)
{
{
scoped_lock lock(xrt_system.sessions.mutex);
if (xrt_system.sessions.count == 0)
comp_target->requested_refresh_rate = 0;
}
if (comp_target->requested_refresh_rate == 0)
refresh.adjust(*connection);
}
if (do_control)
control.resolve(comp_target->pacer.get_frame_duration(), tracking_latency);
}