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

Commit 8b2f2976 authored by Rachel Lee's avatar Rachel Lee Committed by Android (Google) Code Review
Browse files

Merge changes I2e0a0d49,Iccbe9cc4 into main

* changes:
  Fix FrameRateCategory::NoPreference in SF
  Add perfetto trace for layer vote
parents 2c299ab2 d0694bce
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ namespace {

bool isLayerActive(const LayerInfo& info, nsecs_t threshold) {
    // Layers with an explicit frame rate or frame rate category are always kept active,
    // but ignore NoVote/NoPreference.
    // but ignore NoVote.
    if (info.getSetFrameRateVote().isValid() && !info.getSetFrameRateVote().isNoVote()) {
        return true;
    }
+6 −2
Original line number Diff line number Diff line
@@ -292,6 +292,8 @@ LayerInfo::RefreshRateVotes LayerInfo::getRefreshRateVote(const RefreshRateSelec

    if (mLayerVote.type != LayerHistory::LayerVoteType::Heuristic) {
        if (mLayerVote.category != FrameRateCategory::Default) {
            ATRACE_FORMAT_INSTANT("ExplicitCategory (%s)",
                                  ftl::enum_string(mLayerVote.category).c_str());
            ALOGV("%s uses frame rate category: %d", mName.c_str(),
                  static_cast<int>(mLayerVote.category));
            votes.push_back({LayerHistory::LayerVoteType::ExplicitCategory, Fps(),
@@ -300,6 +302,7 @@ LayerInfo::RefreshRateVotes LayerInfo::getRefreshRateVote(const RefreshRateSelec

        if (mLayerVote.fps.isValid() ||
            mLayerVote.type != LayerHistory::LayerVoteType::ExplicitDefault) {
            ATRACE_FORMAT_INSTANT("Vote %s", ftl::enum_string(mLayerVote.type).c_str());
            ALOGV("%s voted %d ", mName.c_str(), static_cast<int>(mLayerVote.type));
            votes.push_back(mLayerVote);
        }
@@ -341,11 +344,13 @@ LayerInfo::RefreshRateVotes LayerInfo::getRefreshRateVote(const RefreshRateSelec

    auto refreshRate = calculateRefreshRateIfPossible(selector, now);
    if (refreshRate.has_value()) {
        ATRACE_FORMAT_INSTANT("calculated (%s)", to_string(*refreshRate).c_str());
        ALOGV("%s calculated refresh rate: %s", mName.c_str(), to_string(*refreshRate).c_str());
        votes.push_back({LayerHistory::LayerVoteType::Heuristic, refreshRate.value()});
        return votes;
    }

    ATRACE_FORMAT_INSTANT("Max (can't resolve refresh rate)");
    ALOGV("%s Max (can't resolve refresh rate)", mName.c_str());
    votes.push_back({LayerHistory::LayerVoteType::Max, Fps()});
    return votes;
@@ -486,8 +491,7 @@ FrameRateCategory LayerInfo::FrameRate::convertCategory(int8_t category) {
}

bool LayerInfo::FrameRate::isNoVote() const {
    return vote.type == FrameRateCompatibility::NoVote ||
            category == FrameRateCategory::NoPreference;
    return vote.type == FrameRateCompatibility::NoVote;
}

bool LayerInfo::FrameRate::isValid() const {
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public:
        FrameRateCategory category = FrameRateCategory::Default;

        // Returns true if the layer explicitly should contribute to frame rate scoring.
        bool isNoVote() const { return RefreshRateSelector::isNoVote(type, category); }
        bool isNoVote() const { return RefreshRateSelector::isNoVote(type); }
    };

    using RefreshRateVotes = ftl::SmallVector<LayerInfo::LayerVote, 2>;
+2 −1
Original line number Diff line number Diff line
@@ -599,7 +599,8 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi
              layer.name.c_str(), ftl::enum_string(layer.vote).c_str(), layer.weight,
              layer.desiredRefreshRate.getValue(),
              ftl::enum_string(layer.frameRateCategory).c_str());
        if (layer.isNoVote() || layer.vote == LayerVoteType::Min) {
        if (layer.isNoVote() || layer.frameRateCategory == FrameRateCategory::NoPreference ||
            layer.vote == LayerVoteType::Min) {
            continue;
        }

+2 −4
Original line number Diff line number Diff line
@@ -187,14 +187,12 @@ public:

        bool operator!=(const LayerRequirement& other) const { return !(*this == other); }

        bool isNoVote() const { return RefreshRateSelector::isNoVote(vote, frameRateCategory); }
        bool isNoVote() const { return RefreshRateSelector::isNoVote(vote); }
    };

    // Returns true if the layer explicitly instructs to not contribute to refresh rate selection.
    // In other words, true if the layer should be ignored.
    static bool isNoVote(LayerVoteType vote, FrameRateCategory category) {
        return vote == LayerVoteType::NoVote || category == FrameRateCategory::NoPreference;
    }
    static bool isNoVote(LayerVoteType vote) { return vote == LayerVoteType::NoVote; }

    // Global state describing signals that affect refresh rate choice.
    struct GlobalSignals {
Loading