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

Commit a65fd04d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I14bb4722,I01f139b3 into rvc-dev am: 07b29771 am: c094bbe8

Change-Id: Ifb8f95cef38a904a690e712abed2f81cae9f1447
parents 4f78131d c094bbe8
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1384,6 +1384,9 @@ bool Layer::setFrameRate(FrameRate frameRate) {
        return false;
        return false;
    }
    }


    // Activate the layer in Scheduler's LayerHistory
    mFlinger->mScheduler->recordLayerHistory(this, systemTime());

    mCurrentState.sequence++;
    mCurrentState.sequence++;
    mCurrentState.frameRate = frameRate;
    mCurrentState.frameRate = frameRate;
    mCurrentState.modified = true;
    mCurrentState.modified = true;
+19 −22
Original line number Original line Diff line number Diff line
@@ -40,9 +40,11 @@ namespace android::scheduler::impl {
namespace {
namespace {


bool isLayerActive(const Layer& layer, const LayerInfoV2& info, nsecs_t threshold) {
bool isLayerActive(const Layer& layer, const LayerInfoV2& info, nsecs_t threshold) {
    // Layers with an explicit vote are always kept active
    if (layer.getFrameRateForLayerTree().rate > 0) {
    if (layer.getFrameRateForLayerTree().rate > 0) {
        return layer.isVisible();
        return true;
    }
    }

    return layer.isVisible() && info.getLastUpdatedTime() >= threshold;
    return layer.isVisible() && info.getLastUpdatedTime() >= threshold;
}
}


@@ -127,8 +129,6 @@ LayerHistoryV2::Summary LayerHistoryV2::summarize(nsecs_t now) {
        //  an additional parameter.
        //  an additional parameter.
        ALOGV("Layer has priority: %d", strong->getFrameRateSelectionPriority());
        ALOGV("Layer has priority: %d", strong->getFrameRateSelectionPriority());


        const bool recent = info->isRecentlyActive(now);
        if (recent) {
        const auto [type, refreshRate] = info->getRefreshRate(now);
        const auto [type, refreshRate] = info->getRefreshRate(now);
        // Skip NoVote layer as those don't have any requirements
        // Skip NoVote layer as those don't have any requirements
        if (type == LayerHistory::LayerVoteType::NoVote) {
        if (type == LayerHistory::LayerVoteType::NoVote) {
@@ -148,9 +148,6 @@ LayerHistoryV2::Summary LayerHistoryV2::summarize(nsecs_t now) {
        if (CC_UNLIKELY(mTraceEnabled)) {
        if (CC_UNLIKELY(mTraceEnabled)) {
            trace(layer, type, static_cast<int>(std::round(refreshRate)));
            trace(layer, type, static_cast<int>(std::round(refreshRate)));
        }
        }
        } else if (CC_UNLIKELY(mTraceEnabled)) {
            trace(layer, LayerHistory::LayerVoteType::NoVote, 0);
        }
    }
    }


    return summary;
    return summary;
@@ -177,7 +174,7 @@ void LayerHistoryV2::partitionLayers(nsecs_t now) {
                        return LayerVoteType::NoVote;
                        return LayerVoteType::NoVote;
                }
                }
            }();
            }();
            if (frameRate.rate > 0 || voteType == LayerVoteType::NoVote) {
            if (layer->isVisible() && (frameRate.rate > 0 || voteType == LayerVoteType::NoVote)) {
                info->setLayerVote(voteType, frameRate.rate);
                info->setLayerVote(voteType, frameRate.rate);
            } else {
            } else {
                info->resetLayerVote();
                info->resetLayerVote();
+0 −9
Original line number Original line Diff line number Diff line
@@ -45,15 +45,6 @@ void LayerInfoV2::setLastPresentTime(nsecs_t lastPresentTime, nsecs_t now) {
    }
    }
}
}


// Returns whether the earliest present time is within the active threshold.
bool LayerInfoV2::isRecentlyActive(nsecs_t now) const {
    if (mFrameTimes.empty()) {
        return false;
    }

    return mFrameTimes.back().queueTime >= getActiveLayerThreshold(now);
}

bool LayerInfoV2::isFrameTimeValid(const FrameTimeData& frameTime) const {
bool LayerInfoV2::isFrameTimeValid(const FrameTimeData& frameTime) const {
    return frameTime.queueTime >= std::chrono::duration_cast<std::chrono::nanoseconds>(
    return frameTime.queueTime >= std::chrono::duration_cast<std::chrono::nanoseconds>(
                                          mFrameTimeValidSince.time_since_epoch())
                                          mFrameTimeValidSince.time_since_epoch())
+0 −2
Original line number Original line Diff line number Diff line
@@ -64,8 +64,6 @@ public:
    // updated time, the updated time is the present time.
    // updated time, the updated time is the present time.
    void setLastPresentTime(nsecs_t lastPresentTime, nsecs_t now);
    void setLastPresentTime(nsecs_t lastPresentTime, nsecs_t now);


    bool isRecentlyActive(nsecs_t now) const;

    // Sets an explicit layer vote. This usually comes directly from the application via
    // Sets an explicit layer vote. This usually comes directly from the application via
    // ANativeWindow_setFrameRate API
    // ANativeWindow_setFrameRate API
    void setLayerVote(LayerHistory::LayerVoteType type, float fps) { mLayerVote = {type, fps}; }
    void setLayerVote(LayerHistory::LayerVoteType type, float fps) { mLayerVote = {type, fps}; }
+23 −3
Original line number Original line Diff line number Diff line
@@ -4400,11 +4400,19 @@ void SurfaceFlinger::dumpVSync(std::string& result) const {


    scheduler::RefreshRateConfigs::Policy policy = mRefreshRateConfigs->getDisplayManagerPolicy();
    scheduler::RefreshRateConfigs::Policy policy = mRefreshRateConfigs->getDisplayManagerPolicy();
    StringAppendF(&result,
    StringAppendF(&result,
                  "DesiredDisplayConfigSpecs: default config ID: %d"
                  "DesiredDisplayConfigSpecs (DisplayManager): default config ID: %d"
                  ", min: %.2f Hz, max: %.2f Hz",
                  ", min: %.2f Hz, max: %.2f Hz",
                  policy.defaultConfig.value(), policy.minRefreshRate, policy.maxRefreshRate);
                  policy.defaultConfig.value(), policy.minRefreshRate, policy.maxRefreshRate);
    StringAppendF(&result, "(config override by backdoor: %s)\n\n",
    StringAppendF(&result, "(config override by backdoor: %s)\n\n",
                  mDebugDisplayConfigSetByBackdoor ? "yes" : "no");
                  mDebugDisplayConfigSetByBackdoor ? "yes" : "no");
    scheduler::RefreshRateConfigs::Policy currentPolicy = mRefreshRateConfigs->getCurrentPolicy();
    if (currentPolicy != policy) {
        StringAppendF(&result,
                      "DesiredDisplayConfigSpecs (Override): default config ID: %d"
                      ", min: %.2f Hz, max: %.2f Hz\n\n",
                      currentPolicy.defaultConfig.value(), currentPolicy.minRefreshRate,
                      currentPolicy.maxRefreshRate);
    }


    mScheduler->dump(mAppConnectionHandle, result);
    mScheduler->dump(mAppConnectionHandle, result);
    mScheduler->getPrimaryDispSync().dump(result);
    mScheduler->getPrimaryDispSync().dump(result);
@@ -4929,9 +4937,9 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
        code == IBinder::SYSPROPS_TRANSACTION) {
        code == IBinder::SYSPROPS_TRANSACTION) {
        return OK;
        return OK;
    }
    }
    // Numbers from 1000 to 1034 are currently used for backdoors. The code
    // Numbers from 1000 to 1036 are currently used for backdoors. The code
    // in onTransact verifies that the user is root, and has access to use SF.
    // in onTransact verifies that the user is root, and has access to use SF.
    if (code >= 1000 && code <= 1035) {
    if (code >= 1000 && code <= 1036) {
        ALOGV("Accessing SurfaceFlinger through backdoor code: %u", code);
        ALOGV("Accessing SurfaceFlinger through backdoor code: %u", code);
        return OK;
        return OK;
    }
    }
@@ -5260,6 +5268,18 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                }
                }
                return NO_ERROR;
                return NO_ERROR;
            }
            }
            case 1036: {
                if (data.readInt32() > 0) {
                    status_t result =
                            acquireFrameRateFlexibilityToken(&mDebugFrameRateFlexibilityToken);
                    if (result != NO_ERROR) {
                        return result;
                    }
                } else {
                    mDebugFrameRateFlexibilityToken = nullptr;
                }
                return NO_ERROR;
            }
        }
        }
    }
    }
    return err;
    return err;
Loading