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

Commit b5808272 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Consolidate flags in Transaction

Flag: EXEMPT refactor
Bug: 385156191
Test: presubmit
Change-Id: I0ef895c43a94bbf0f4ea52a7831760a4ba2dc21f
parent 3f0c7234
Loading
Loading
Loading
Loading
+13 −30
Original line number Original line Diff line number Diff line
@@ -829,9 +829,7 @@ SurfaceComposerClient::Transaction::Transaction() {


SurfaceComposerClient::Transaction::Transaction(const Transaction& other)
SurfaceComposerClient::Transaction::Transaction(const Transaction& other)
      : mId(other.mId),
      : mId(other.mId),
        mAnimation(other.mAnimation),
        mFlags(other.mFlags),
        mEarlyWakeupStart(other.mEarlyWakeupStart),
        mEarlyWakeupEnd(other.mEarlyWakeupEnd),
        mMayContainBuffer(other.mMayContainBuffer),
        mMayContainBuffer(other.mMayContainBuffer),
        mDesiredPresentTime(other.mDesiredPresentTime),
        mDesiredPresentTime(other.mDesiredPresentTime),
        mIsAutoTimestamp(other.mIsAutoTimestamp),
        mIsAutoTimestamp(other.mIsAutoTimestamp),
@@ -868,9 +866,7 @@ SurfaceComposerClient::Transaction::createFromParcel(const Parcel* parcel) {


status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel) {
status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel) {
    const uint64_t transactionId = parcel->readUint64();
    const uint64_t transactionId = parcel->readUint64();
    const bool animation = parcel->readBool();
    const uint32_t flags = parcel->readUint32();
    const bool earlyWakeupStart = parcel->readBool();
    const bool earlyWakeupEnd = parcel->readBool();
    const int64_t desiredPresentTime = parcel->readInt64();
    const int64_t desiredPresentTime = parcel->readInt64();
    const bool isAutoTimestamp = parcel->readBool();
    const bool isAutoTimestamp = parcel->readBool();
    const bool logCallPoints = parcel->readBool();
    const bool logCallPoints = parcel->readBool();
@@ -965,9 +961,7 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel


    // Parsing was successful. Update the object.
    // Parsing was successful. Update the object.
    mId = transactionId;
    mId = transactionId;
    mAnimation = animation;
    mFlags = flags;
    mEarlyWakeupStart = earlyWakeupStart;
    mEarlyWakeupEnd = earlyWakeupEnd;
    mDesiredPresentTime = desiredPresentTime;
    mDesiredPresentTime = desiredPresentTime;
    mIsAutoTimestamp = isAutoTimestamp;
    mIsAutoTimestamp = isAutoTimestamp;
    mFrameTimelineInfo = frameTimelineInfo;
    mFrameTimelineInfo = frameTimelineInfo;
@@ -996,9 +990,7 @@ status_t SurfaceComposerClient::Transaction::writeToParcel(Parcel* parcel) const
    const_cast<SurfaceComposerClient::Transaction*>(this)->cacheBuffers();
    const_cast<SurfaceComposerClient::Transaction*>(this)->cacheBuffers();


    parcel->writeUint64(mId);
    parcel->writeUint64(mId);
    parcel->writeBool(mAnimation);
    parcel->writeUint32(mFlags);
    parcel->writeBool(mEarlyWakeupStart);
    parcel->writeBool(mEarlyWakeupEnd);
    parcel->writeInt64(mDesiredPresentTime);
    parcel->writeInt64(mDesiredPresentTime);
    parcel->writeBool(mIsAutoTimestamp);
    parcel->writeBool(mIsAutoTimestamp);
    parcel->writeBool(mLogCallPoints);
    parcel->writeBool(mLogCallPoints);
@@ -1131,8 +1123,7 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr
    mInputWindowCommands.merge(other.mInputWindowCommands);
    mInputWindowCommands.merge(other.mInputWindowCommands);


    mMayContainBuffer |= other.mMayContainBuffer;
    mMayContainBuffer |= other.mMayContainBuffer;
    mEarlyWakeupStart = mEarlyWakeupStart || other.mEarlyWakeupStart;
    mFlags |= other.mFlags;
    mEarlyWakeupEnd = mEarlyWakeupEnd || other.mEarlyWakeupEnd;
    mApplyToken = other.mApplyToken;
    mApplyToken = other.mApplyToken;


    mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo);
    mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo);
