Loading services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -182,8 +182,8 @@ void LayerLifecycleManager::onHandlesDestroyed( } } void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState>& transactions, bool ignoreUnknownLayers) { void LayerLifecycleManager::applyTransactions( const std::vector<QueuedTransactionState>& transactions, bool ignoreUnknownLayers) { for (const auto& transaction : transactions) { for (const auto& resolvedComposerState : transaction.states) { const auto& clientState = resolvedComposerState.state; Loading services/surfaceflinger/FrontEnd/LayerLifecycleManager.h +3 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ #pragma once #include "QueuedTransactionState.h" #include "RequestedLayerState.h" #include "TransactionState.h" namespace android::surfaceflinger::frontend { Loading @@ -43,7 +43,8 @@ public: // the layers it is unreachable. When using the LayerLifecycleManager for layer trace // generation we may encounter layers which are known because we don't have an explicit // lifecycle. Ignore these errors while we have to interop with legacy. void applyTransactions(const std::vector<TransactionState>&, bool ignoreUnknownLayers = false); void applyTransactions(const std::vector<QueuedTransactionState>&, bool ignoreUnknownLayers = false); // Ignore unknown handles when iteroping with legacy front end. In the old world, we // would create child layers which are not necessary with the new front end. This means // we will get notified for handle changes that don't exist in the new front end. Loading services/surfaceflinger/FrontEnd/RequestedLayerState.h +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include "Scheduler/LayerInfo.h" #include "LayerCreationArgs.h" #include "TransactionState.h" #include "QueuedTransactionState.h" namespace android::surfaceflinger::frontend { using namespace ftl::flag_operators; Loading services/surfaceflinger/FrontEnd/TransactionHandler.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ namespace android::surfaceflinger::frontend { void TransactionHandler::queueTransaction(TransactionState&& state) { void TransactionHandler::queueTransaction(QueuedTransactionState&& state) { mLocklessTransactionQueue.push(std::move(state)); mPendingTransactionCount.fetch_add(1); SFTRACE_INT("TransactionQueue", static_cast<int>(mPendingTransactionCount.load())); Loading @@ -45,9 +45,9 @@ void TransactionHandler::collectTransactions() { } } std::vector<TransactionState> TransactionHandler::flushTransactions() { std::vector<QueuedTransactionState> TransactionHandler::flushTransactions() { // Collect transaction that are ready to be applied. std::vector<TransactionState> transactions; std::vector<QueuedTransactionState> transactions; TransactionFlushState flushState; flushState.queueProcessTime = systemTime(); // Transactions with a buffer pending on a barrier may be on a different applyToken Loading Loading @@ -76,7 +76,7 @@ std::vector<TransactionState> TransactionHandler::flushTransactions() { } void TransactionHandler::applyUnsignaledBufferTransaction( std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { std::vector<QueuedTransactionState>& transactions, TransactionFlushState& flushState) { if (!flushState.queueWithUnsignaledBuffer) { return; } Loading @@ -98,9 +98,9 @@ void TransactionHandler::applyUnsignaledBufferTransaction( } } void TransactionHandler::popTransactionFromPending(std::vector<TransactionState>& transactions, TransactionFlushState& flushState, std::queue<TransactionState>& queue) { void TransactionHandler::popTransactionFromPending( std::vector<QueuedTransactionState>& transactions, TransactionFlushState& flushState, std::queue<QueuedTransactionState>& queue) { auto& transaction = queue.front(); // Transaction is ready move it from the pending queue. flushState.firstTransaction = false; Loading Loading @@ -146,8 +146,8 @@ TransactionHandler::TransactionReadiness TransactionHandler::applyFilters( return ready; } int TransactionHandler::flushPendingTransactionQueues(std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { int TransactionHandler::flushPendingTransactionQueues( std::vector<QueuedTransactionState>& transactions, TransactionFlushState& flushState) { int transactionsPendingBarrier = 0; auto it = mPendingTransactionQueues.begin(); while (it != mPendingTransactionQueues.end()) { Loading services/surfaceflinger/FrontEnd/TransactionHandler.h +11 −10 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ #include <vector> #include <LocklessQueue.h> #include <TransactionState.h> #include <QueuedTransactionState.h> #include <android-base/thread_annotations.h> #include <ftl/small_map.h> #include <ftl/small_vector.h> Loading @@ -35,7 +35,7 @@ namespace surfaceflinger::frontend { class TransactionHandler { public: struct TransactionFlushState { TransactionState* transaction; QueuedTransactionState* transaction; bool firstTransaction = true; nsecs_t queueProcessTime = 0; // Layer handles that have transactions with buffers that are ready to be applied. Loading @@ -61,9 +61,9 @@ public: bool hasPendingTransactions(); // Moves transactions from the lockless queue. void collectTransactions(); std::vector<TransactionState> flushTransactions(); std::vector<QueuedTransactionState> flushTransactions(); void addTransactionReadyFilter(TransactionFilter&&); void queueTransaction(TransactionState&&); void queueTransaction(QueuedTransactionState&&); struct StalledTransactionInfo { pid_t pid; Loading @@ -81,14 +81,15 @@ private: // For unit tests friend class ::android::TestableSurfaceFlinger; int flushPendingTransactionQueues(std::vector<TransactionState>&, TransactionFlushState&); void applyUnsignaledBufferTransaction(std::vector<TransactionState>&, TransactionFlushState&); void popTransactionFromPending(std::vector<TransactionState>&, TransactionFlushState&, std::queue<TransactionState>&); int flushPendingTransactionQueues(std::vector<QueuedTransactionState>&, TransactionFlushState&); void applyUnsignaledBufferTransaction(std::vector<QueuedTransactionState>&, TransactionFlushState&); void popTransactionFromPending(std::vector<QueuedTransactionState>&, TransactionFlushState&, std::queue<QueuedTransactionState>&); TransactionReadiness applyFilters(TransactionFlushState&); std::unordered_map<sp<IBinder>, std::queue<TransactionState>, IListenerHash> std::unordered_map<sp<IBinder>, std::queue<QueuedTransactionState>, IListenerHash> mPendingTransactionQueues; LocklessQueue<TransactionState> mLocklessTransactionQueue; LocklessQueue<QueuedTransactionState> mLocklessTransactionQueue; std::atomic<size_t> mPendingTransactionCount = 0; ftl::SmallVector<TransactionFilter, 2> mTransactionReadyFilters; Loading Loading
services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -182,8 +182,8 @@ void LayerLifecycleManager::onHandlesDestroyed( } } void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState>& transactions, bool ignoreUnknownLayers) { void LayerLifecycleManager::applyTransactions( const std::vector<QueuedTransactionState>& transactions, bool ignoreUnknownLayers) { for (const auto& transaction : transactions) { for (const auto& resolvedComposerState : transaction.states) { const auto& clientState = resolvedComposerState.state; Loading
services/surfaceflinger/FrontEnd/LayerLifecycleManager.h +3 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ #pragma once #include "QueuedTransactionState.h" #include "RequestedLayerState.h" #include "TransactionState.h" namespace android::surfaceflinger::frontend { Loading @@ -43,7 +43,8 @@ public: // the layers it is unreachable. When using the LayerLifecycleManager for layer trace // generation we may encounter layers which are known because we don't have an explicit // lifecycle. Ignore these errors while we have to interop with legacy. void applyTransactions(const std::vector<TransactionState>&, bool ignoreUnknownLayers = false); void applyTransactions(const std::vector<QueuedTransactionState>&, bool ignoreUnknownLayers = false); // Ignore unknown handles when iteroping with legacy front end. In the old world, we // would create child layers which are not necessary with the new front end. This means // we will get notified for handle changes that don't exist in the new front end. Loading
services/surfaceflinger/FrontEnd/RequestedLayerState.h +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include "Scheduler/LayerInfo.h" #include "LayerCreationArgs.h" #include "TransactionState.h" #include "QueuedTransactionState.h" namespace android::surfaceflinger::frontend { using namespace ftl::flag_operators; Loading
services/surfaceflinger/FrontEnd/TransactionHandler.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ namespace android::surfaceflinger::frontend { void TransactionHandler::queueTransaction(TransactionState&& state) { void TransactionHandler::queueTransaction(QueuedTransactionState&& state) { mLocklessTransactionQueue.push(std::move(state)); mPendingTransactionCount.fetch_add(1); SFTRACE_INT("TransactionQueue", static_cast<int>(mPendingTransactionCount.load())); Loading @@ -45,9 +45,9 @@ void TransactionHandler::collectTransactions() { } } std::vector<TransactionState> TransactionHandler::flushTransactions() { std::vector<QueuedTransactionState> TransactionHandler::flushTransactions() { // Collect transaction that are ready to be applied. std::vector<TransactionState> transactions; std::vector<QueuedTransactionState> transactions; TransactionFlushState flushState; flushState.queueProcessTime = systemTime(); // Transactions with a buffer pending on a barrier may be on a different applyToken Loading Loading @@ -76,7 +76,7 @@ std::vector<TransactionState> TransactionHandler::flushTransactions() { } void TransactionHandler::applyUnsignaledBufferTransaction( std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { std::vector<QueuedTransactionState>& transactions, TransactionFlushState& flushState) { if (!flushState.queueWithUnsignaledBuffer) { return; } Loading @@ -98,9 +98,9 @@ void TransactionHandler::applyUnsignaledBufferTransaction( } } void TransactionHandler::popTransactionFromPending(std::vector<TransactionState>& transactions, TransactionFlushState& flushState, std::queue<TransactionState>& queue) { void TransactionHandler::popTransactionFromPending( std::vector<QueuedTransactionState>& transactions, TransactionFlushState& flushState, std::queue<QueuedTransactionState>& queue) { auto& transaction = queue.front(); // Transaction is ready move it from the pending queue. flushState.firstTransaction = false; Loading Loading @@ -146,8 +146,8 @@ TransactionHandler::TransactionReadiness TransactionHandler::applyFilters( return ready; } int TransactionHandler::flushPendingTransactionQueues(std::vector<TransactionState>& transactions, TransactionFlushState& flushState) { int TransactionHandler::flushPendingTransactionQueues( std::vector<QueuedTransactionState>& transactions, TransactionFlushState& flushState) { int transactionsPendingBarrier = 0; auto it = mPendingTransactionQueues.begin(); while (it != mPendingTransactionQueues.end()) { Loading
services/surfaceflinger/FrontEnd/TransactionHandler.h +11 −10 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ #include <vector> #include <LocklessQueue.h> #include <TransactionState.h> #include <QueuedTransactionState.h> #include <android-base/thread_annotations.h> #include <ftl/small_map.h> #include <ftl/small_vector.h> Loading @@ -35,7 +35,7 @@ namespace surfaceflinger::frontend { class TransactionHandler { public: struct TransactionFlushState { TransactionState* transaction; QueuedTransactionState* transaction; bool firstTransaction = true; nsecs_t queueProcessTime = 0; // Layer handles that have transactions with buffers that are ready to be applied. Loading @@ -61,9 +61,9 @@ public: bool hasPendingTransactions(); // Moves transactions from the lockless queue. void collectTransactions(); std::vector<TransactionState> flushTransactions(); std::vector<QueuedTransactionState> flushTransactions(); void addTransactionReadyFilter(TransactionFilter&&); void queueTransaction(TransactionState&&); void queueTransaction(QueuedTransactionState&&); struct StalledTransactionInfo { pid_t pid; Loading @@ -81,14 +81,15 @@ private: // For unit tests friend class ::android::TestableSurfaceFlinger; int flushPendingTransactionQueues(std::vector<TransactionState>&, TransactionFlushState&); void applyUnsignaledBufferTransaction(std::vector<TransactionState>&, TransactionFlushState&); void popTransactionFromPending(std::vector<TransactionState>&, TransactionFlushState&, std::queue<TransactionState>&); int flushPendingTransactionQueues(std::vector<QueuedTransactionState>&, TransactionFlushState&); void applyUnsignaledBufferTransaction(std::vector<QueuedTransactionState>&, TransactionFlushState&); void popTransactionFromPending(std::vector<QueuedTransactionState>&, TransactionFlushState&, std::queue<QueuedTransactionState>&); TransactionReadiness applyFilters(TransactionFlushState&); std::unordered_map<sp<IBinder>, std::queue<TransactionState>, IListenerHash> std::unordered_map<sp<IBinder>, std::queue<QueuedTransactionState>, IListenerHash> mPendingTransactionQueues; LocklessQueue<TransactionState> mLocklessTransactionQueue; LocklessQueue<QueuedTransactionState> mLocklessTransactionQueue; std::atomic<size_t> mPendingTransactionCount = 0; ftl::SmallVector<TransactionFilter, 2> mTransactionReadyFilters; Loading