Control automatic refresh rate adjustment

If an OpenXR application requests a specific frame rate, use that one.
In order to revert to automatic adjustment, an application shall request
a 0 refresh rate (no preference).
This commit is contained in:
Patrick Nicolas
2025-03-19 17:43:37 +01:00
parent 37de69f9df
commit 119e0a4336
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -743,6 +743,7 @@ static xrt_result_t comp_wivrn_get_current_refresh_rate(struct comp_target * ct,
static xrt_result_t comp_wivrn_request_refresh_rate(struct comp_target * ct, float refresh_rate_hz)
{
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
cn->requested_refresh_rate = refresh_rate_hz;
if (refresh_rate_hz == 0.0f)
refresh_rate_hz = get_default_rate(cn->cnx.get_info());
+2
View File
@@ -100,6 +100,8 @@ struct wivrn_comp_target : public comp_target
wivrn::wivrn_session & cnx;
std::unique_ptr<wivrn_foveation_renderer> foveation_renderer = nullptr;
std::atomic<float> requested_refresh_rate;
wivrn_comp_target(wivrn::wivrn_session & cnx, struct comp_compositor * c);
~wivrn_comp_target();
+2 -1
View File
@@ -595,7 +595,8 @@ void wivrn_session::run(std::stop_token stop)
{
offset_est.request_sample(*connection);
tracking_control.send(*connection);
refresh.adjust(*connection);
if (comp_target->requested_refresh_rate == 0)
refresh.adjust(*connection);
connection->poll(*this, 20);
}
catch (const std::exception & e)