History

Custom refresh rate profile WIP

This adds a Custom refresh rate profile with configurable refresh rate regimes. Unfortunately this commit does not work yet. The SpinBoxes inside GraphicsSettings are on top of each other, and changing the values for the Custom profile through e.g. the JS API does not actually affect the refresh rate cap at all for some reason.

latex committed 2 years ago

Commit a6646d81 parent f1475e46 files · +190 −4Browse files

Showing the changes to interface/src/RefreshRateManager.cpp (1 of 6 files). Show all

Unified · Split

interface/src/RefreshRateManager.cpp+21−1
@@ -94,7 +94,8 @@ static const std::array<std::string, RefreshRateManager::UXMode::UX_NUM> UX_MODE · 93 unmodified lines
94static const std::map<std::string, RefreshRateManager::RefreshRateProfile> REFRESH_RATE_PROFILE_FROM_STRING =94static const std::map<std::string, RefreshRateManager::RefreshRateProfile> REFRESH_RATE_PROFILE_FROM_STRING =
95 { { "Eco", RefreshRateManager::RefreshRateProfile::ECO },95 { { "Eco", RefreshRateManager::RefreshRateProfile::ECO },
96 { "Interactive", RefreshRateManager::RefreshRateProfile::INTERACTIVE },96 { "Interactive", RefreshRateManager::RefreshRateProfile::INTERACTIVE },
97 { "Realtime", RefreshRateManager::RefreshRateProfile::REALTIME } };97 { "Realtime", RefreshRateManager::RefreshRateProfile::REALTIME },
98 { "Custom", RefreshRateManager::RefreshRateProfile::CUSTOM } };
98 99
99 100
100// Porfile regimes are:101// Porfile regimes are:
@@ -168,6 +169,25 @@ void RefreshRateManager::setRefreshRateProfile(RefreshRateManager::RefreshRatePr · 67 unmodified lines
168 }169 }
169}170}
170 171
172int RefreshRateManager::getCustomRefreshRate(RefreshRateRegime regime)
173{
174 Q_ASSERT(regime >= 0 && regime < RefreshRateRegime::REGIME_NUM);
175 if (regime < 0 && regime >= RefreshRateRegime::REGIME_NUM)
176 return -1;
177
178 return _customProfile[regime];
179}
180
181int RefreshRateManager::setCustomRefreshRate(RefreshRateRegime regime, int value)
182{
183 Q_ASSERT(regime >= 0 && regime < RefreshRateRegime::REGIME_NUM);
184 if (regime < 0 && regime >= RefreshRateRegime::REGIME_NUM)
185 return -1;
186
187 _customProfile[regime] = value;
188 return 0;
189}
190
171RefreshRateManager::RefreshRateProfile RefreshRateManager::getRefreshRateProfile() const {191RefreshRateManager::RefreshRateProfile RefreshRateManager::getRefreshRateProfile() const {
172 RefreshRateManager::RefreshRateProfile profile = RefreshRateManager::RefreshRateProfile::REALTIME;192 RefreshRateManager::RefreshRateProfile profile = RefreshRateManager::RefreshRateProfile::REALTIME;
173 193