diff options
9 files changed, 20 insertions, 23 deletions
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp index 369021995c..3b17857586 100644 --- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp @@ -288,7 +288,7 @@ bool AidlComposer::isSupported(OptionalFeature feature) const { } } -bool AidlComposer::getDisplayConfigurationsSupported() const { +bool AidlComposer::isVrrSupported() const { return mComposerInterfaceVersion >= 3 && FlagManager::getInstance().vrr_config(); } diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h index 1635a16ec8..6d8b42b476 100644 --- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h +++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h @@ -66,7 +66,7 @@ public: ~AidlComposer() override; bool isSupported(OptionalFeature) const; - bool getDisplayConfigurationsSupported() const; + bool isVrrSupported() const; std::vector<aidl::android::hardware::graphics::composer3::Capability> getCapabilities() override; diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.h b/services/surfaceflinger/DisplayHardware/ComposerHal.h index 082717a65b..4b090be00a 100644 --- a/services/surfaceflinger/DisplayHardware/ComposerHal.h +++ b/services/surfaceflinger/DisplayHardware/ComposerHal.h @@ -105,7 +105,7 @@ public: }; virtual bool isSupported(OptionalFeature) const = 0; - virtual bool getDisplayConfigurationsSupported() const = 0; + virtual bool isVrrSupported() const = 0; virtual std::vector<aidl::android::hardware::graphics::composer3::Capability> getCapabilities() = 0; diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 10df216b02..0f79dfc11c 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -321,7 +321,7 @@ std::vector<HWComposer::HWCDisplayMode> HWComposer::getModes(PhysicalDisplayId d const auto hwcDisplayId = mDisplayData.at(displayId).hwcDisplay->getId(); - if (mComposer->getDisplayConfigurationsSupported()) { + if (mComposer->isVrrSupported()) { return getModesFromDisplayConfigurations(hwcDisplayId, maxFrameIntervalNs); } diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp index ed52b9583c..e855f32606 100644 --- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp +++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp @@ -276,8 +276,8 @@ bool HidlComposer::isSupported(OptionalFeature feature) const { } } -bool HidlComposer::getDisplayConfigurationsSupported() const { - // getDisplayConfigurations is not supported on the HIDL composer. +bool HidlComposer::isVrrSupported() const { + // VRR is not supported on the HIDL composer. return false; }; diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h index 5c19b47b00..0011b2ab7e 100644 --- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h +++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h @@ -167,7 +167,7 @@ public: ~HidlComposer() override; bool isSupported(OptionalFeature) const; - bool getDisplayConfigurationsSupported() const; + bool isVrrSupported() const; std::vector<aidl::android::hardware::graphics::composer3::Capability> getCapabilities() override; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 85c16b716d..ac4b340d07 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2154,19 +2154,16 @@ void SurfaceFlinger::onComposerHalVsyncIdle(hal::HWDisplayId) { void SurfaceFlinger::onRefreshRateChangedDebug(const RefreshRateChangedDebugData& data) { ATRACE_CALL(); if (const auto displayId = getHwComposer().toPhysicalDisplayId(data.display); displayId) { - const Fps fps = Fps::fromPeriodNsecs(data.vsyncPeriodNanos); - ATRACE_FORMAT("%s Fps %d", __func__, fps.getIntValue()); + const char* const whence = __func__; static_cast<void>(mScheduler->schedule([=]() FTL_FAKE_GUARD(mStateLock) { - { - { - const auto display = getDisplayDeviceLocked(*displayId); - FTL_FAKE_GUARD(kMainThreadContext, - display->updateRefreshRateOverlayRate(fps, - display->getActiveMode() - .fps, - /* setByHwc */ true)); - } - } + const Fps fps = Fps::fromPeriodNsecs(getHwComposer().getComposer()->isVrrSupported() + ? data.refreshPeriodNanos + : data.vsyncPeriodNanos); + ATRACE_FORMAT("%s Fps %d", whence, fps.getIntValue()); + const auto display = getDisplayDeviceLocked(*displayId); + FTL_FAKE_GUARD(kMainThreadContext, + display->updateRefreshRateOverlayRate(fps, display->getActiveMode().fps, + /* setByHwc */ true)); })); } } diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp index d3ce4f2b90..c5e179fb4c 100644 --- a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp +++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp @@ -143,7 +143,7 @@ TEST_F(HWComposerTest, getModesWithLegacyDisplayConfigs) { const auto info = mHwc.onHotplug(kHwcDisplayId, hal::Connection::CONNECTED); ASSERT_TRUE(info); - EXPECT_CALL(*mHal, getDisplayConfigurationsSupported()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mHal, isVrrSupported()).WillRepeatedly(Return(false)); { EXPECT_CALL(*mHal, getDisplayConfigs(kHwcDisplayId, _)) @@ -235,7 +235,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_OFF) { const auto info = mHwc.onHotplug(kHwcDisplayId, hal::Connection::CONNECTED); ASSERT_TRUE(info); - EXPECT_CALL(*mHal, getDisplayConfigurationsSupported()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mHal, isVrrSupported()).WillRepeatedly(Return(false)); { EXPECT_CALL(*mHal, getDisplayConfigs(kHwcDisplayId, _)) @@ -324,7 +324,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { const auto info = mHwc.onHotplug(kHwcDisplayId, hal::Connection::CONNECTED); ASSERT_TRUE(info); - EXPECT_CALL(*mHal, getDisplayConfigurationsSupported()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mHal, isVrrSupported()).WillRepeatedly(Return(true)); { EXPECT_CALL(*mHal, getDisplayConfigurations(kHwcDisplayId, _, _)) diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h index 3b74f0ab4a..7291b620fe 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h @@ -51,7 +51,7 @@ public: ~Composer() override; MOCK_METHOD(bool, isSupported, (OptionalFeature), (const, override)); - MOCK_METHOD(bool, getDisplayConfigurationsSupported, (), (const, override)); + MOCK_METHOD(bool, isVrrSupported, (), (const, override)); MOCK_METHOD0(getCapabilities, std::vector<aidl::android::hardware::graphics::composer3::Capability>()); MOCK_METHOD0(dumpDebugInfo, std::string()); |