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

Commit 5e4d5b1f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: use vsyncPeriod from HWC"

parents f3a06711 5dee2f13
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -109,7 +109,6 @@ public:
            android::Hwc2::Display display, int64_t timestamp,
            android::Hwc2::Display display, int64_t timestamp,
            android::Hwc2::VsyncPeriodNanos vsyncPeriodNanos) override {
            android::Hwc2::VsyncPeriodNanos vsyncPeriodNanos) override {
        if (mVsyncSwitchingSupported) {
        if (mVsyncSwitchingSupported) {
            // TODO(b/140201379): use vsyncPeriodNanos in the new DispSync
            mCallback->onVsyncReceived(mSequenceId, display, timestamp,
            mCallback->onVsyncReceived(mSequenceId, display, timestamp,
                                       std::make_optional(vsyncPeriodNanos));
                                       std::make_optional(vsyncPeriodNanos));
        } else {
        } else {
+2 −1
Original line number Original line Diff line number Diff line
@@ -542,7 +542,8 @@ void DispSync::beginResync() {
    resetLocked();
    resetLocked();
}
}


bool DispSync::addResyncSample(nsecs_t timestamp, bool* periodFlushed) {
bool DispSync::addResyncSample(nsecs_t timestamp, std::optional<nsecs_t> /*hwcVsyncPeriod*/,
                               bool* periodFlushed) {
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);


    ALOGV("[%s] addResyncSample(%" PRId64 ")", mName, ns2us(timestamp));
    ALOGV("[%s] addResyncSample(%" PRId64 ")", mName, ns2us(timestamp));
+4 −2
Original line number Original line Diff line number Diff line
@@ -49,7 +49,8 @@ public:
    virtual void reset() = 0;
    virtual void reset() = 0;
    virtual bool addPresentFence(const std::shared_ptr<FenceTime>&) = 0;
    virtual bool addPresentFence(const std::shared_ptr<FenceTime>&) = 0;
    virtual void beginResync() = 0;
    virtual void beginResync() = 0;
    virtual bool addResyncSample(nsecs_t timestamp, bool* periodFlushed) = 0;
    virtual bool addResyncSample(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod,
                                 bool* periodFlushed) = 0;
    virtual void endResync() = 0;
    virtual void endResync() = 0;
    virtual void setPeriod(nsecs_t period) = 0;
    virtual void setPeriod(nsecs_t period) = 0;
    virtual nsecs_t getPeriod() = 0;
    virtual nsecs_t getPeriod() = 0;
@@ -125,7 +126,8 @@ public:
    // down the DispSync model, and false otherwise.
    // down the DispSync model, and false otherwise.
    // periodFlushed will be set to true if mPendingPeriod is flushed to
    // periodFlushed will be set to true if mPendingPeriod is flushed to
    // mIntendedPeriod, and false otherwise.
    // mIntendedPeriod, and false otherwise.
    bool addResyncSample(nsecs_t timestamp, bool* periodFlushed) override;
    bool addResyncSample(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod,
                         bool* periodFlushed) override;
    void endResync() override;
    void endResync() override;


    // The setPeriod method sets the vsync event model's period to a specific
    // The setPeriod method sets the vsync event model's period to a specific
+4 −2
Original line number Original line Diff line number Diff line
@@ -338,13 +338,15 @@ void Scheduler::setVsyncPeriod(nsecs_t period) {
    }
    }
}
}


void Scheduler::addResyncSample(nsecs_t timestamp, bool* periodFlushed) {
void Scheduler::addResyncSample(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod,
                                bool* periodFlushed) {
    bool needsHwVsync = false;
    bool needsHwVsync = false;
    *periodFlushed = false;
    *periodFlushed = false;
    { // Scope for the lock
    { // Scope for the lock
        std::lock_guard<std::mutex> lock(mHWVsyncLock);
        std::lock_guard<std::mutex> lock(mHWVsyncLock);
        if (mPrimaryHWVsyncEnabled) {
        if (mPrimaryHWVsyncEnabled) {
            needsHwVsync = mPrimaryDispSync->addResyncSample(timestamp, periodFlushed);
            needsHwVsync =
                    mPrimaryDispSync->addResyncSample(timestamp, hwcVsyncPeriod, periodFlushed);
        }
        }
    }
    }


+2 −1
Original line number Original line Diff line number Diff line
@@ -109,7 +109,8 @@ public:


    // Passes a vsync sample to DispSync. periodFlushed will be true if
    // Passes a vsync sample to DispSync. periodFlushed will be true if
    // DispSync detected that the vsync period changed, and false otherwise.
    // DispSync detected that the vsync period changed, and false otherwise.
    void addResyncSample(nsecs_t timestamp, bool* periodFlushed);
    void addResyncSample(nsecs_t timestamp, std::optional<nsecs_t> hwcVsyncPeriod,
                         bool* periodFlushed);
    void addPresentFence(const std::shared_ptr<FenceTime>&);
    void addPresentFence(const std::shared_ptr<FenceTime>&);
    void setIgnorePresentFences(bool ignore);
    void setIgnorePresentFences(bool ignore);
    nsecs_t getDispSyncExpectedPresentTime();
    nsecs_t getDispSyncExpectedPresentTime();
Loading