@@ -1154,15 +1145,13 @@ void SurfaceComposerClient::Transaction::clear() {
    mInputWindowCommands.clear();
    mInputWindowCommands.clear();
    mUncacheBuffers.clear();
    mUncacheBuffers.clear();
    mMayContainBuffer = false;
    mMayContainBuffer = false;
    mAnimation = false;
    mEarlyWakeupStart = false;
    mEarlyWakeupEnd = false;
    mDesiredPresentTime = 0;
    mDesiredPresentTime = 0;
    mIsAutoTimestamp = true;
    mIsAutoTimestamp = true;
    mFrameTimelineInfo = {};
    mFrameTimelineInfo = {};
    mApplyToken = nullptr;
    mApplyToken = nullptr;
    mMergedTransactionIds.clear();
    mMergedTransactionIds.clear();
    mLogCallPoints = false;
    mLogCallPoints = false;
    mFlags = 0;
}
}


uint64_t SurfaceComposerClient::Transaction::getId() {
uint64_t SurfaceComposerClient::Transaction::getId() {
@@ -1333,9 +1322,6 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay


    displayStates = std::move(mDisplayStates);
    displayStates = std::move(mDisplayStates);


    if (mAnimation) {
        flags |= ISurfaceComposer::eAnimation;
    }
    if (oneWay) {
    if (oneWay) {
        if (synchronous) {
        if (synchronous) {
            ALOGE("Transaction attempted to set synchronous and one way at the same time"
            ALOGE("Transaction attempted to set synchronous and one way at the same time"
@@ -1345,15 +1331,12 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay
        }
        }
    }
    }


    // If both mEarlyWakeupStart and mEarlyWakeupEnd are set
    // If both ISurfaceComposer::eEarlyWakeupStart and ISurfaceComposer::eEarlyWakeupEnd are set
    // it is equivalent for none
    // it is equivalent for none
    if (mEarlyWakeupStart && !mEarlyWakeupEnd) {
    uint32_t wakeupFlags = ISurfaceComposer::eEarlyWakeupStart | ISurfaceComposer::eEarlyWakeupEnd;
        flags |= ISurfaceComposer::eEarlyWakeupStart;
    if ((flags & wakeupFlags) == wakeupFlags) {
    }
        flags &= ~(wakeupFlags);
    if (mEarlyWakeupEnd && !mEarlyWakeupStart) {
        flags |= ISurfaceComposer::eEarlyWakeupEnd;
    }
    }

    sp<IBinder> applyToken = mApplyToken ? mApplyToken : getDefaultApplyToken();
    sp<IBinder> applyToken = mApplyToken ? mApplyToken : getDefaultApplyToken();


    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
@@ -1461,15 +1444,15 @@ std::optional<gui::StalledTransactionInfo> SurfaceComposerClient::getStalledTran
}
}


void SurfaceComposerClient::Transaction::setAnimationTransaction() {
void SurfaceComposerClient::Transaction::setAnimationTransaction() {
    mAnimation = true;
    mFlags |= ISurfaceComposer::eAnimation;
}
}


void SurfaceComposerClient::Transaction::setEarlyWakeupStart() {
void SurfaceComposerClient::Transaction::setEarlyWakeupStart() {
    mEarlyWakeupStart = true;
    mFlags |= ISurfaceComposer::eEarlyWakeupStart;
}
}


void SurfaceComposerClient::Transaction::setEarlyWakeupEnd() {
void SurfaceComposerClient::Transaction::setEarlyWakeupEnd() {
    mEarlyWakeupEnd = true;
    mFlags |= ISurfaceComposer::eEarlyWakeupEnd;
}
}


layer_state_t* SurfaceComposerClient::Transaction::getLayerState(const sp<SurfaceControl>& sc) {
layer_state_t* SurfaceComposerClient::Transaction::getLayerState(const sp<SurfaceControl>& sc) {
+1 −4
Original line number Original line Diff line number Diff line
@@ -467,10 +467,7 @@ public:
        std::vector<uint64_t> mMergedTransactionIds;
        std::vector<uint64_t> mMergedTransactionIds;


        uint64_t mId;
        uint64_t mId;

        uint32_t mFlags;
        bool mAnimation = false;
        bool mEarlyWakeupStart = false;
        bool mEarlyWakeupEnd = false;


        // Indicates that the Transaction may contain buffers that should be cached. The reason this
        // Indicates that the Transaction may contain buffers that should be cached. The reason this
        // is only a guess is that buffers can be removed before cache is called. This is only a
        // is only a guess is that buffers can be removed before cache is called. This is only a