Skip to content

Commit fd72574

Browse files
committed
Revert "Consolidate flags in Transaction"
This reverts commit b580827. Reason for revert: b/388605826 Change-Id: Ibaa269c8ddcdc50418cca1439c7a45e0fdf41620 Fixes: 388605826
1 parent b580827 commit fd72574

2 files changed

Lines changed: 34 additions & 14 deletions

File tree

libs/gui/SurfaceComposerClient.cpp

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,9 @@ SurfaceComposerClient::Transaction::Transaction() {
829829

830830
SurfaceComposerClient::Transaction::Transaction(const Transaction& other)
831831
: mId(other.mId),
832-
mFlags(other.mFlags),
832+
mAnimation(other.mAnimation),
833+
mEarlyWakeupStart(other.mEarlyWakeupStart),
834+
mEarlyWakeupEnd(other.mEarlyWakeupEnd),
833835
mMayContainBuffer(other.mMayContainBuffer),
834836
mDesiredPresentTime(other.mDesiredPresentTime),
835837
mIsAutoTimestamp(other.mIsAutoTimestamp),
@@ -866,7 +868,9 @@ SurfaceComposerClient::Transaction::createFromParcel(const Parcel* parcel) {
866868

867869
status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel) {
868870
const uint64_t transactionId = parcel->readUint64();
869-
const uint32_t flags = parcel->readUint32();
871+
const bool animation = parcel->readBool();
872+
const bool earlyWakeupStart = parcel->readBool();
873+
const bool earlyWakeupEnd = parcel->readBool();
870874
const int64_t desiredPresentTime = parcel->readInt64();
871875
const bool isAutoTimestamp = parcel->readBool();
872876
const bool logCallPoints = parcel->readBool();
@@ -961,7 +965,9 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel
961965

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

992998
parcel->writeUint64(mId);
993-
parcel->writeUint32(mFlags);
999+
parcel->writeBool(mAnimation);
1000+
parcel->writeBool(mEarlyWakeupStart);
1001+
parcel->writeBool(mEarlyWakeupEnd);
9941002
parcel->writeInt64(mDesiredPresentTime);
9951003
parcel->writeBool(mIsAutoTimestamp);
9961004
parcel->writeBool(mLogCallPoints);
@@ -1123,7 +1131,8 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr
11231131
mInputWindowCommands.merge(other.mInputWindowCommands);
11241132

11251133
mMayContainBuffer |= other.mMayContainBuffer;
1126-
mFlags |= other.mFlags;
1134+
mEarlyWakeupStart = mEarlyWakeupStart || other.mEarlyWakeupStart;
1135+
mEarlyWakeupEnd = mEarlyWakeupEnd || other.mEarlyWakeupEnd;
11271136
mApplyToken = other.mApplyToken;
11281137

11291138
mergeFrameTimelineInfo(mFrameTimelineInfo, other.mFrameTimelineInfo);
@@ -1145,13 +1154,15 @@ void SurfaceComposerClient::Transaction::clear() {
11451154
mInputWindowCommands.clear();
11461155
mUncacheBuffers.clear();
11471156
mMayContainBuffer = false;
1157+
mAnimation = false;
1158+
mEarlyWakeupStart = false;
1159+
mEarlyWakeupEnd = false;
11481160
mDesiredPresentTime = 0;
11491161
mIsAutoTimestamp = true;
11501162
mFrameTimelineInfo = {};
11511163
mApplyToken = nullptr;
11521164
mMergedTransactionIds.clear();
11531165
mLogCallPoints = false;
1154-
mFlags = 0;
11551166
}
11561167

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

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

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

1334-
// If both ISurfaceComposer::eEarlyWakeupStart and ISurfaceComposer::eEarlyWakeupEnd are set
1348+
// If both mEarlyWakeupStart and mEarlyWakeupEnd are set
13351349
// it is equivalent for none
1336-
uint32_t wakeupFlags = ISurfaceComposer::eEarlyWakeupStart | ISurfaceComposer::eEarlyWakeupEnd;
1337-
if ((flags & wakeupFlags) == wakeupFlags) {
1338-
flags &= ~(wakeupFlags);
1350+
if (mEarlyWakeupStart && !mEarlyWakeupEnd) {
1351+
flags |= ISurfaceComposer::eEarlyWakeupStart;
1352+
}
1353+
if (mEarlyWakeupEnd && !mEarlyWakeupStart) {
1354+
flags |= ISurfaceComposer::eEarlyWakeupEnd;
13391355
}
1356+
13401357
sp<IBinder> applyToken = mApplyToken ? mApplyToken : getDefaultApplyToken();
13411358

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

14461463
void SurfaceComposerClient::Transaction::setAnimationTransaction() {
1447-
mFlags |= ISurfaceComposer::eAnimation;
1464+
mAnimation = true;
14481465
}
14491466

14501467
void SurfaceComposerClient::Transaction::setEarlyWakeupStart() {
1451-
mFlags |= ISurfaceComposer::eEarlyWakeupStart;
1468+
mEarlyWakeupStart = true;
14521469
}
14531470

14541471
void SurfaceComposerClient::Transaction::setEarlyWakeupEnd() {
1455-
mFlags |= ISurfaceComposer::eEarlyWakeupEnd;
1472+
mEarlyWakeupEnd = true;
14561473
}
14571474

14581475
layer_state_t* SurfaceComposerClient::Transaction::getLayerState(const sp<SurfaceControl>& sc) {

libs/gui/include/gui/SurfaceComposerClient.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,10 @@ class SurfaceComposerClient : public RefBase
467467
std::vector<uint64_t> mMergedTransactionIds;
468468

469469
uint64_t mId;
470-
uint32_t mFlags;
470+
471+
bool mAnimation = false;
472+
bool mEarlyWakeupStart = false;
473+
bool mEarlyWakeupEnd = false;
471474

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

0 commit comments

Comments
 (0)