Don't fail when headset doesn't report refresh rates

This commit is contained in:
Patrick Nicolas committed 2025-01-12 18:03:43 +01:00
1 parent 820df671ca
commit d17bb7ffec
1 file changed
+10 -2
+10 -2
View File
@@ -716,8 +716,16 @@ static xrt_result_t comp_wivrn_get_refresh_rates(struct comp_target * ct, uint32
{
struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct;
const auto & rates = cn->cnx.get_info().available_refresh_rates;
*count = std::min<uint32_t>(rates.size(), XRT_MAX_SUPPORTED_REFRESH_RATES);
std::copy_n(rates.begin(), *count, refresh_rates_hz);
if (rates.empty())
{
*count = 1;
*refresh_rates_hz = cn->cnx.get_info().preferred_refresh_rate;
}
else
{
*count = std::min<uint32_t>(rates.size(), XRT_MAX_SUPPORTED_REFRESH_RATES);
std::copy_n(rates.begin(), *count, refresh_rates_hz);
}
return XRT_SUCCESS;
}