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

Commit d0694bce authored by Rachel Lee's avatar Rachel Lee
Browse files

Fix FrameRateCategory::NoPreference in SF

Decided the behavior should not be the same as LayerVoteType::NoVote.

Bug: 300152572
Test: atest libsurfaceflinger_unittest
Change-Id: I2e0a0d4959f1fdba3f5f7d04ca15ea9045d4cd36
parent c0e40bc1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -41,7 +41,7 @@ namespace {


bool isLayerActive(const LayerInfo& info, nsecs_t threshold) {
bool isLayerActive(const LayerInfo& info, nsecs_t threshold) {
    // Layers with an explicit frame rate or frame rate category are always kept active,
    // 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()) {
    if (info.getSetFrameRateVote().isValid() && !info.getSetFrameRateVote().isNoVote()) {
        return true;
        return true;
    }
    }
+1 −2
Original line number Original line Diff line number Diff line
@@ -491,8 +491,7 @@ FrameRateCategory LayerInfo::FrameRate::convertCategory(int8_t category) {
}
}


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


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


        // Returns true if the layer explicitly should contribute to frame rate scoring.
        // 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>;
    using RefreshRateVotes = ftl::SmallVector<LayerInfo::LayerVote, 2>;
+2 −1
Original line number Original line 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.name.c_str(), ftl::enum_string(layer.vote).c_str(), layer.weight,
              layer.desiredRefreshRate.getValue(),
              layer.desiredRefreshRate.getValue(),
              ftl::enum_string(layer.frameRateCategory).c_str());
              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;
            continue;
        }
        }


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


        bool operator!=(const LayerRequirement& other) const { return !(*this == other); }
        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.
    // Returns true if the layer explicitly instructs to not contribute to refresh rate selection.
    // In other words, true if the layer should be ignored.
    // In other words, true if the layer should be ignored.
    static bool isNoVote(LayerVoteType vote, FrameRateCategory category) {
    static bool isNoVote(LayerVoteType vote) { return vote == LayerVoteType::NoVote; }
        return vote == LayerVoteType::NoVote || category == FrameRateCategory::NoPreference;
    }


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