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

Commit 67577168 authored by Ana Krulec's avatar Ana Krulec Committed by Android (Google) Code Review
Browse files

Merge "SF: Add a flag to guard the video detection feature"

parents 1bc1aca6 ba13ab31
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -397,9 +397,11 @@ void BufferQueueLayer::fakeVsync() {
void BufferQueueLayer::onFrameAvailable(const BufferItem& item) {
    // Add this buffer from our internal queue tracker
    { // Autolock scope
        // Report the requested present time to the Scheduler.
        mFlinger->mScheduler->addFramePresentTimeForLayer(item.mTimestamp, item.mIsAutoTimestamp,
                                                          mName.c_str());
        if (mFlinger->mUse90Hz && mFlinger->mUseSmart90ForVideo) {
            // Report the requested present time to the Scheduler, if the feature is turned on.
            mFlinger->mScheduler->addFramePresentTimeForLayer(item.mTimestamp,
                                                              item.mIsAutoTimestamp, mName.c_str());
        }

        Mutex::Autolock lock(mQueueItemLock);
        // Reset the frame number tracker when we receive the first buffer after
+11 −3
Original line number Diff line number Diff line
@@ -396,6 +396,9 @@ SurfaceFlinger::SurfaceFlinger(surfaceflinger::Factory& factory)
    property_get("debug.sf.use_90Hz", value, "0");
    mUse90Hz = atoi(value);

    property_get("debug.sf.use_smart_90_for_video", value, "0");
    mUseSmart90ForVideo = atoi(value);

    const auto [early, gl, late] = mPhaseOffsets->getCurrentOffsets();
    mVsyncModulator.setPhaseOffsets(early, gl, late);

@@ -1595,8 +1598,11 @@ void SurfaceFlinger::onMessageReceived(int32_t what) {
                break;
            }

            // This call is made each time SF wakes up and creates a new frame.
            if (mUse90Hz && mUseSmart90ForVideo) {
                // This call is made each time SF wakes up and creates a new frame. It is part
                // of video detection feature.
                mScheduler->incrementFrameCounter();
            }

            bool frameMissed = !mHadClientComposition && mPreviousPresentFence != Fence::NO_FENCE &&
                    (mPreviousPresentFence->getStatus() == Fence::Status::Unsignaled);
@@ -4465,7 +4471,9 @@ void SurfaceFlinger::dumpVSync(std::string& result) const {
                  "    present offset: %9" PRId64 " ns\t     VSYNC period: %9" PRId64 " ns\n\n",
                  dispSyncPresentTimeOffset, getVsyncPeriod());

    StringAppendF(&result, "Scheduler enabled. 90Hz feature: %s\n\n", mUse90Hz ? "on" : "off");
    StringAppendF(&result, "Scheduler enabled. 90Hz feature: %s\n", mUse90Hz ? "on" : "off");
    StringAppendF(&result, "+  Smart 90 for video detection: %s\n\n",
                  mUseSmart90ForVideo ? "on" : "off");
    mScheduler->dump(mAppConnectionHandle, result);
}

+1 −0
Original line number Diff line number Diff line
@@ -1075,6 +1075,7 @@ private:
     * Scheduler
     */
    bool mUse90Hz = false;
    bool mUseSmart90ForVideo = false;
    std::unique_ptr<Scheduler> mScheduler;
    sp<Scheduler::ConnectionHandle> mAppConnectionHandle;
    sp<Scheduler::ConnectionHandle> mSfConnectionHandle;