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

Commit bbe26c2a authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge "[SF] vrr_bugfix_24q4 flag cleanup" into main

parents 3937ce21 9427792b
Loading
Loading
Loading
Loading
+9 −16
Original line number Diff line number Diff line
@@ -105,7 +105,6 @@ struct QueuedTransactionState {

        for (const auto& state : states) {
            const bool frameRateChanged = state.state.what & layer_state_t::eFrameRateChanged;
            if (FlagManager::getInstance().vrr_bugfix_24q4()) {
            const bool frameRateIsNoVote = frameRateChanged &&
                    state.state.frameRateCompatibility == ANATIVEWINDOW_FRAME_RATE_NO_VOTE;
            const bool frameRateCategoryChanged =
@@ -116,12 +115,6 @@ struct QueuedTransactionState {
            if (!frameRateIsNoVote && !frameRateCategoryIsNoPreference) {
                return true;
            }
            } else {
                if (!frameRateChanged ||
                    state.state.frameRateCompatibility != ANATIVEWINDOW_FRAME_RATE_NO_VOTE) {
                    return true;
                }
            }
        }

        return false;
+8 −32
Original line number Diff line number Diff line
@@ -374,11 +374,7 @@ bool VSyncPredictor::isVSyncInPhase(nsecs_t timePoint, Fps frameRate) {
    purgeTimelines(now);

    for (auto& timeline : mTimelines) {
        const bool isVsyncValid = FlagManager::getInstance().vrr_bugfix_24q4()
                ? timeline.isWithin(TimePoint::fromNs(vsync)) ==
                        VsyncTimeline::VsyncOnTimeline::Unique
                : timeline.validUntil() && timeline.validUntil()->ns() > vsync;
        if (isVsyncValid) {
        if (timeline.isWithin(TimePoint::fromNs(vsync)) == VsyncTimeline::VsyncOnTimeline::Unique) {
            return timeline.isVSyncInPhase(model, vsync, frameRate);
        }
    }
@@ -413,15 +409,10 @@ void VSyncPredictor::setRenderRate(Fps renderRate, bool applyImmediately) {
        mLastCommittedVsync = TimePoint::fromNs(0);

    } else {
        if (FlagManager::getInstance().vrr_bugfix_24q4()) {
        // We need to freeze the timeline at the committed vsync, and
        // then use with threshold adjustments when required to avoid
        // marginal errors when checking the vsync on the timeline.
        mTimelines.back().freeze(mLastCommittedVsync);
        } else {
            mTimelines.back().freeze(
                    TimePoint::fromNs(mLastCommittedVsync.ns() + mIdealPeriod.ns() / 2));
        }
    }
    mTimelines.emplace_back(mLastCommittedVsync, mIdealPeriod, renderRate);
    purgeTimelines(TimePoint::fromNs(mClock->now()));
@@ -646,11 +637,7 @@ void VSyncPredictor::purgeTimelines(android::TimePoint now) {
    }

    while (mTimelines.size() > 1) {
        const auto validUntilOpt = mTimelines.front().validUntil();
        const bool isTimelineOutDated = FlagManager::getInstance().vrr_bugfix_24q4()
                ? mTimelines.front().isWithin(now) == VsyncTimeline::VsyncOnTimeline::Outside
                : validUntilOpt && *validUntilOpt < now;
        if (isTimelineOutDated) {
        if (mTimelines.front().isWithin(now) == VsyncTimeline::VsyncOnTimeline::Outside) {
            mTimelines.pop_front();
        } else {
            break;
@@ -702,12 +689,6 @@ std::optional<TimePoint> VSyncPredictor::VsyncTimeline::nextAnticipatedVSyncTime
                SFTRACE_FORMAT_INSTANT("lastFrameMissed");
            }
        } else if (mightBackpressure && lastVsyncOpt) {
            if (!FlagManager::getInstance().vrr_bugfix_24q4()) {
                // lastVsyncOpt does not need to be corrected with the new rate, and
                // it should be used as is to avoid skipping a frame when changing rates are
                // aligned at vsync time.
                lastVsyncOpt = snapToVsyncAlignedWithRenderRate(model, *lastVsyncOpt);
            }
            const auto vsyncDiff = vsyncTime - *lastVsyncOpt;
            if (vsyncDiff <= minFramePeriodOpt->ns() - threshold) {
                // avoid a duplicate vsync
@@ -726,10 +707,7 @@ std::optional<TimePoint> VSyncPredictor::VsyncTimeline::nextAnticipatedVSyncTime
    }

    SFTRACE_FORMAT_INSTANT("vsync in %.2fms", float(vsyncTime - TimePoint::now().ns()) / 1e6f);
    const bool isVsyncInvalid = FlagManager::getInstance().vrr_bugfix_24q4()
            ? isWithin(TimePoint::fromNs(vsyncTime)) == VsyncOnTimeline::Outside
            : mValidUntil && vsyncTime > mValidUntil->ns();
    if (isVsyncInvalid) {
    if (isWithin(TimePoint::fromNs(vsyncTime)) == VsyncOnTimeline::Outside) {
        SFTRACE_FORMAT_INSTANT("no longer valid for vsync in %.2f",
                               static_cast<float>(vsyncTime - TimePoint::now().ns()) / 1e6f);
        return std::nullopt;
@@ -785,9 +763,7 @@ bool VSyncPredictor::VsyncTimeline::isVSyncInPhase(Model model, nsecs_t vsync, F
        return ticks<std::milli, float>(TimePoint::fromNs(timePoint) - now);
    };

    Fps displayFps = !FlagManager::getInstance().vrr_bugfix_24q4() && mRenderRateOpt
            ? *mRenderRateOpt
            : Fps::fromPeriodNsecs(mIdealPeriod.ns());
    Fps displayFps = Fps::fromPeriodNsecs(mIdealPeriod.ns());
    const auto divisor = RefreshRateSelector::getFrameRateDivisor(displayFps, frameRate);
    const auto now = TimePoint::now();

+2 −6
Original line number Diff line number Diff line
@@ -2593,12 +2593,8 @@ bool SurfaceFlinger::updateLayerSnapshots(VsyncId vsyncId, nsecs_t frameTimeNs,
        mUpdateAttachedChoreographer = true;
    }
    outTransactionsAreEmpty = mLayerLifecycleManager.getGlobalChanges().get() == 0;
    if (FlagManager::getInstance().vrr_bugfix_24q4()) {
    mustComposite |= mLayerLifecycleManager.getGlobalChanges().any(
            frontend::RequestedLayerState::kMustComposite);
    } else {
        mustComposite |= mLayerLifecycleManager.getGlobalChanges().get() != 0;
    }

    bool newDataLatched = false;
    SFTRACE_NAME("DisplayCallbackAndStatsUpdates");
+0 −2
Original line number Diff line number Diff line
@@ -179,7 +179,6 @@ void FlagManager::dump(std::string& result) const {
    DUMP_ACONFIG_FLAG(trace_frame_rate_override);
    DUMP_ACONFIG_FLAG(true_hdr_screenshots);
    DUMP_ACONFIG_FLAG(use_known_refresh_rate_for_fps_consistency);
    DUMP_ACONFIG_FLAG(vrr_bugfix_24q4);
    DUMP_ACONFIG_FLAG(vrr_bugfix_dropped_frame);
    DUMP_ACONFIG_FLAG(vrr_config);
    DUMP_ACONFIG_FLAG(vulkan_renderengine);
@@ -277,7 +276,6 @@ FLAG_MANAGER_ACONFIG_FLAG(restore_blur_step, "debug.renderengine.restore_blur_st
FLAG_MANAGER_ACONFIG_FLAG(dont_skip_on_early_ro, "")
FLAG_MANAGER_ACONFIG_FLAG(no_vsyncs_on_screen_off, "debug.sf.no_vsyncs_on_screen_off")
FLAG_MANAGER_ACONFIG_FLAG(protected_if_client, "")
FLAG_MANAGER_ACONFIG_FLAG(vrr_bugfix_24q4, "");
FLAG_MANAGER_ACONFIG_FLAG(vrr_bugfix_dropped_frame, "")
FLAG_MANAGER_ACONFIG_FLAG(graphite_renderengine, "debug.renderengine.graphite")
FLAG_MANAGER_ACONFIG_FLAG(filter_frames_before_trace_starts, "")
+0 −1
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ public:
    bool trace_frame_rate_override() const;
    bool true_hdr_screenshots() const;
    bool use_known_refresh_rate_for_fps_consistency() const;
    bool vrr_bugfix_24q4() const;
    bool vrr_bugfix_dropped_frame() const;
    bool vrr_config() const;
    bool vulkan_renderengine() const;
Loading