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:
@@ -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());
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user