diff options
14 files changed, 70 insertions, 179 deletions
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp index e4b0287148..d2af9126b3 100644 --- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp +++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp @@ -199,20 +199,12 @@ const AllRefreshRatesMapType& RefreshRateConfigs::getAllRefreshRates() const { const RefreshRate& RefreshRateConfigs::getMinRefreshRateByPolicy() const { std::lock_guard lock(mLock); - if (!mRefreshRateSwitching) { - return *mCurrentRefreshRate; - } else { - return *mAvailableRefreshRates.front(); - } + return *mAvailableRefreshRates.front(); } const RefreshRate& RefreshRateConfigs::getMaxRefreshRateByPolicy() const { std::lock_guard lock(mLock); - if (!mRefreshRateSwitching) { - return *mCurrentRefreshRate; - } else { return *mAvailableRefreshRates.back(); - } } const RefreshRate& RefreshRateConfigs::getCurrentRefreshRate() const { @@ -225,18 +217,14 @@ void RefreshRateConfigs::setCurrentConfigId(HwcConfigIndexType configId) { mCurrentRefreshRate = &mRefreshRates.at(configId); } -RefreshRateConfigs::RefreshRateConfigs(bool refreshRateSwitching, - const std::vector<InputConfig>& configs, - HwcConfigIndexType currentHwcConfig) - : mRefreshRateSwitching(refreshRateSwitching) { +RefreshRateConfigs::RefreshRateConfigs(const std::vector<InputConfig>& configs, + HwcConfigIndexType currentHwcConfig) { init(configs, currentHwcConfig); } RefreshRateConfigs::RefreshRateConfigs( - bool refreshRateSwitching, const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs, - HwcConfigIndexType currentConfigId) - : mRefreshRateSwitching(refreshRateSwitching) { + HwcConfigIndexType currentConfigId) { std::vector<InputConfig> inputConfigs; for (size_t configId = 0; configId < configs.size(); ++configId) { auto configGroup = HwcConfigGroupType(configs[configId]->getConfigGroup()); diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h index 80d42cc620..c762efddd6 100644 --- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h +++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h @@ -94,9 +94,6 @@ public: // Returns true if config is allowed by the current policy. bool isConfigAllowed(HwcConfigIndexType config) const EXCLUDES(mLock); - // Returns true if this device is doing refresh rate switching. This won't change at runtime. - bool refreshRateSwitchingSupported() const { return mRefreshRateSwitching; } - // Describes the different options the layer voted for refresh rate enum class LayerVoteType { NoVote, // Doesn't care about the refresh rate @@ -164,10 +161,9 @@ public: nsecs_t vsyncPeriod = 0; }; - RefreshRateConfigs(bool refreshRateSwitching, const std::vector<InputConfig>& configs, + RefreshRateConfigs(const std::vector<InputConfig>& configs, HwcConfigIndexType currentHwcConfig); - RefreshRateConfigs(bool refreshRateSwitching, - const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs, + RefreshRateConfigs(const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs, HwcConfigIndexType currentConfigId); private: @@ -205,8 +201,6 @@ private: const RefreshRate* mMinSupportedRefreshRate; const RefreshRate* mMaxSupportedRefreshRate; - const bool mRefreshRateSwitching; - mutable std::mutex mLock; }; diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index 7de35af440..258ce0a7e2 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -529,8 +529,6 @@ void Scheduler::dump(std::string& result) const { using base::StringAppendF; const char* const states[] = {"off", "on"}; - const bool supported = mRefreshRateConfigs.refreshRateSwitchingSupported(); - StringAppendF(&result, "+ Refresh rate switching: %s\n", states[supported]); StringAppendF(&result, "+ Content detection: %s\n", states[mLayerHistory != nullptr]); StringAppendF(&result, "+ Idle timer: %s\n", @@ -573,35 +571,44 @@ bool Scheduler::layerHistoryHasClientSpecifiedFrameRate() { } HwcConfigIndexType Scheduler::calculateRefreshRateType() { - if (!mRefreshRateConfigs.refreshRateSwitchingSupported()) { - return mRefreshRateConfigs.getCurrentRefreshRate().configId; + // This block of the code checks whether any layers used the SetFrameRate API. If they have, + // their request should be honored regardless of whether the device has refresh rate switching + // turned off. + if (layerHistoryHasClientSpecifiedFrameRate()) { + if (!mUseContentDetectionV2) { + return mRefreshRateConfigs.getRefreshRateForContent(mFeatures.contentRequirements) + .configId; + } else { + return mRefreshRateConfigs.getRefreshRateForContentV2(mFeatures.contentRequirements) + .configId; + } } // If the layer history doesn't have the frame rate specified, use the old path. NOTE: // if we remove the kernel idle timer, and use our internal idle timer, this code will have to // be refactored. - if (!layerHistoryHasClientSpecifiedFrameRate()) { - // If Display Power is not in normal operation we want to be in performance mode. - // When coming back to normal mode, a grace period is given with DisplayPowerTimer - if (!mFeatures.isDisplayPowerStateNormal || - mFeatures.displayPowerTimer == TimerState::Reset) { - return mRefreshRateConfigs.getMaxRefreshRateByPolicy().configId; - } + // If Display Power is not in normal operation we want to be in performance mode. + // When coming back to normal mode, a grace period is given with DisplayPowerTimer + if (mDisplayPowerTimer && + (!mFeatures.isDisplayPowerStateNormal || + mFeatures.displayPowerTimer == TimerState::Reset)) { + return mRefreshRateConfigs.getMaxRefreshRateByPolicy().configId; + } - // As long as touch is active we want to be in performance mode - if (mFeatures.touch == TouchState::Active) { - return mRefreshRateConfigs.getMaxRefreshRateByPolicy().configId; - } + // As long as touch is active we want to be in performance mode + if (mTouchTimer && mFeatures.touch == TouchState::Active) { + return mRefreshRateConfigs.getMaxRefreshRateByPolicy().configId; + } - // If timer has expired as it means there is no new content on the screen - if (mFeatures.idleTimer == TimerState::Expired) { - return mRefreshRateConfigs.getMinRefreshRateByPolicy().configId; - } + // If timer has expired as it means there is no new content on the screen + if (mIdleTimer && mFeatures.idleTimer == TimerState::Expired) { + return mRefreshRateConfigs.getMinRefreshRateByPolicy().configId; } if (!mUseContentDetectionV2) { - // If content detection is off we choose performance as we don't know the content fps + // If content detection is off we choose performance as we don't know the content fps. if (mFeatures.contentDetection == ContentDetectionState::Off) { + // TODO(b/148428554): Be careful to not always call this. return mRefreshRateConfigs.getMaxRefreshRateByPolicy().configId; } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 61d197ca68..e7c2dbc324 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -538,12 +538,6 @@ void SurfaceFlinger::bootFinished() readPersistentProperties(); mBootStage = BootStage::FINISHED; - if (mRefreshRateConfigs->refreshRateSwitchingSupported()) { - // set the refresh rate according to the policy - const auto& performanceRefreshRate = mRefreshRateConfigs->getMaxRefreshRateByPolicy(); - changeRefreshRateLocked(performanceRefreshRate, Scheduler::ConfigEvent::None); - } - if (property_get_bool("sf.debug.show_refresh_rate_overlay", false)) { mRefreshRateOverlay = std::make_unique<RefreshRateOverlay>(*this); mRefreshRateOverlay->changeRefreshRate(mRefreshRateConfigs->getCurrentRefreshRate()); @@ -2699,8 +2693,7 @@ void SurfaceFlinger::initScheduler(DisplayId primaryDisplayId) { auto currentConfig = HwcConfigIndexType(getHwComposer().getActiveConfigIndex(primaryDisplayId)); mRefreshRateConfigs = - std::make_unique<scheduler::RefreshRateConfigs>(refresh_rate_switching(false), - getHwComposer().getConfigs( + std::make_unique<scheduler::RefreshRateConfigs>(getHwComposer().getConfigs( primaryDisplayId), currentConfig); mRefreshRateStats = @@ -5681,26 +5674,19 @@ status_t SurfaceFlinger::setDesiredDisplayConfigSpecsInternal(const sp<DisplayDe mScheduler->onConfigChanged(mAppConnectionHandle, display->getId()->value, display->getActiveConfig(), vsyncPeriod); - if (mRefreshRateConfigs->refreshRateSwitchingSupported()) { - auto configId = mScheduler->getPreferredConfigId(); - auto preferredRefreshRate = configId - ? mRefreshRateConfigs->getRefreshRateFromConfigId(*configId) - : mRefreshRateConfigs->getMinRefreshRateByPolicy(); - ALOGV("trying to switch to Scheduler preferred config %d (%s)", - preferredRefreshRate.configId.value(), preferredRefreshRate.name.c_str()); - if (isDisplayConfigAllowed(preferredRefreshRate.configId)) { - ALOGV("switching to Scheduler preferred config %d", - preferredRefreshRate.configId.value()); - setDesiredActiveConfig( - {preferredRefreshRate.configId, Scheduler::ConfigEvent::Changed}); - } else { - // Set the highest allowed config - setDesiredActiveConfig({mRefreshRateConfigs->getMaxRefreshRateByPolicy().configId, - Scheduler::ConfigEvent::Changed}); - } + auto configId = mScheduler->getPreferredConfigId(); + auto preferredRefreshRate = configId + ? mRefreshRateConfigs->getRefreshRateFromConfigId(*configId) + // NOTE: Choose the default config ID, if Scheduler doesn't have one in mind. + : mRefreshRateConfigs->getRefreshRateFromConfigId(defaultConfig); + ALOGV("trying to switch to Scheduler preferred config %d (%s)", + preferredRefreshRate.configId.value(), preferredRefreshRate.name.c_str()); + + if (isDisplayConfigAllowed(preferredRefreshRate.configId)) { + ALOGV("switching to Scheduler preferred config %d", preferredRefreshRate.configId.value()); + setDesiredActiveConfig({preferredRefreshRate.configId, Scheduler::ConfigEvent::Changed}); } else { - ALOGV("switching to config %d", defaultConfig.value()); - setDesiredActiveConfig({defaultConfig, Scheduler::ConfigEvent::Changed}); + LOG_ALWAYS_FATAL("Desired config not allowed: %d", preferredRefreshRate.configId.value()); } return NO_ERROR; diff --git a/services/surfaceflinger/SurfaceFlingerProperties.cpp b/services/surfaceflinger/SurfaceFlingerProperties.cpp index b4716eb61e..768074a6cd 100644 --- a/services/surfaceflinger/SurfaceFlingerProperties.cpp +++ b/services/surfaceflinger/SurfaceFlingerProperties.cpp @@ -226,14 +226,6 @@ int64_t color_space_agnostic_dataspace(Dataspace defaultValue) { return static_cast<int64_t>(defaultValue); } -bool refresh_rate_switching(bool defaultValue) { - auto temp = SurfaceFlingerProperties::refresh_rate_switching(); - if (temp.has_value()) { - return *temp; - } - return defaultValue; -} - int32_t set_idle_timer_ms(int32_t defaultValue) { auto temp = SurfaceFlingerProperties::set_idle_timer_ms(); if (temp.has_value()) { diff --git a/services/surfaceflinger/SurfaceFlingerProperties.h b/services/surfaceflinger/SurfaceFlingerProperties.h index e394ccab7b..5f88322f71 100644 --- a/services/surfaceflinger/SurfaceFlingerProperties.h +++ b/services/surfaceflinger/SurfaceFlingerProperties.h @@ -73,8 +73,6 @@ int32_t wcg_composition_pixel_format( int64_t color_space_agnostic_dataspace( android::hardware::graphics::common::V1_2::Dataspace defaultValue); -bool refresh_rate_switching(bool defaultValue); - int32_t set_idle_timer_ms(int32_t defaultValue); int32_t set_touch_timer_ms(int32_t defaultValue); diff --git a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop index ed2b220e86..06539596f8 100644 --- a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop +++ b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop @@ -301,18 +301,6 @@ prop { prop_name: "ro.surface_flinger.display_primary_white" } -# refreshRateSwitching indicates whether SurfaceFlinger should use refresh rate -# switching on the device, e.g. to switch between 60 and 90 Hz. The settings -# below that are related to refresh rate switching will only have an effect if -# refresh_rate_switching is enabled. -prop { - api_name: "refresh_rate_switching" - type: Boolean - scope: System - access: Readonly - prop_name: "ro.surface_flinger.refresh_rate_switching" -} - prop { api_name: "set_idle_timer_ms" type: Integer diff --git a/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt b/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt index d24ad18eaf..1adab846f4 100644 --- a/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt +++ b/services/surfaceflinger/sysprop/api/SurfaceFlingerProperties-current.txt @@ -73,10 +73,6 @@ props { enum_values: "ORIENTATION_0|ORIENTATION_90|ORIENTATION_180|ORIENTATION_270" } prop { - api_name: "refresh_rate_switching" - prop_name: "ro.surface_flinger.refresh_rate_switching" - } - prop { api_name: "running_without_sync_framework" prop_name: "ro.surface_flinger.running_without_sync_framework" } diff --git a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp index 9ca1b70a1f..68b7a74ec4 100644 --- a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp +++ b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp @@ -63,8 +63,7 @@ protected: auto createLayer() { return sp<mock::MockLayer>(new mock::MockLayer(mFlinger.flinger())); } - RefreshRateConfigs mConfigs{true, - { + RefreshRateConfigs mConfigs{{ RefreshRateConfigs::InputConfig{HwcConfigIndexType(0), HwcConfigGroupType(0), LO_FPS_PERIOD}, diff --git a/services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp b/services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp index 922966a70d..8d39dcad5e 100644 --- a/services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp +++ b/services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp @@ -72,8 +72,7 @@ protected: auto createLayer() { return sp<mock::MockLayer>(new mock::MockLayer(mFlinger.flinger())); } - RefreshRateConfigs mConfigs{true, - { + RefreshRateConfigs mConfigs{{ RefreshRateConfigs::InputConfig{HwcConfigIndexType(0), HwcConfigGroupType(0), LO_FPS_PERIOD}, diff --git a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp index 19a58dc6b2..cd9f2b1cd6 100644 --- a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp +++ b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp @@ -74,26 +74,14 @@ TEST_F(RefreshRateConfigsTest, oneDeviceConfig_SwitchingSupported) { std::vector<RefreshRateConfigs::InputConfig> configs{ {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); -} - -TEST_F(RefreshRateConfigsTest, oneDeviceConfig_SwitchingNotSupported) { - std::vector<RefreshRateConfigs::InputConfig> configs{ - {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}}}; - auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/false, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - ASSERT_FALSE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); } TEST_F(RefreshRateConfigsTest, invalidPolicy) { std::vector<RefreshRateConfigs::InputConfig> configs{ {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); ASSERT_LT(refreshRateConfigs->setPolicy(HwcConfigIndexType(10), 60, 60, nullptr), 0); ASSERT_LT(refreshRateConfigs->setPolicy(HWC_CONFIG_ID_60, 20, 40, nullptr), 0); } @@ -103,10 +91,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_storesFullRefreshRateMap) { {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); const auto minRate = refreshRateConfigs->getMinRefreshRate(); const auto performanceRate = refreshRateConfigs->getMaxRefreshRate(); @@ -128,10 +113,8 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_storesFullRefreshRateMap_differe {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_1, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); const auto minRate = refreshRateConfigs->getMinRefreshRateByPolicy(); const auto performanceRate = refreshRateConfigs->getMaxRefreshRate(); const auto minRate60 = refreshRateConfigs->getMinRefreshRateByPolicy(); @@ -145,7 +128,6 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_storesFullRefreshRateMap_differe ASSERT_GE(refreshRateConfigs->setPolicy(HWC_CONFIG_ID_90, 60, 90, nullptr), 0); refreshRateConfigs->setCurrentConfigId(HWC_CONFIG_ID_90); - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); const auto minRate90 = refreshRateConfigs->getMinRefreshRateByPolicy(); const auto performanceRate90 = refreshRateConfigs->getMaxRefreshRateByPolicy(); @@ -161,9 +143,8 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_policyChange) { {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); + auto minRate = refreshRateConfigs->getMinRefreshRateByPolicy(); auto performanceRate = refreshRateConfigs->getMaxRefreshRateByPolicy(); @@ -174,7 +155,6 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_policyChange) { ASSERT_EQ(expectedPerformanceConfig, performanceRate); ASSERT_GE(refreshRateConfigs->setPolicy(HWC_CONFIG_ID_60, 60, 60, nullptr), 0); - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); auto minRate60 = refreshRateConfigs->getMinRefreshRateByPolicy(); auto performanceRate60 = refreshRateConfigs->getMaxRefreshRateByPolicy(); @@ -187,8 +167,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getCurrentRefreshRate) { {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); { auto current = refreshRateConfigs->getCurrentRefreshRate(); EXPECT_EQ(current.configId, HWC_CONFIG_ID_60); @@ -212,10 +191,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContent) { {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; RefreshRate expected90Config = {HWC_CONFIG_ID_90, VSYNC_90, HWC_GROUP_ID_0, "90fps", 90}; @@ -276,10 +252,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_60_90 {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; RefreshRate expected90Config = {HWC_CONFIG_ID_90, VSYNC_90, HWC_GROUP_ID_0, "90fps", 90}; @@ -387,10 +360,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_60_72 {HWC_CONFIG_ID_72, HWC_GROUP_ID_0, VSYNC_72}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; RefreshRate expected72Config = {HWC_CONFIG_ID_72, VSYNC_72, HWC_GROUP_ID_0, "72fps", 70}; @@ -430,10 +400,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_30_60 {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}, {HWC_CONFIG_ID_120, HWC_GROUP_ID_0, VSYNC_120}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected30Config = {HWC_CONFIG_ID_30, VSYNC_30, HWC_GROUP_ID_0, "30fps", 30}; RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; @@ -470,10 +437,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_30_60 {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_30, HWC_GROUP_ID_0, VSYNC_30}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; RefreshRate expected30Config = {HWC_CONFIG_ID_30, VSYNC_30, HWC_GROUP_ID_0, "30fps", 30}; @@ -511,10 +475,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_30_60 {HWC_CONFIG_ID_72, HWC_GROUP_ID_0, VSYNC_72}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected30Config = {HWC_CONFIG_ID_30, VSYNC_30, HWC_GROUP_ID_0, "30fps", 30}; RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; @@ -553,10 +514,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_Prior {HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected30Config = {HWC_CONFIG_ID_30, VSYNC_30, HWC_GROUP_ID_0, "30fps", 30}; RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; @@ -609,10 +567,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_24Fps {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected30Config = {HWC_CONFIG_ID_30, VSYNC_30, HWC_GROUP_ID_0, "30fps", 30}; RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; @@ -635,10 +590,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContent_Explici {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; RefreshRate expected90Config = {HWC_CONFIG_ID_90, VSYNC_90, HWC_GROUP_ID_0, "90fps", 90}; @@ -666,10 +618,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_Expli {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; RefreshRate expected90Config = {HWC_CONFIG_ID_90, VSYNC_90, HWC_GROUP_ID_0, "90fps", 90}; @@ -707,10 +656,7 @@ TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_75HzC {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60}, {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}}; auto refreshRateConfigs = - std::make_unique<RefreshRateConfigs>(/*refreshRateSwitching=*/true, configs, - /*currentConfigId=*/HWC_CONFIG_ID_60); - - ASSERT_TRUE(refreshRateConfigs->refreshRateSwitchingSupported()); + std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60); RefreshRate expected30Config = {HWC_CONFIG_ID_30, VSYNC_30, HWC_GROUP_ID_0, "30fps", 30}; RefreshRate expected60Config = {HWC_CONFIG_ID_60, VSYNC_60, HWC_GROUP_ID_0, "60fps", 60}; diff --git a/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp index 8e07c79656..18d6bd21e6 100644 --- a/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp +++ b/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp @@ -47,8 +47,8 @@ protected: ~RefreshRateStatsTest(); void init(const std::vector<RefreshRateConfigs::InputConfig>& configs) { - mRefreshRateConfigs = std::make_unique<RefreshRateConfigs>( - /*refreshRateSwitching=*/true, configs, /*currentConfig=*/CONFIG_ID_0); + mRefreshRateConfigs = + std::make_unique<RefreshRateConfigs>(configs, /*currentConfig=*/CONFIG_ID_0); mRefreshRateStats = std::make_unique<RefreshRateStats>(*mRefreshRateConfigs, mTimeStats, /*currentConfigId=*/CONFIG_ID_0, diff --git a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp index 82a00ee734..89002a8f3e 100644 --- a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp +++ b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp @@ -73,8 +73,7 @@ SchedulerTest::SchedulerTest() { std::vector<scheduler::RefreshRateConfigs::InputConfig> configs{ {{HwcConfigIndexType(0), HwcConfigGroupType(0), 16666667}}}; mRefreshRateConfigs = std::make_unique< - scheduler::RefreshRateConfigs>(/*refreshRateSwitching=*/false, configs, - /*currentConfig=*/HwcConfigIndexType(0)); + scheduler::RefreshRateConfigs>(configs, /*currentConfig=*/HwcConfigIndexType(0)); mScheduler = std::make_unique<TestableScheduler>(*mRefreshRateConfigs, false); diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h index 2491533ea4..be233bb866 100644 --- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h +++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h @@ -203,8 +203,7 @@ public: std::vector<scheduler::RefreshRateConfigs::InputConfig> configs{ {{HwcConfigIndexType(0), HwcConfigGroupType(0), 16666667}}}; mFlinger->mRefreshRateConfigs = std::make_unique< - scheduler::RefreshRateConfigs>(/*refreshRateSwitching=*/false, configs, - /*currentConfig=*/HwcConfigIndexType(0)); + scheduler::RefreshRateConfigs>(configs, /*currentConfig=*/HwcConfigIndexType(0)); mFlinger->mRefreshRateStats = std::make_unique< scheduler::RefreshRateStats>(*mFlinger->mRefreshRateConfigs, *mFlinger->mTimeStats, /*currentConfig=*/HwcConfigIndexType(0), |