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

Commit 52683c69 authored by Melody Hsu's avatar Melody Hsu Committed by Android (Google) Code Review
Browse files

Merge "Support SurfaceControlRegistry logs in native" into main

parents 24bae188 c034fbf2
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ int64_t generateId() {
}

constexpr int64_t INVALID_VSYNC = -1;
const constexpr char* LOG_SURFACE_CONTROL_REGISTRY = "SurfaceControlRegistry";

} // namespace

@@ -873,6 +874,7 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel
    const bool earlyWakeupEnd = parcel->readBool();
    const int64_t desiredPresentTime = parcel->readInt64();
    const bool isAutoTimestamp = parcel->readBool();
    const bool logCallPoints = parcel->readBool();
    FrameTimelineInfo frameTimelineInfo;
    frameTimelineInfo.readFromParcel(parcel);

@@ -1000,6 +1002,7 @@ status_t SurfaceComposerClient::Transaction::writeToParcel(Parcel* parcel) const
    parcel->writeBool(mEarlyWakeupEnd);
    parcel->writeInt64(mDesiredPresentTime);
    parcel->writeBool(mIsAutoTimestamp);
    parcel->writeBool(mLogCallPoints);
    mFrameTimelineInfo.writeToParcel(parcel);
    parcel->writeStrongBinder(mApplyToken);
    parcel->writeUint32(static_cast<uint32_t>(mDisplayStates.size()));
@@ -1135,6 +1138,12 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr

    mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo);

    mLogCallPoints |= other.mLogCallPoints;
    if (mLogCallPoints) {
        ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY,
             "Transaction %" PRIu64 " merged with transaction %" PRIu64, other.getId(), mId);
    }

    other.clear();
    return *this;
}
@@ -1154,6 +1163,7 @@ void SurfaceComposerClient::Transaction::clear() {
    mFrameTimelineInfo = {};
    mApplyToken = nullptr;
    mMergedTransactionIds.clear();
    mLogCallPoints = false;
}

uint64_t SurfaceComposerClient::Transaction::getId() {
@@ -1362,6 +1372,10 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay
        syncCallback->wait();
    }

    if (mLogCallPoints) {
        ALOG(LOG_DEBUG, LOG_SURFACE_CONTROL_REGISTRY, "Transaction %" PRIu64 " applied", mId);
    }

    mStatus = NO_ERROR;
    return binderStatus;
}
@@ -1392,6 +1406,11 @@ status_t SurfaceComposerClient::Transaction::sendSurfaceFlushJankDataTransaction
    t.registerSurfaceControlForCallback(sc);
    return t.apply(/*sync=*/false, /* oneWay=*/true);
}

void SurfaceComposerClient::Transaction::enableDebugLogCallPoints() {
    mLogCallPoints = true;
}

// ---------------------------------------------------------------------------

sp<IBinder> SurfaceComposerClient::createVirtualDisplay(const std::string& displayName,
+3 −0
Original line number Diff line number Diff line
@@ -437,6 +437,8 @@ public:
        static void mergeFrameTimelineInfo(FrameTimelineInfo& t, const FrameTimelineInfo& other);
        // Tracks registered callbacks
        sp<TransactionCompletedListener> mTransactionCompletedListener = nullptr;
        // Prints debug logs when enabled.
        bool mLogCallPoints = false;

    protected:
        std::unordered_map<sp<IBinder>, ComposerState, IBinderHash> mComposerStates;
@@ -809,6 +811,7 @@ public:
        static void setDefaultApplyToken(sp<IBinder> applyToken);

        static status_t sendSurfaceFlushJankDataTransaction(const sp<SurfaceControl>& sc);
        void enableDebugLogCallPoints();
    };

    status_t clearLayerFrameStats(const sp<IBinder>& token) const;