From d17bb7ffec7bd6e5bb9bcf294905860dd67a631a Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 12 Jan 2025 17:59:24 +0100 Subject: [PATCH] Don't fail when headset doesn't report refresh rates --- server/driver/wivrn_comp_target.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index 53dd45ab..4e0eaeeb 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -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(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(rates.size(), XRT_MAX_SUPPORTED_REFRESH_RATES); + std::copy_n(rates.begin(), *count, refresh_rates_hz); + } return XRT_SUCCESS; }