Add a setting for minimum (automatic) refresh rate

This commit is contained in:
Patrick Nicolas
2025-04-08 20:15:44 +02:00
parent 2f195857e7
commit 9ed0b0a3f4
4 changed files with 35 additions and 1 deletions
+8 -1
View File
@@ -184,11 +184,18 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
if (self->instance.has_extension(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME))
{
info.available_refresh_rates = self->session.get_refresh_rates();
// I can't find anythin in specification the ensures it won't be empty
// I can't find anything in specification the ensures it won't be empty
if (not info.available_refresh_rates.empty())
{
if (config.preferred_refresh_rate and (config.preferred_refresh_rate == 0 or utils::contains(info.available_refresh_rates, *config.preferred_refresh_rate)))
{
info.preferred_refresh_rate = *config.preferred_refresh_rate;
if (info.preferred_refresh_rate == 0)
info.available_refresh_rates = {
std::ranges::lower_bound(info.available_refresh_rates, config.minimum_refresh_rate),
info.available_refresh_rates.end(),
};
}
else
{
// Default to highest refresh rate