Loading cmds/surfacereplayer/proto/src/trace.proto +4 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ message Transaction { required bool synchronous = 3; required bool animation = 4; optional Origin origin = 5; optional uint64 id = 6; } message SurfaceChange { Loading libs/gui/ISurfaceComposer.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ public: const Vector<ComposerState>& state, const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, const InputWindowCommands& commands, int64_t desiredPresentTime, const client_cache_t& uncacheBuffer, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks) { bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading Loading @@ -100,6 +101,8 @@ public: SAFE_PARCEL(data.writeInt64Vector, callbackIds); } SAFE_PARCEL(data.writeUint64, transactionId); return remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); } Loading Loading @@ -1278,9 +1281,13 @@ status_t BnSurfaceComposer::onTransact( SAFE_PARCEL(data.readInt64Vector, &callbackIds); listenerCallbacks.emplace_back(tmpBinder, callbackIds); } uint64_t transactionId = -1; SAFE_PARCEL(data.readUint64, &transactionId); return setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands, desiredPresentTime, uncachedBuffer, hasListenerCallbacks, listenerCallbacks); listenerCallbacks, transactionId); } case BOOT_FINISHED: { CHECK_INTERFACE(ISurfaceComposer, data, reply); Loading libs/gui/SurfaceComposerClient.cpp +20 −3 Original line number Diff line number Diff line Loading @@ -348,8 +348,17 @@ void removeDeadBufferCallback(void* /*context*/, uint64_t graphicBufferId) { // --------------------------------------------------------------------------- // Initialize transaction id counter used to generate transaction ids // Transactions will start counting at 1, 0 is used for invalid transactions std::atomic<uint32_t> SurfaceComposerClient::Transaction::idCounter = 1; SurfaceComposerClient::Transaction::Transaction() { mId = generateId(); } SurfaceComposerClient::Transaction::Transaction(const Transaction& other) : mForceSynchronous(other.mForceSynchronous), : mId(other.mId), mForceSynchronous(other.mForceSynchronous), mTransactionNestCount(other.mTransactionNestCount), mAnimation(other.mAnimation), mEarlyWakeup(other.mEarlyWakeup), Loading @@ -372,6 +381,10 @@ SurfaceComposerClient::Transaction::createFromParcel(const Parcel* parcel) { return nullptr; } int64_t SurfaceComposerClient::Transaction::generateId() { return (((int64_t)getpid()) << 32) | idCounter++; } status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel) { const uint32_t forceSynchronous = parcel->readUint32(); const uint32_t transactionNestCount = parcel->readUint32(); Loading Loading @@ -582,7 +595,8 @@ void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) { uncacheBuffer.id = cacheId; sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance()); sf->setTransactionState({}, {}, 0, applyToken, {}, -1, uncacheBuffer, false, {}); sf->setTransactionState({}, {}, 0, applyToken, {}, -1, uncacheBuffer, false, {}, 0 /* Undefined transactionId */); } void SurfaceComposerClient::Transaction::cacheBuffers() { Loading Loading @@ -709,11 +723,14 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) { mExplicitEarlyWakeupStart = false; mExplicitEarlyWakeupEnd = false; uint64_t transactionId = mId; mId = generateId(); sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance()); sf->setTransactionState(composerStates, displayStates, flags, applyToken, mInputWindowCommands, mDesiredPresentTime, {} /*uncacheBuffer - only set in doUncacheBufferTransaction*/, hasListenerCallbacks, listenerCallbacks); hasListenerCallbacks, listenerCallbacks, transactionId); mInputWindowCommands.clear(); mStatus = NO_ERROR; return NO_ERROR; Loading libs/gui/include/gui/ISurfaceComposer.h +1 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ public: uint32_t flags, const sp<IBinder>& applyToken, const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime, const client_cache_t& uncacheBuffer, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks) = 0; const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) = 0; /* signal that we're done booting. * Requires ACCESS_SURFACE_FLINGER permission Loading libs/gui/include/gui/SurfaceComposerClient.h +7 −1 Original line number Diff line number Diff line Loading @@ -339,12 +339,18 @@ public: }; class Transaction : public Parcelable { private: static std::atomic<uint32_t> idCounter; int64_t generateId(); protected: std::unordered_map<sp<IBinder>, ComposerState, IBinderHash> mComposerStates; SortedVector<DisplayState > mDisplayStates; std::unordered_map<sp<ITransactionCompletedListener>, CallbackInfo, TCLHash> mListenerCallbacks; uint64_t mId; uint32_t mForceSynchronous = 0; uint32_t mTransactionNestCount = 0; bool mAnimation = false; Loading Loading @@ -380,7 +386,7 @@ public: void registerSurfaceControlForCallback(const sp<SurfaceControl>& sc); public: Transaction() = default; Transaction(); virtual ~Transaction() = default; Transaction(Transaction const& other); Loading Loading
cmds/surfacereplayer/proto/src/trace.proto +4 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ message Transaction { required bool synchronous = 3; required bool animation = 4; optional Origin origin = 5; optional uint64 id = 6; } message SurfaceChange { Loading
libs/gui/ISurfaceComposer.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ public: const Vector<ComposerState>& state, const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, const InputWindowCommands& commands, int64_t desiredPresentTime, const client_cache_t& uncacheBuffer, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks) { bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading Loading @@ -100,6 +101,8 @@ public: SAFE_PARCEL(data.writeInt64Vector, callbackIds); } SAFE_PARCEL(data.writeUint64, transactionId); return remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); } Loading Loading @@ -1278,9 +1281,13 @@ status_t BnSurfaceComposer::onTransact( SAFE_PARCEL(data.readInt64Vector, &callbackIds); listenerCallbacks.emplace_back(tmpBinder, callbackIds); } uint64_t transactionId = -1; SAFE_PARCEL(data.readUint64, &transactionId); return setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands, desiredPresentTime, uncachedBuffer, hasListenerCallbacks, listenerCallbacks); listenerCallbacks, transactionId); } case BOOT_FINISHED: { CHECK_INTERFACE(ISurfaceComposer, data, reply); Loading
libs/gui/SurfaceComposerClient.cpp +20 −3 Original line number Diff line number Diff line Loading @@ -348,8 +348,17 @@ void removeDeadBufferCallback(void* /*context*/, uint64_t graphicBufferId) { // --------------------------------------------------------------------------- // Initialize transaction id counter used to generate transaction ids // Transactions will start counting at 1, 0 is used for invalid transactions std::atomic<uint32_t> SurfaceComposerClient::Transaction::idCounter = 1; SurfaceComposerClient::Transaction::Transaction() { mId = generateId(); } SurfaceComposerClient::Transaction::Transaction(const Transaction& other) : mForceSynchronous(other.mForceSynchronous), : mId(other.mId), mForceSynchronous(other.mForceSynchronous), mTransactionNestCount(other.mTransactionNestCount), mAnimation(other.mAnimation), mEarlyWakeup(other.mEarlyWakeup), Loading @@ -372,6 +381,10 @@ SurfaceComposerClient::Transaction::createFromParcel(const Parcel* parcel) { return nullptr; } int64_t SurfaceComposerClient::Transaction::generateId() { return (((int64_t)getpid()) << 32) | idCounter++; } status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel) { const uint32_t forceSynchronous = parcel->readUint32(); const uint32_t transactionNestCount = parcel->readUint32(); Loading Loading @@ -582,7 +595,8 @@ void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) { uncacheBuffer.id = cacheId; sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance()); sf->setTransactionState({}, {}, 0, applyToken, {}, -1, uncacheBuffer, false, {}); sf->setTransactionState({}, {}, 0, applyToken, {}, -1, uncacheBuffer, false, {}, 0 /* Undefined transactionId */); } void SurfaceComposerClient::Transaction::cacheBuffers() { Loading Loading @@ -709,11 +723,14 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) { mExplicitEarlyWakeupStart = false; mExplicitEarlyWakeupEnd = false; uint64_t transactionId = mId; mId = generateId(); sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance()); sf->setTransactionState(composerStates, displayStates, flags, applyToken, mInputWindowCommands, mDesiredPresentTime, {} /*uncacheBuffer - only set in doUncacheBufferTransaction*/, hasListenerCallbacks, listenerCallbacks); hasListenerCallbacks, listenerCallbacks, transactionId); mInputWindowCommands.clear(); mStatus = NO_ERROR; return NO_ERROR; Loading
libs/gui/include/gui/ISurfaceComposer.h +1 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ public: uint32_t flags, const sp<IBinder>& applyToken, const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime, const client_cache_t& uncacheBuffer, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks) = 0; const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId) = 0; /* signal that we're done booting. * Requires ACCESS_SURFACE_FLINGER permission Loading
libs/gui/include/gui/SurfaceComposerClient.h +7 −1 Original line number Diff line number Diff line Loading @@ -339,12 +339,18 @@ public: }; class Transaction : public Parcelable { private: static std::atomic<uint32_t> idCounter; int64_t generateId(); protected: std::unordered_map<sp<IBinder>, ComposerState, IBinderHash> mComposerStates; SortedVector<DisplayState > mDisplayStates; std::unordered_map<sp<ITransactionCompletedListener>, CallbackInfo, TCLHash> mListenerCallbacks; uint64_t mId; uint32_t mForceSynchronous = 0; uint32_t mTransactionNestCount = 0; bool mAnimation = false; Loading Loading @@ -380,7 +386,7 @@ public: void registerSurfaceControlForCallback(const sp<SurfaceControl>& sc); public: Transaction() = default; Transaction(); virtual ~Transaction() = default; Transaction(Transaction const& other); Loading