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

Commit e2a55e70 authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Presubmit Automerger Backend
Browse files

[automerge] SF: Remove ISchedulerCallback::scheduleComposite 2p: dd5827a6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/17243654

Bug: 185535769
Change-Id: Id61df5e8f1b378776d65954307b35ebbfd6590c9
parents 1a79fa43 dd5827a6
Loading
Loading
Loading
Loading
+8 −18
Original line number Diff line number Diff line
@@ -726,10 +726,6 @@ DisplayModePtr Scheduler::getPreferredDisplayMode() {
}

void Scheduler::onNewVsyncPeriodChangeTimeline(const hal::VsyncPeriodChangeTimeline& timeline) {
    if (timeline.refreshRequired) {
        mSchedulerCallback.scheduleComposite(FrameHint::kNone);
    }

    std::lock_guard<std::mutex> lock(mVsyncTimelineLock);
    mLastVsyncPeriodChangeTimeline = std::make_optional(timeline);

@@ -739,8 +735,7 @@ void Scheduler::onNewVsyncPeriodChangeTimeline(const hal::VsyncPeriodChangeTimel
    }
}

void Scheduler::onPostComposition(nsecs_t presentTime) {
    const bool recomposite = [=] {
bool Scheduler::onPostComposition(nsecs_t presentTime) {
    std::lock_guard<std::mutex> lock(mVsyncTimelineLock);
    if (mLastVsyncPeriodChangeTimeline && mLastVsyncPeriodChangeTimeline->refreshRequired) {
        if (presentTime < mLastVsyncPeriodChangeTimeline->refreshTimeNanos) {
@@ -751,11 +746,6 @@ void Scheduler::onPostComposition(nsecs_t presentTime) {
        mLastVsyncPeriodChangeTimeline->refreshRequired = false;
    }
    return false;
    }();

    if (recomposite) {
        mSchedulerCallback.scheduleComposite(FrameHint::kNone);
    }
}

void Scheduler::onActiveDisplayAreaChanged(uint32_t displayArea) {
+2 −8
Original line number Diff line number Diff line
@@ -83,12 +83,8 @@ class TokenManager;
namespace scheduler {

struct ISchedulerCallback {
    // Indicates frame activity, i.e. whether commit and/or composite is taking place.
    enum class FrameHint { kNone, kActive };

    using DisplayModeEvent = scheduler::DisplayModeEvent;

    virtual void scheduleComposite(FrameHint) = 0;
    virtual void setVsyncEnabled(bool) = 0;
    virtual void requestDisplayMode(DisplayModePtr, DisplayModeEvent) = 0;
    virtual void kernelTimerChanged(bool expired) = 0;
@@ -210,8 +206,8 @@ public:
    // Notifies the scheduler about a refresh rate timeline change.
    void onNewVsyncPeriodChangeTimeline(const hal::VsyncPeriodChangeTimeline& timeline);

    // Notifies the scheduler post composition.
    void onPostComposition(nsecs_t presentTime);
    // Notifies the scheduler post composition. Returns if recomposite is needed.
    bool onPostComposition(nsecs_t presentTime);

    // Notifies the scheduler when the display size has changed. Called from SF's main thread
    void onActiveDisplayAreaChanged(uint32_t displayArea);
@@ -245,8 +241,6 @@ public:
private:
    friend class TestableScheduler;

    using FrameHint = ISchedulerCallback::FrameHint;

    enum class ContentDetectionState { Off, On };
    enum class TimerState { Reset, Expired };
    enum class TouchState { Inactive, Active };
+8 −2
Original line number Diff line number Diff line
@@ -1300,7 +1300,7 @@ void SurfaceFlinger::setActiveModeInHwcIfNeeded() {
        mScheduler->onNewVsyncPeriodChangeTimeline(outTimeline);

        if (outTimeline.refreshRequired) {
            // Scheduler will submit an empty frame to HWC.
            scheduleComposite(FrameHint::kNone);
            mSetActiveModePending = true;
        } else {
            // Updating the internal state should be done outside the loop,
@@ -1941,6 +1941,10 @@ void SurfaceFlinger::onComposerHalVsyncPeriodTimingChanged(
        hal::HWDisplayId, const hal::VsyncPeriodChangeTimeline& timeline) {
    Mutex::Autolock lock(mStateLock);
    mScheduler->onNewVsyncPeriodChangeTimeline(timeline);

    if (timeline.refreshRequired) {
        scheduleComposite(FrameHint::kNone);
    }
}

void SurfaceFlinger::onComposerHalSeamlessPossible(hal::HWDisplayId) {
@@ -2248,7 +2252,9 @@ void SurfaceFlinger::composite(nsecs_t frameTime, int64_t vsyncId) {

    mTimeStats->recordFrameDuration(frameTime, systemTime());

    mScheduler->onPostComposition(presentTime);
    if (mScheduler->onPostComposition(presentTime)) {
        scheduleComposite(FrameHint::kNone);
    }

    postFrame();
    postComposition();
+4 −1
Original line number Diff line number Diff line
@@ -286,10 +286,13 @@ public:
    SurfaceFlingerBE& getBE() { return mBE; }
    const SurfaceFlingerBE& getBE() const { return mBE; }

    // Indicates frame activity, i.e. whether commit and/or composite is taking place.
    enum class FrameHint { kNone, kActive };

    // Schedule commit of transactions on the main thread ahead of the next VSYNC.
    void scheduleCommit(FrameHint);
    // As above, but also force composite regardless if transactions were committed.
    void scheduleComposite(FrameHint) override;
    void scheduleComposite(FrameHint);
    // As above, but also force dirty geometry to repaint.
    void scheduleRepaint();
    // Schedule sampling independently from commit or composite.
+2 −4
Original line number Diff line number Diff line
@@ -140,10 +140,8 @@ void SurfaceFlingerFuzzer::invokeFlinger() {

    mFlinger->enableLatchUnsignaledConfig = mFdp.PickValueInArray(kLatchUnsignaledConfig);

    mFlinger->scheduleComposite(mFdp.ConsumeBool()
                                        ? scheduler::ISchedulerCallback::FrameHint::kActive
                                        : scheduler::ISchedulerCallback::FrameHint::kNone);

    using FrameHint = SurfaceFlinger::FrameHint;
    mFlinger->scheduleComposite(mFdp.ConsumeBool() ? FrameHint::kActive : FrameHint::kNone);
    mFlinger->scheduleRepaint();
    mFlinger->scheduleSample();

Loading