Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65cde03a authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge changes If1383a4d,If5193f75,Ia3e2dfa3

* changes:
  SF: Log hotplug events
  SF: Fix formatting of the layers table in dumpsys
  SF: fix conversion issues
parents 45cd1314 9cf9e51c
Loading
Loading
Loading
Loading
+12 −18
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@
#define DEBUG_RESIZE 0

namespace android {
namespace {
constexpr int kDumpTableRowLength = 159;
} // namespace

using base::StringAppendF;
using namespace android::flag_operators;
@@ -1622,11 +1625,8 @@ LayerDebugInfo Layer::getLayerDebugInfo(const DisplayDevice* display) const {
}

void Layer::miniDumpHeader(std::string& result) {
    result.append("-------------------------------");
    result.append("-------------------------------");
    result.append("-------------------------------");
    result.append("-------------------------------");
    result.append("-------------------\n");
    result.append(kDumpTableRowLength, '-');
    result.append("\n");
    result.append(" Layer name\n");
    result.append("           Z | ");
    result.append(" Window Type | ");
@@ -1634,12 +1634,9 @@ void Layer::miniDumpHeader(std::string& result) {
    result.append(" Transform | ");
    result.append("  Disp Frame (LTRB) | ");
    result.append("         Source Crop (LTRB) | ");
    result.append("    Frame Rate (Explicit) [Focused]\n");
    result.append("-------------------------------");
    result.append("-------------------------------");
    result.append("-------------------------------");
    result.append("-------------------------------");
    result.append("-------------------\n");
    result.append("    Frame Rate (Explicit) (Seamlessness) [Focused]\n");
    result.append(kDumpTableRowLength, '-');
    result.append("\n");
}

std::string Layer::frameRateCompatibilityString(Layer::FrameRateCompatibility compatibility) {
@@ -1690,21 +1687,18 @@ void Layer::miniDump(std::string& result, const DisplayDevice& display) const {
                  crop.bottom);
    if (layerState.frameRate.rate.isValid() ||
        layerState.frameRate.type != FrameRateCompatibility::Default) {
        StringAppendF(&result, "%s %15s seamless=%s", to_string(layerState.frameRate.rate).c_str(),
        StringAppendF(&result, "%s %15s %17s", to_string(layerState.frameRate.rate).c_str(),
                      frameRateCompatibilityString(layerState.frameRate.type).c_str(),
                      toString(layerState.frameRate.seamlessness).c_str());
    } else {
        StringAppendF(&result, "                         ");
        result.append(41, ' ');
    }

    const auto focused = isLayerFocusedBasedOnPriority(getFrameRateSelectionPriority());
    StringAppendF(&result, "    [%s]\n", focused ? "*" : " ");

    result.append("- - - - - - - - - - - - - - - - ");
    result.append("- - - - - - - - - - - - - - - - ");
    result.append("- - - - - - - - - - - - - - - - ");
    result.append("- - - - - - - - - - - - - - - - ");
    result.append("- - - - - - - -\n");
    result.append(kDumpTableRowLength, '-');
    result.append("\n");
}

void Layer::dumpFrameStats(std::string& result) const {
+3 −1
Original line number Diff line number Diff line
@@ -1618,7 +1618,7 @@ void SurfaceFlinger::changeRefreshRateLocked(const RefreshRate& refreshRate,

void SurfaceFlinger::onHotplugReceived(int32_t sequenceId, hal::HWDisplayId hwcDisplayId,
                                       hal::Connection connection) {
    ALOGV("%s(%d, %" PRIu64 ", %s)", __FUNCTION__, sequenceId, hwcDisplayId,
    ALOGI("%s(%d, %" PRIu64 ", %s)", __FUNCTION__, sequenceId, hwcDisplayId,
          connection == hal::Connection::CONNECTED ? "connected" : "disconnected");

    // Ignore events that do not have the right sequenceId.
@@ -2385,6 +2385,8 @@ void SurfaceFlinger::processDisplayHotplugEventsLocked() {
}

void SurfaceFlinger::dispatchDisplayHotplugEvent(PhysicalDisplayId displayId, bool connected) {
    ALOGI("Dispatching display hotplug event displayId=%s, connected=%d",
          to_string(displayId).c_str(), connected);
    mScheduler->onHotplugReceived(mAppConnectionHandle, displayId, connected);
    mScheduler->onHotplugReceived(mSfConnectionHandle, displayId, connected);
}
+6 −13
Original line number Diff line number Diff line
@@ -14,10 +14,6 @@
 * limitations under the License.
 */

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#undef LOG_TAG
#define LOG_TAG "SchedulerUnittests"

@@ -83,7 +79,7 @@ RefreshRateStatsTest::~RefreshRateStatsTest() {

std::shared_ptr<const HWC2::Display::Config> RefreshRateStatsTest::createConfig(
        HwcConfigIndexType configId, int32_t configGroup, int64_t vsyncPeriod) {
    return HWC2::Display::Config::Builder(mDisplay, configId.value())
    return HWC2::Display::Config::Builder(mDisplay, static_cast<hal::HWConfigId>(configId.value()))
            .setVsyncPeriod(static_cast<int32_t>(vsyncPeriod))
            .setConfigGroup(configGroup)
            .build();
@@ -105,7 +101,7 @@ TEST_F(RefreshRateStatsTest, oneConfigTest) {
    // 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.
    int screenOff = times["ScreenOff"];
    auto screenOff = times["ScreenOff"];

    // Screen is off by default.
    std::this_thread::sleep_for(std::chrono::milliseconds(2));
@@ -124,7 +120,7 @@ TEST_F(RefreshRateStatsTest, oneConfigTest) {
    EXPECT_LT(0, times["90.00fps"]);

    mRefreshRateStats->setPowerMode(PowerMode::DOZE);
    int ninety = mRefreshRateStats->getTotalTimes()["90.00fps"];
    auto ninety = mRefreshRateStats->getTotalTimes()["90.00fps"];
    std::this_thread::sleep_for(std::chrono::milliseconds(2));
    times = mRefreshRateStats->getTotalTimes();
    EXPECT_LT(screenOff, times["ScreenOff"]);
@@ -154,7 +150,7 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) {
    // 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.
    int screenOff = times["ScreenOff"];
    auto screenOff = times["ScreenOff"];

    // Screen is off by default.
    std::this_thread::sleep_for(std::chrono::milliseconds(2));
@@ -174,7 +170,7 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) {

    // When power mode is normal, time for configs updates.
    mRefreshRateStats->setRefreshRate(config1Fps);
    int ninety = mRefreshRateStats->getTotalTimes()["90.00fps"];
    auto ninety = mRefreshRateStats->getTotalTimes()["90.00fps"];
    std::this_thread::sleep_for(std::chrono::milliseconds(2));
    times = mRefreshRateStats->getTotalTimes();
    EXPECT_EQ(screenOff, times["ScreenOff"]);
@@ -183,7 +179,7 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) {
    EXPECT_LT(0, times["60.00fps"]);

    mRefreshRateStats->setRefreshRate(config0Fps);
    int sixty = mRefreshRateStats->getTotalTimes()["60.00fps"];
    auto sixty = mRefreshRateStats->getTotalTimes()["60.00fps"];
    std::this_thread::sleep_for(std::chrono::milliseconds(2));
    times = mRefreshRateStats->getTotalTimes();
    EXPECT_EQ(screenOff, times["ScreenOff"]);
@@ -220,6 +216,3 @@ TEST_F(RefreshRateStatsTest, twoConfigsTest) {
} // namespace
} // namespace scheduler
} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"