set refresh rate on session pause / resume

This commit is contained in:
caszuu
2026-02-27 16:03:18 +01:00
committed by xytovl
parent 9a81bc8213
commit b5e93607df
3 changed files with 16 additions and 0 deletions
+5
View File
@@ -869,6 +869,11 @@ void wivrn_comp_target::set_refresh_rate(float refresh_rate_hz)
encoder->set_framerate(refresh_rate_hz); encoder->set_framerate(refresh_rate_hz);
} }
float wivrn_comp_target::get_refresh_rate()
{
return desc.fps;
}
wivrn_comp_target::wivrn_comp_target(wivrn::wivrn_session & cnx, struct comp_compositor * c) : wivrn_comp_target::wivrn_comp_target(wivrn::wivrn_session & cnx, struct comp_compositor * c) :
comp_target{ comp_target{
.c = c, .c = c,
+1
View File
@@ -114,6 +114,7 @@ struct wivrn_comp_target : public comp_target
void set_bitrate(uint32_t bitrate_bps); void set_bitrate(uint32_t bitrate_bps);
void set_refresh_rate(float); void set_refresh_rate(float);
float get_refresh_rate();
}; };
inline float get_default_rate(const from_headset::headset_info_packet & info, const from_headset::settings_changed & settings) inline float get_default_rate(const from_headset::headset_info_packet & info, const from_headset::settings_changed & settings)
+10
View File
@@ -437,7 +437,17 @@ void wivrn_session::resume_session()
{ {
std::shared_lock lock(comp_target_mutex); std::shared_lock lock(comp_target_mutex);
if (comp_target) if (comp_target)
{
float target_fps = get_default_rate(get_info(), *get_settings());
if (target_fps != comp_target->get_refresh_rate())
(*this)(from_headset::refresh_rate_changed{
.from = comp_target->get_refresh_rate(),
.to = target_fps,
});
comp_target->resume(); comp_target->resume();
}
} }
(*this)(from_headset::get_application_list{ (*this)(from_headset::get_application_list{