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) void adjust(wivrn_connection & cnx)
{ {
auto locked = settings.lock(); 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; return;
// Maximum refresh rate the application can reach // 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); std::shared_lock lock(comp_target_mutex);
if (comp_target) if (comp_target)
{ {
if (do_refresh and comp_target->requested_refresh_rate == 0) if (do_refresh)
refresh.adjust(*connection); {
{
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) if (do_control)
control.resolve(comp_target->pacer.get_frame_duration(), tracking_latency); control.resolve(comp_target->pacer.get_frame_duration(), tracking_latency);
} }