Loading services/surfaceflinger/DisplayHardware/HWComposer.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ using aidl::android::hardware::graphics::common::HdrConversionCapability; using aidl::android::hardware::graphics::common::HdrConversionStrategy; using aidl::android::hardware::graphics::composer3::Capability; using aidl::android::hardware::graphics::composer3::DisplayCapability; using aidl::android::hardware::graphics::composer3::VrrConfig; using namespace std::string_literals; namespace hal = android::hardware::graphics::composer::hal; namespace android { Loading @@ -89,7 +91,8 @@ HWComposer::HWComposer(std::unique_ptr<Hwc2::Composer> composer) : mComposer(std::move(composer)), mMaxVirtualDisplayDimension(static_cast<size_t>(sysprop::max_virtual_display_dimension(0))), mUpdateDeviceProductInfoOnHotplugReconnect( sysprop::update_device_product_info_on_hotplug_reconnect(false)) {} sysprop::update_device_product_info_on_hotplug_reconnect(false)), mEnableVrrTimeout(base::GetBoolProperty("debug.sf.vrr_timeout_hint_enabled"s, false)) {} HWComposer::HWComposer(const std::string& composerServiceName) : HWComposer(Hwc2::Composer::create(composerServiceName)) {} Loading Loading @@ -299,6 +302,10 @@ std::vector<HWComposer::HWCDisplayMode> HWComposer::getModesFromDisplayConfigura hwcMode.dpiY = config.dpi->y; } if (!mEnableVrrTimeout) { hwcMode.vrrConfig->notifyExpectedPresentConfig = {}; } modes.push_back(hwcMode); } Loading services/surfaceflinger/DisplayHardware/HWComposer.h +2 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,7 @@ public: private: // For unit tests friend TestableSurfaceFlinger; friend HWComposerTest; struct DisplayData { std::unique_ptr<HWC2::Display> hwcDisplay; Loading Loading @@ -542,6 +543,7 @@ private: const size_t mMaxVirtualDisplayDimension; const bool mUpdateDeviceProductInfoOnHotplugReconnect; bool mEnableVrrTimeout; }; } // namespace impl Loading services/surfaceflinger/tests/unittests/HWComposerTest.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" #include <optional> #include <vector> // StrictMock<T> derives from T and is not marked final, so the destructor of T is expected to be Loading Loading @@ -82,6 +83,8 @@ struct HWComposerTest : testing::Test { EXPECT_CALL(*mHal, setVsyncEnabled(hwcDisplayId, Hwc2::IComposerClient::Vsync::DISABLE)); EXPECT_CALL(*mHal, onHotplugConnect(hwcDisplayId)); } void setVrrTimeoutHint(bool status) { mHwc.mEnableVrrTimeout = status; } }; TEST_F(HWComposerTest, isHeadless) { Loading Loading @@ -323,6 +326,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { EXPECT_TRUE(mHwc.getModes(info->id, kMaxFrameIntervalNs).empty()); } { setVrrTimeoutHint(true); constexpr int32_t kWidth = 480; constexpr int32_t kHeight = 720; constexpr int32_t kConfigGroup = 1; Loading Loading @@ -361,7 +365,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { displayConfiguration.dpi = {kDpi, kDpi}; EXPECT_CALL(*mHal, getDisplayConfigurations(kHwcDisplayId, _, _)) .WillOnce(DoAll(SetArgPointee<2>(std::vector<hal::DisplayConfiguration>{ .WillRepeatedly(DoAll(SetArgPointee<2>(std::vector<hal::DisplayConfiguration>{ displayConfiguration}), Return(HalError::NONE))); Loading @@ -375,6 +379,10 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { EXPECT_EQ(modes.front().vrrConfig, vrrConfig); EXPECT_EQ(modes.front().dpiX, kDpi); EXPECT_EQ(modes.front().dpiY, kDpi); setVrrTimeoutHint(false); modes = mHwc.getModes(info->id, kMaxFrameIntervalNs); EXPECT_EQ(modes.front().vrrConfig->notifyExpectedPresentConfig, std::nullopt); } } Loading Loading
services/surfaceflinger/DisplayHardware/HWComposer.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ using aidl::android::hardware::graphics::common::HdrConversionCapability; using aidl::android::hardware::graphics::common::HdrConversionStrategy; using aidl::android::hardware::graphics::composer3::Capability; using aidl::android::hardware::graphics::composer3::DisplayCapability; using aidl::android::hardware::graphics::composer3::VrrConfig; using namespace std::string_literals; namespace hal = android::hardware::graphics::composer::hal; namespace android { Loading @@ -89,7 +91,8 @@ HWComposer::HWComposer(std::unique_ptr<Hwc2::Composer> composer) : mComposer(std::move(composer)), mMaxVirtualDisplayDimension(static_cast<size_t>(sysprop::max_virtual_display_dimension(0))), mUpdateDeviceProductInfoOnHotplugReconnect( sysprop::update_device_product_info_on_hotplug_reconnect(false)) {} sysprop::update_device_product_info_on_hotplug_reconnect(false)), mEnableVrrTimeout(base::GetBoolProperty("debug.sf.vrr_timeout_hint_enabled"s, false)) {} HWComposer::HWComposer(const std::string& composerServiceName) : HWComposer(Hwc2::Composer::create(composerServiceName)) {} Loading Loading @@ -299,6 +302,10 @@ std::vector<HWComposer::HWCDisplayMode> HWComposer::getModesFromDisplayConfigura hwcMode.dpiY = config.dpi->y; } if (!mEnableVrrTimeout) { hwcMode.vrrConfig->notifyExpectedPresentConfig = {}; } modes.push_back(hwcMode); } Loading
services/surfaceflinger/DisplayHardware/HWComposer.h +2 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,7 @@ public: private: // For unit tests friend TestableSurfaceFlinger; friend HWComposerTest; struct DisplayData { std::unique_ptr<HWC2::Display> hwcDisplay; Loading Loading @@ -542,6 +543,7 @@ private: const size_t mMaxVirtualDisplayDimension; const bool mUpdateDeviceProductInfoOnHotplugReconnect; bool mEnableVrrTimeout; }; } // namespace impl Loading
services/surfaceflinger/tests/unittests/HWComposerTest.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" #include <optional> #include <vector> // StrictMock<T> derives from T and is not marked final, so the destructor of T is expected to be Loading Loading @@ -82,6 +83,8 @@ struct HWComposerTest : testing::Test { EXPECT_CALL(*mHal, setVsyncEnabled(hwcDisplayId, Hwc2::IComposerClient::Vsync::DISABLE)); EXPECT_CALL(*mHal, onHotplugConnect(hwcDisplayId)); } void setVrrTimeoutHint(bool status) { mHwc.mEnableVrrTimeout = status; } }; TEST_F(HWComposerTest, isHeadless) { Loading Loading @@ -323,6 +326,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { EXPECT_TRUE(mHwc.getModes(info->id, kMaxFrameIntervalNs).empty()); } { setVrrTimeoutHint(true); constexpr int32_t kWidth = 480; constexpr int32_t kHeight = 720; constexpr int32_t kConfigGroup = 1; Loading Loading @@ -361,7 +365,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { displayConfiguration.dpi = {kDpi, kDpi}; EXPECT_CALL(*mHal, getDisplayConfigurations(kHwcDisplayId, _, _)) .WillOnce(DoAll(SetArgPointee<2>(std::vector<hal::DisplayConfiguration>{ .WillRepeatedly(DoAll(SetArgPointee<2>(std::vector<hal::DisplayConfiguration>{ displayConfiguration}), Return(HalError::NONE))); Loading @@ -375,6 +379,10 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { EXPECT_EQ(modes.front().vrrConfig, vrrConfig); EXPECT_EQ(modes.front().dpiX, kDpi); EXPECT_EQ(modes.front().dpiY, kDpi); setVrrTimeoutHint(false); modes = mHwc.getModes(info->id, kMaxFrameIntervalNs); EXPECT_EQ(modes.front().vrrConfig->notifyExpectedPresentConfig, std::nullopt); } } Loading