Loading cmds/dumpstate/binder/android/os/IDumpstate.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ interface IDumpstate { // Default mode. const int BUGREPORT_MODE_DEFAULT = 6; // TODO(b/111441001): Should the args be for the consuming application rather than triggering? /* * Starts a bugreport in the background. * Loading services/surfaceflinger/Layer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -1788,9 +1788,13 @@ half4 Layer::getColor() const { } Layer::RoundedCornerState Layer::getRoundedCornerState() const { return getRoundedCornerStateInternal(mSourceBounds); } Layer::RoundedCornerState Layer::getRoundedCornerStateInternal(const FloatRect bounds) const { const auto& p = mDrawingParent.promote(); if (p != nullptr) { RoundedCornerState parentState = p->getRoundedCornerState(); RoundedCornerState parentState = p->getRoundedCornerStateInternal(bounds); if (parentState.radius > 0) { ui::Transform t = getActiveTransform(getDrawingState()); t = t.inverse(); Loading @@ -1804,7 +1808,9 @@ Layer::RoundedCornerState Layer::getRoundedCornerState() const { } } const float radius = getDrawingState().cornerRadius; return radius > 0 ? RoundedCornerState(getBounds(), radius) : RoundedCornerState(); return radius > 0 ? RoundedCornerState(bounds.intersect(getCrop(getDrawingState()).toFloatRect()), radius) : RoundedCornerState(); } void Layer::commitChildList() { Loading services/surfaceflinger/Layer.h +2 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,8 @@ private: */ Rect getCroppedBufferSize(const Layer::State& s) const; RoundedCornerState getRoundedCornerStateInternal(const FloatRect bounds) const; // Cached properties computed from drawing state // Effective transform taking into account parent transforms and any parent scaling. ui::Transform mEffectiveTransform; Loading services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp +55 −51 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ using namespace std::chrono_literals; using testing::_; using testing::AtLeast; namespace android { namespace scheduler { Loading Loading @@ -75,7 +76,7 @@ TEST_F(RefreshRateStatsTest, canCreateAndDestroyTest) { init(configs); // There is one default config, so the refresh rates should have one item. ASSERT_EQ(1, mRefreshRateStats->getTotalTimes().size()); EXPECT_EQ(1, mRefreshRateStats->getTotalTimes().size()); } TEST_F(RefreshRateStatsTest, oneConfigTest) { Loading @@ -88,13 +89,14 @@ TEST_F(RefreshRateStatsTest, oneConfigTest) { init(configs); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(4); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(2); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(AtLeast(1)); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(AtLeast(1)); std::unordered_map<std::string, int64_t> times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(2, times.size()); ASSERT_EQ(0, times["ScreenOff"]); ASSERT_EQ(0, times["90fps"]); EXPECT_EQ(2, times.size()); EXPECT_NE(0u, times.count("ScreenOff")); EXPECT_EQ(1u, times.count("90fps")); EXPECT_EQ(0, times["90fps"]); // Setting up tests on mobile harness can be flaky with time passing, so testing for // exact time changes can result in flaxy numbers. To avoid that remember old // numbers to make sure the correct values are increasing in the next test. Loading @@ -104,31 +106,31 @@ TEST_F(RefreshRateStatsTest, oneConfigTest) { // Screen is off by default. std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(0, times["90fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(0, times["90fps"]); mRefreshRateStats->setPowerMode(HWC_POWER_MODE_NORMAL); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_LT(ninety, times["90fps"]); ninety = times["90fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_LT(ninety, times["90fps"]); mRefreshRateStats->setPowerMode(HWC_POWER_MODE_DOZE); ninety = mRefreshRateStats->getTotalTimes()["90fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_90); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); // Because the power mode is not HWC_POWER_MODE_NORMAL, switching the config // does not update refresh rates that come from the config. ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); } TEST_F(RefreshRateStatsTest, twoConfigsTest) { Loading @@ -145,15 +147,17 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) { init(configs); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(6); EXPECT_CALL(*mTimeStats, recordRefreshRate(60, _)).Times(4); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(4); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(AtLeast(1)); EXPECT_CALL(*mTimeStats, recordRefreshRate(60, _)).Times(AtLeast(1)); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(AtLeast(1)); std::unordered_map<std::string, int64_t> times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(3, times.size()); ASSERT_EQ(0, times["ScreenOff"]); ASSERT_EQ(0, times["60fps"]); ASSERT_EQ(0, times["90fps"]); EXPECT_EQ(3, times.size()); EXPECT_NE(0u, times.count("ScreenOff")); EXPECT_EQ(1u, times.count("60fps")); EXPECT_EQ(0, times["60fps"]); EXPECT_EQ(1u, times.count("90fps")); EXPECT_EQ(0, times["90fps"]); // Setting up tests on mobile harness can be flaky with time passing, so testing for // exact time changes can result in flaxy numbers. To avoid that remember old // numbers to make sure the correct values are increasing in the next test. Loading @@ -164,61 +168,61 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) { // Screen is off by default. std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(sixty, times["60fps"]); ASSERT_EQ(ninety, times["90fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(sixty, times["60fps"]); EXPECT_EQ(ninety, times["90fps"]); mRefreshRateStats->setPowerMode(HWC_POWER_MODE_NORMAL); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_EQ(sixty, times["60fps"]); ASSERT_LT(ninety, times["90fps"]); ninety = times["90fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_EQ(sixty, times["60fps"]); EXPECT_LT(ninety, times["90fps"]); // When power mode is normal, time for configs updates. mRefreshRateStats->setConfigMode(CONFIG_ID_60); ninety = mRefreshRateStats->getTotalTimes()["90fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_LT(sixty, times["60fps"]); sixty = times["60fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_LT(sixty, times["60fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_90); sixty = mRefreshRateStats->getTotalTimes()["60fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_LT(ninety, times["90fps"]); ASSERT_EQ(sixty, times["60fps"]); ninety = times["90fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_LT(ninety, times["90fps"]); EXPECT_EQ(sixty, times["60fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_60); ninety = mRefreshRateStats->getTotalTimes()["90fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_LT(sixty, times["60fps"]); sixty = times["60fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_LT(sixty, times["60fps"]); // Because the power mode is not HWC_POWER_MODE_NORMAL, switching the config // does not update refresh rates that come from the config. mRefreshRateStats->setPowerMode(HWC_POWER_MODE_DOZE); mRefreshRateStats->setConfigMode(CONFIG_ID_90); sixty = mRefreshRateStats->getTotalTimes()["60fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_EQ(sixty, times["60fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_EQ(sixty, times["60fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_60); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_EQ(sixty, times["60fps"]); EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_EQ(sixty, times["60fps"]); } } // namespace } // namespace scheduler Loading Loading
cmds/dumpstate/binder/android/os/IDumpstate.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ interface IDumpstate { // Default mode. const int BUGREPORT_MODE_DEFAULT = 6; // TODO(b/111441001): Should the args be for the consuming application rather than triggering? /* * Starts a bugreport in the background. * Loading
services/surfaceflinger/Layer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -1788,9 +1788,13 @@ half4 Layer::getColor() const { } Layer::RoundedCornerState Layer::getRoundedCornerState() const { return getRoundedCornerStateInternal(mSourceBounds); } Layer::RoundedCornerState Layer::getRoundedCornerStateInternal(const FloatRect bounds) const { const auto& p = mDrawingParent.promote(); if (p != nullptr) { RoundedCornerState parentState = p->getRoundedCornerState(); RoundedCornerState parentState = p->getRoundedCornerStateInternal(bounds); if (parentState.radius > 0) { ui::Transform t = getActiveTransform(getDrawingState()); t = t.inverse(); Loading @@ -1804,7 +1808,9 @@ Layer::RoundedCornerState Layer::getRoundedCornerState() const { } } const float radius = getDrawingState().cornerRadius; return radius > 0 ? RoundedCornerState(getBounds(), radius) : RoundedCornerState(); return radius > 0 ? RoundedCornerState(bounds.intersect(getCrop(getDrawingState()).toFloatRect()), radius) : RoundedCornerState(); } void Layer::commitChildList() { Loading
services/surfaceflinger/Layer.h +2 −0 Original line number Diff line number Diff line Loading @@ -907,6 +907,8 @@ private: */ Rect getCroppedBufferSize(const Layer::State& s) const; RoundedCornerState getRoundedCornerStateInternal(const FloatRect bounds) const; // Cached properties computed from drawing state // Effective transform taking into account parent transforms and any parent scaling. ui::Transform mEffectiveTransform; Loading
services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp +55 −51 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ using namespace std::chrono_literals; using testing::_; using testing::AtLeast; namespace android { namespace scheduler { Loading Loading @@ -75,7 +76,7 @@ TEST_F(RefreshRateStatsTest, canCreateAndDestroyTest) { init(configs); // There is one default config, so the refresh rates should have one item. ASSERT_EQ(1, mRefreshRateStats->getTotalTimes().size()); EXPECT_EQ(1, mRefreshRateStats->getTotalTimes().size()); } TEST_F(RefreshRateStatsTest, oneConfigTest) { Loading @@ -88,13 +89,14 @@ TEST_F(RefreshRateStatsTest, oneConfigTest) { init(configs); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(4); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(2); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(AtLeast(1)); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(AtLeast(1)); std::unordered_map<std::string, int64_t> times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(2, times.size()); ASSERT_EQ(0, times["ScreenOff"]); ASSERT_EQ(0, times["90fps"]); EXPECT_EQ(2, times.size()); EXPECT_NE(0u, times.count("ScreenOff")); EXPECT_EQ(1u, times.count("90fps")); EXPECT_EQ(0, times["90fps"]); // Setting up tests on mobile harness can be flaky with time passing, so testing for // exact time changes can result in flaxy numbers. To avoid that remember old // numbers to make sure the correct values are increasing in the next test. Loading @@ -104,31 +106,31 @@ TEST_F(RefreshRateStatsTest, oneConfigTest) { // Screen is off by default. std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(0, times["90fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(0, times["90fps"]); mRefreshRateStats->setPowerMode(HWC_POWER_MODE_NORMAL); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_LT(ninety, times["90fps"]); ninety = times["90fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_LT(ninety, times["90fps"]); mRefreshRateStats->setPowerMode(HWC_POWER_MODE_DOZE); ninety = mRefreshRateStats->getTotalTimes()["90fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_90); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); // Because the power mode is not HWC_POWER_MODE_NORMAL, switching the config // does not update refresh rates that come from the config. ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); } TEST_F(RefreshRateStatsTest, twoConfigsTest) { Loading @@ -145,15 +147,17 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) { init(configs); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(6); EXPECT_CALL(*mTimeStats, recordRefreshRate(60, _)).Times(4); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(4); EXPECT_CALL(*mTimeStats, recordRefreshRate(0, _)).Times(AtLeast(1)); EXPECT_CALL(*mTimeStats, recordRefreshRate(60, _)).Times(AtLeast(1)); EXPECT_CALL(*mTimeStats, recordRefreshRate(90, _)).Times(AtLeast(1)); std::unordered_map<std::string, int64_t> times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(3, times.size()); ASSERT_EQ(0, times["ScreenOff"]); ASSERT_EQ(0, times["60fps"]); ASSERT_EQ(0, times["90fps"]); EXPECT_EQ(3, times.size()); EXPECT_NE(0u, times.count("ScreenOff")); EXPECT_EQ(1u, times.count("60fps")); EXPECT_EQ(0, times["60fps"]); EXPECT_EQ(1u, times.count("90fps")); EXPECT_EQ(0, times["90fps"]); // Setting up tests on mobile harness can be flaky with time passing, so testing for // exact time changes can result in flaxy numbers. To avoid that remember old // numbers to make sure the correct values are increasing in the next test. Loading @@ -164,61 +168,61 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) { // Screen is off by default. std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(sixty, times["60fps"]); ASSERT_EQ(ninety, times["90fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(sixty, times["60fps"]); EXPECT_EQ(ninety, times["90fps"]); mRefreshRateStats->setPowerMode(HWC_POWER_MODE_NORMAL); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_EQ(sixty, times["60fps"]); ASSERT_LT(ninety, times["90fps"]); ninety = times["90fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_EQ(sixty, times["60fps"]); EXPECT_LT(ninety, times["90fps"]); // When power mode is normal, time for configs updates. mRefreshRateStats->setConfigMode(CONFIG_ID_60); ninety = mRefreshRateStats->getTotalTimes()["90fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_LT(sixty, times["60fps"]); sixty = times["60fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_LT(sixty, times["60fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_90); sixty = mRefreshRateStats->getTotalTimes()["60fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_LT(ninety, times["90fps"]); ASSERT_EQ(sixty, times["60fps"]); ninety = times["90fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_LT(ninety, times["90fps"]); EXPECT_EQ(sixty, times["60fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_60); ninety = mRefreshRateStats->getTotalTimes()["90fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_EQ(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_LT(sixty, times["60fps"]); sixty = times["60fps"]; EXPECT_EQ(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_LT(sixty, times["60fps"]); // Because the power mode is not HWC_POWER_MODE_NORMAL, switching the config // does not update refresh rates that come from the config. mRefreshRateStats->setPowerMode(HWC_POWER_MODE_DOZE); mRefreshRateStats->setConfigMode(CONFIG_ID_90); sixty = mRefreshRateStats->getTotalTimes()["60fps"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_EQ(sixty, times["60fps"]); screenOff = times["ScreenOff"]; EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_EQ(sixty, times["60fps"]); mRefreshRateStats->setConfigMode(CONFIG_ID_60); screenOff = mRefreshRateStats->getTotalTimes()["ScreenOff"]; std::this_thread::sleep_for(std::chrono::milliseconds(2)); times = mRefreshRateStats->getTotalTimes(); ASSERT_LT(screenOff, times["ScreenOff"]); ASSERT_EQ(ninety, times["90fps"]); ASSERT_EQ(sixty, times["60fps"]); EXPECT_LT(screenOff, times["ScreenOff"]); EXPECT_EQ(ninety, times["90fps"]); EXPECT_EQ(sixty, times["60fps"]); } } // namespace } // namespace scheduler Loading