Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 16 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 17 | // #define LOG_NDEBUG 0 |
| 18 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
| 19 | |
Ady Abraham | b0dbdaa | 2020-01-06 16:19:42 -0800 | [diff] [blame] | 20 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 21 | #pragma clang diagnostic push |
| 22 | #pragma clang diagnostic ignored "-Wconversion" |
| 23 | |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 24 | #include "RefreshRateConfigs.h" |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 25 | #include <android-base/stringprintf.h> |
| 26 | #include <utils/Trace.h> |
| 27 | #include <chrono> |
| 28 | #include <cmath> |
| 29 | |
| 30 | using namespace std::chrono_literals; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 31 | |
| 32 | namespace android::scheduler { |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 33 | |
| 34 | using AllRefreshRatesMapType = RefreshRateConfigs::AllRefreshRatesMapType; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 35 | using RefreshRate = RefreshRateConfigs::RefreshRate; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 36 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 37 | const RefreshRate& RefreshRateConfigs::getRefreshRateForContent( |
| 38 | const std::vector<LayerRequirement>& layers) const { |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 39 | std::lock_guard lock(mLock); |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 40 | float contentFramerate = 0.0f; |
| 41 | float explicitContentFramerate = 0.0f; |
| 42 | for (const auto& layer : layers) { |
| 43 | if (layer.vote == LayerVoteType::Explicit) { |
| 44 | if (layer.desiredRefreshRate > explicitContentFramerate) { |
| 45 | explicitContentFramerate = layer.desiredRefreshRate; |
| 46 | } |
| 47 | } else { |
| 48 | if (layer.desiredRefreshRate > contentFramerate) { |
| 49 | contentFramerate = layer.desiredRefreshRate; |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | if (explicitContentFramerate != 0.0f) { |
| 55 | contentFramerate = explicitContentFramerate; |
| 56 | } else if (contentFramerate == 0.0f) { |
| 57 | contentFramerate = mMaxSupportedRefreshRate->fps; |
| 58 | } |
| 59 | contentFramerate = std::round(contentFramerate); |
| 60 | ATRACE_INT("ContentFPS", contentFramerate); |
| 61 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 62 | // Find the appropriate refresh rate with minimal error |
| 63 | auto iter = min_element(mAvailableRefreshRates.cbegin(), mAvailableRefreshRates.cend(), |
| 64 | [contentFramerate](const auto& lhs, const auto& rhs) -> bool { |
| 65 | return std::abs(lhs->fps - contentFramerate) < |
| 66 | std::abs(rhs->fps - contentFramerate); |
| 67 | }); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 68 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 69 | // Some content aligns better on higher refresh rate. For example for 45fps we should choose |
| 70 | // 90Hz config. However we should still prefer a lower refresh rate if the content doesn't |
| 71 | // align well with both |
| 72 | const RefreshRate* bestSoFar = *iter; |
| 73 | constexpr float MARGIN = 0.05f; |
| 74 | float ratio = (*iter)->fps / contentFramerate; |
| 75 | if (std::abs(std::round(ratio) - ratio) > MARGIN) { |
| 76 | while (iter != mAvailableRefreshRates.cend()) { |
| 77 | ratio = (*iter)->fps / contentFramerate; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 78 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 79 | if (std::abs(std::round(ratio) - ratio) <= MARGIN) { |
| 80 | bestSoFar = *iter; |
| 81 | break; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 82 | } |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 83 | ++iter; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 84 | } |
| 85 | } |
| 86 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 87 | return *bestSoFar; |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 88 | } |
| 89 | |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 90 | const RefreshRate& RefreshRateConfigs::getRefreshRateForContentV2( |
| 91 | const std::vector<LayerRequirement>& layers) const { |
| 92 | constexpr nsecs_t MARGIN = std::chrono::nanoseconds(800us).count(); |
| 93 | ATRACE_CALL(); |
| 94 | ALOGV("getRefreshRateForContent %zu layers", layers.size()); |
| 95 | |
| 96 | std::lock_guard lock(mLock); |
| 97 | |
| 98 | int noVoteLayers = 0; |
| 99 | int minVoteLayers = 0; |
| 100 | int maxVoteLayers = 0; |
| 101 | int explicitVoteLayers = 0; |
| 102 | for (const auto& layer : layers) { |
| 103 | if (layer.vote == LayerVoteType::NoVote) |
| 104 | noVoteLayers++; |
| 105 | else if (layer.vote == LayerVoteType::Min) |
| 106 | minVoteLayers++; |
| 107 | else if (layer.vote == LayerVoteType::Max) |
| 108 | maxVoteLayers++; |
| 109 | else if (layer.vote == LayerVoteType::Explicit) |
| 110 | explicitVoteLayers++; |
| 111 | } |
| 112 | |
| 113 | // Only if all layers want Min we should return Min |
| 114 | if (noVoteLayers + minVoteLayers == layers.size()) { |
| 115 | return *mAvailableRefreshRates.front(); |
| 116 | } |
| 117 | |
| 118 | // If we have some Max layers and no Explicit we should return Max |
| 119 | if (maxVoteLayers > 0 && explicitVoteLayers == 0) { |
| 120 | return *mAvailableRefreshRates.back(); |
| 121 | } |
| 122 | |
| 123 | // Find the best refresh rate based on score |
| 124 | std::vector<std::pair<const RefreshRate*, float>> scores; |
| 125 | scores.reserve(mAvailableRefreshRates.size()); |
| 126 | |
| 127 | for (const auto refreshRate : mAvailableRefreshRates) { |
| 128 | scores.emplace_back(refreshRate, 0.0f); |
| 129 | } |
| 130 | |
| 131 | for (const auto& layer : layers) { |
| 132 | if (layer.vote == LayerVoteType::NoVote || layer.vote == LayerVoteType::Min || |
| 133 | layer.vote == LayerVoteType::Max) { |
| 134 | continue; |
| 135 | } |
| 136 | |
| 137 | // If we have Explicit layers, ignore the Huristic ones |
| 138 | if (explicitVoteLayers > 0 && layer.vote == LayerVoteType::Heuristic) { |
| 139 | continue; |
| 140 | } |
| 141 | |
| 142 | for (auto& [refreshRate, overallScore] : scores) { |
| 143 | const auto displayPeriod = refreshRate->vsyncPeriod; |
| 144 | const auto layerPeriod = 1e9f / layer.desiredRefreshRate; |
| 145 | |
| 146 | // Calculate how many display vsyncs we need to present a single frame for this layer |
| 147 | auto [displayFramesQuot, displayFramesRem] = std::div(layerPeriod, displayPeriod); |
| 148 | if (displayFramesRem <= MARGIN || |
| 149 | std::abs(displayFramesRem - displayPeriod) <= MARGIN) { |
| 150 | displayFramesQuot++; |
| 151 | displayFramesRem = 0; |
| 152 | } |
| 153 | |
| 154 | float layerScore; |
| 155 | if (displayFramesRem == 0) { |
| 156 | // Layer desired refresh rate matches the display rate. |
| 157 | layerScore = layer.weight * 1.0f; |
| 158 | } else if (displayFramesQuot == 0) { |
| 159 | // Layer desired refresh rate is higher the display rate. |
| 160 | layerScore = layer.weight * layerPeriod / displayPeriod; |
| 161 | } else { |
| 162 | // Layer desired refresh rate is lower the display rate. Check how well it fits the |
| 163 | // cadence |
| 164 | auto diff = std::abs(displayFramesRem - (displayPeriod - displayFramesRem)); |
| 165 | int iter = 2; |
| 166 | static constexpr size_t MAX_ITERATOR = 10; // Stop calculating when score < 0.1 |
| 167 | while (diff > MARGIN && iter < MAX_ITERATOR) { |
| 168 | diff = diff - (displayPeriod - diff); |
| 169 | iter++; |
| 170 | } |
| 171 | |
| 172 | layerScore = layer.weight * 1.0f / iter; |
| 173 | } |
| 174 | |
| 175 | ALOGV("%s (weight %.2f) %.2fHz gives %s score of %.2f", layer.name.c_str(), |
| 176 | layer.weight, 1e9f / layerPeriod, refreshRate->name.c_str(), layerScore); |
| 177 | overallScore += layerScore; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | float max = 0; |
| 182 | const RefreshRate* bestRefreshRate = nullptr; |
| 183 | for (const auto [refreshRate, score] : scores) { |
| 184 | ALOGV("%s scores %.2f", refreshRate->name.c_str(), score); |
| 185 | |
| 186 | ATRACE_INT(refreshRate->name.c_str(), std::round(score * 100)); |
| 187 | |
| 188 | if (score > max) { |
| 189 | max = score; |
| 190 | bestRefreshRate = refreshRate; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return bestRefreshRate == nullptr ? *mCurrentRefreshRate : *bestRefreshRate; |
| 195 | } |
| 196 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 197 | const AllRefreshRatesMapType& RefreshRateConfigs::getAllRefreshRates() const { |
| 198 | return mRefreshRates; |
| 199 | } |
| 200 | |
| 201 | const RefreshRate& RefreshRateConfigs::getMinRefreshRateByPolicy() const { |
| 202 | std::lock_guard lock(mLock); |
| 203 | if (!mRefreshRateSwitching) { |
| 204 | return *mCurrentRefreshRate; |
| 205 | } else { |
| 206 | return *mAvailableRefreshRates.front(); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | const RefreshRate& RefreshRateConfigs::getMaxRefreshRateByPolicy() const { |
| 211 | std::lock_guard lock(mLock); |
| 212 | if (!mRefreshRateSwitching) { |
| 213 | return *mCurrentRefreshRate; |
| 214 | } else { |
| 215 | return *mAvailableRefreshRates.back(); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | const RefreshRate& RefreshRateConfigs::getCurrentRefreshRate() const { |
| 220 | std::lock_guard lock(mLock); |
| 221 | return *mCurrentRefreshRate; |
| 222 | } |
| 223 | |
| 224 | void RefreshRateConfigs::setCurrentConfigId(HwcConfigIndexType configId) { |
| 225 | std::lock_guard lock(mLock); |
| 226 | mCurrentRefreshRate = &mRefreshRates.at(configId); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | RefreshRateConfigs::RefreshRateConfigs(bool refreshRateSwitching, |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 230 | const std::vector<InputConfig>& configs, |
| 231 | HwcConfigIndexType currentHwcConfig) |
| 232 | : mRefreshRateSwitching(refreshRateSwitching) { |
| 233 | init(configs, currentHwcConfig); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | RefreshRateConfigs::RefreshRateConfigs( |
| 237 | bool refreshRateSwitching, |
| 238 | const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs, |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 239 | HwcConfigIndexType currentConfigId) |
| 240 | : mRefreshRateSwitching(refreshRateSwitching) { |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 241 | std::vector<InputConfig> inputConfigs; |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 242 | for (auto configId = HwcConfigIndexType(0); configId < HwcConfigIndexType(configs.size()); |
| 243 | ++configId) { |
| 244 | auto configGroup = HwcConfigGroupType(configs[configId.value()]->getConfigGroup()); |
| 245 | inputConfigs.push_back( |
| 246 | {configId, configGroup, configs[configId.value()]->getVsyncPeriod()}); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 247 | } |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 248 | init(inputConfigs, currentConfigId); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 249 | } |
| 250 | |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 251 | status_t RefreshRateConfigs::setPolicy(HwcConfigIndexType defaultConfigId, float minRefreshRate, |
| 252 | float maxRefreshRate, bool* outPolicyChanged) { |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 253 | std::lock_guard lock(mLock); |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 254 | bool policyChanged = defaultConfigId != mDefaultConfig || |
| 255 | minRefreshRate != mMinRefreshRateFps || maxRefreshRate != mMaxRefreshRateFps; |
| 256 | if (outPolicyChanged) { |
| 257 | *outPolicyChanged = policyChanged; |
| 258 | } |
| 259 | if (!policyChanged) { |
| 260 | return NO_ERROR; |
| 261 | } |
| 262 | // defaultConfigId must be a valid config ID, and within the given refresh rate range. |
| 263 | if (mRefreshRates.count(defaultConfigId) == 0) { |
| 264 | return BAD_VALUE; |
| 265 | } |
| 266 | const RefreshRate& refreshRate = mRefreshRates.at(defaultConfigId); |
Ana Krulec | 72f0d6e | 2020-01-06 15:24:47 -0800 | [diff] [blame] | 267 | if (!refreshRate.inPolicy(minRefreshRate, maxRefreshRate)) { |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 268 | return BAD_VALUE; |
| 269 | } |
| 270 | mDefaultConfig = defaultConfigId; |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 271 | mMinRefreshRateFps = minRefreshRate; |
| 272 | mMaxRefreshRateFps = maxRefreshRate; |
| 273 | constructAvailableRefreshRates(); |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 274 | return NO_ERROR; |
| 275 | } |
| 276 | |
| 277 | void RefreshRateConfigs::getPolicy(HwcConfigIndexType* defaultConfigId, float* minRefreshRate, |
| 278 | float* maxRefreshRate) const { |
| 279 | std::lock_guard lock(mLock); |
| 280 | *defaultConfigId = mDefaultConfig; |
| 281 | *minRefreshRate = mMinRefreshRateFps; |
| 282 | *maxRefreshRate = mMaxRefreshRateFps; |
| 283 | } |
| 284 | |
| 285 | bool RefreshRateConfigs::isConfigAllowed(HwcConfigIndexType config) const { |
| 286 | std::lock_guard lock(mLock); |
| 287 | for (const RefreshRate* refreshRate : mAvailableRefreshRates) { |
| 288 | if (refreshRate->configId == config) { |
| 289 | return true; |
| 290 | } |
| 291 | } |
| 292 | return false; |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | void RefreshRateConfigs::getSortedRefreshRateList( |
| 296 | const std::function<bool(const RefreshRate&)>& shouldAddRefreshRate, |
| 297 | std::vector<const RefreshRate*>* outRefreshRates) { |
| 298 | outRefreshRates->clear(); |
| 299 | outRefreshRates->reserve(mRefreshRates.size()); |
| 300 | for (const auto& [type, refreshRate] : mRefreshRates) { |
| 301 | if (shouldAddRefreshRate(refreshRate)) { |
| 302 | ALOGV("getSortedRefreshRateList: config %d added to list policy", |
| 303 | refreshRate.configId.value()); |
| 304 | outRefreshRates->push_back(&refreshRate); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | std::sort(outRefreshRates->begin(), outRefreshRates->end(), |
| 309 | [](const auto refreshRate1, const auto refreshRate2) { |
| 310 | return refreshRate1->vsyncPeriod > refreshRate2->vsyncPeriod; |
| 311 | }); |
| 312 | } |
| 313 | |
| 314 | void RefreshRateConfigs::constructAvailableRefreshRates() { |
| 315 | // Filter configs based on current policy and sort based on vsync period |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 316 | HwcConfigGroupType group = mRefreshRates.at(mDefaultConfig).configGroup; |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 317 | ALOGV("constructAvailableRefreshRates: default %d group %d min %.2f max %.2f", |
| 318 | mDefaultConfig.value(), group.value(), mMinRefreshRateFps, mMaxRefreshRateFps); |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 319 | getSortedRefreshRateList( |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 320 | [&](const RefreshRate& refreshRate) REQUIRES(mLock) { |
Ana Krulec | 72f0d6e | 2020-01-06 15:24:47 -0800 | [diff] [blame] | 321 | return refreshRate.configGroup == group && |
| 322 | refreshRate.inPolicy(mMinRefreshRateFps, mMaxRefreshRateFps); |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 323 | }, |
| 324 | &mAvailableRefreshRates); |
Ady Abraham | 8a82ba6 | 2020-01-17 12:43:17 -0800 | [diff] [blame^] | 325 | |
| 326 | std::string availableRefreshRates; |
| 327 | for (const auto& refreshRate : mAvailableRefreshRates) { |
| 328 | base::StringAppendF(&availableRefreshRates, "%s ", refreshRate->name.c_str()); |
| 329 | } |
| 330 | |
| 331 | ALOGV("Available refresh rates: %s", availableRefreshRates.c_str()); |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 332 | LOG_ALWAYS_FATAL_IF(mAvailableRefreshRates.empty(), |
| 333 | "No compatible display configs for default=%d min=%.0f max=%.0f", |
| 334 | mDefaultConfig.value(), mMinRefreshRateFps, mMaxRefreshRateFps); |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | // NO_THREAD_SAFETY_ANALYSIS since this is called from the constructor |
| 338 | void RefreshRateConfigs::init(const std::vector<InputConfig>& configs, |
| 339 | HwcConfigIndexType currentHwcConfig) NO_THREAD_SAFETY_ANALYSIS { |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 340 | LOG_ALWAYS_FATAL_IF(configs.empty()); |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 341 | LOG_ALWAYS_FATAL_IF(currentHwcConfig.value() >= configs.size()); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 342 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 343 | auto buildRefreshRate = [&](InputConfig config) -> RefreshRate { |
| 344 | const float fps = 1e9f / config.vsyncPeriod; |
| 345 | return RefreshRate(config.configId, config.vsyncPeriod, config.configGroup, |
| 346 | base::StringPrintf("%2.ffps", fps), fps); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 347 | }; |
| 348 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 349 | for (const auto& config : configs) { |
| 350 | mRefreshRates.emplace(config.configId, buildRefreshRate(config)); |
| 351 | if (config.configId == currentHwcConfig) { |
| 352 | mCurrentRefreshRate = &mRefreshRates.at(config.configId); |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 353 | } |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 354 | } |
| 355 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 356 | std::vector<const RefreshRate*> sortedConfigs; |
| 357 | getSortedRefreshRateList([](const RefreshRate&) { return true; }, &sortedConfigs); |
Ana Krulec | ed3a8cc | 2019-11-14 00:55:07 +0100 | [diff] [blame] | 358 | mDefaultConfig = currentHwcConfig; |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 359 | mMinSupportedRefreshRate = sortedConfigs.front(); |
| 360 | mMaxSupportedRefreshRate = sortedConfigs.back(); |
| 361 | constructAvailableRefreshRates(); |
Ady Abraham | b4b1e0a | 2019-11-20 18:25:35 -0800 | [diff] [blame] | 362 | } |
| 363 | |
Ady Abraham | 2139f73 | 2019-11-13 18:56:40 -0800 | [diff] [blame] | 364 | } // namespace android::scheduler |
Ady Abraham | b0dbdaa | 2020-01-06 16:19:42 -0800 | [diff] [blame] | 365 | // TODO(b/129481165): remove the #pragma below and fix conversion issues |
| 366 | #pragma clang diagnostic pop // ignored "-Wconversion" |