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

Commit 7382ddc8 authored by Rachel Lee's avatar Rachel Lee
Browse files

NoPreference does not supercede Game default override

FrameRateCategory::NoPreference is similar to "no vote". If there is a
game default frame rate override, it should not supercede this.
For example, a game with 60 default frame rate override should get this
override even when Toolkit sends NoPreference on it.

Bug: 377169395
Flag: EXEMPT bugfix
Test: atest libsurfaceflinger_unittest
Test: manual test with game, it uses game default frame rate
Change-Id: Id773c03fdd32c3a55b19a6acac788aabf133ebfc
parent 7e796bc1
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -308,6 +308,12 @@ void LayerHistory::partitionLayers(nsecs_t now, bool isVrrDevice) {
                const auto setFrameRateVoteType =
                        info->isVisible() ? voteType : LayerVoteType::NoVote;

                const bool hasSetFrameRateOpinion = frameRate.isValid() && !frameRate.isNoVote();
                const bool hasCategoryOpinion =
                        frameRate.category != FrameRateCategory::NoPreference &&
                        frameRate.category != FrameRateCategory::Default;
                const bool hasFrameRateOpinion = hasSetFrameRateOpinion || hasCategoryOpinion;

                if (gameModeFrameRateOverride.isValid()) {
                    info->setLayerVote({gameFrameRateOverrideVoteType, gameModeFrameRateOverride});
                    SFTRACE_FORMAT_INSTANT("GameModeFrameRateOverride");
@@ -315,7 +321,7 @@ void LayerHistory::partitionLayers(nsecs_t now, bool isVrrDevice) {
                        trace(*info, gameFrameRateOverrideVoteType,
                              gameModeFrameRateOverride.getIntValue());
                    }
                } else if (frameRate.isValid() && frameRate.isVoteValidForMrr(isVrrDevice)) {
                } else if (hasFrameRateOpinion && frameRate.isVoteValidForMrr(isVrrDevice)) {
                    info->setLayerVote({setFrameRateVoteType,
                                        isValuelessVote ? 0_Hz : frameRate.vote.rate,
                                        frameRate.vote.seamlessness, frameRate.category});
@@ -332,7 +338,7 @@ void LayerHistory::partitionLayers(nsecs_t now, bool isVrrDevice) {
                              gameDefaultFrameRateOverride.getIntValue());
                    }
                } else {
                    if (frameRate.isValid() && !frameRate.isVoteValidForMrr(isVrrDevice)) {
                    if (hasFrameRateOpinion && !frameRate.isVoteValidForMrr(isVrrDevice)) {
                        SFTRACE_FORMAT_INSTANT("Reset layer to ignore explicit vote on MRR %s: %s "
                                               "%s %s",
                                               info->getName().c_str(),