diff options
author | Marissa Wall <marissaw@google.com> | 2019-03-26 15:38:50 -0700 |
---|---|---|
committer | Marissa Wall <marissaw@google.com> | 2019-03-29 09:42:52 -0700 |
commit | d600d57da59244af8f94145558debe7f1acad998 (patch) | |
tree | bd5b0683125e7cfa4d276235269f4bab9b357fb1 /libs/gui/include | |
parent | eccfc576b3f90c2ee818de7c10eea6fdbbe2d166 (diff) | |
download | android_frameworks_native-d600d57da59244af8f94145558debe7f1acad998.tar.gz android_frameworks_native-d600d57da59244af8f94145558debe7f1acad998.tar.bz2 android_frameworks_native-d600d57da59244af8f94145558debe7f1acad998.zip |
blast: in order no-op transaction callbacks
Transactions callbacks were being sent as soon as they were ready
instead of in order. To fix this, keep a deque of Transaction
callbacks and do not send a callback until all the callbacks
before it have been sent.
Bug: 128519264
Test: Transaction_test
Change-Id: Ia363b3aca85bc1cd71d0fd915de79b44f786e09f
Diffstat (limited to 'libs/gui/include')
-rw-r--r-- | libs/gui/include/gui/ITransactionCompletedListener.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/libs/gui/include/gui/ITransactionCompletedListener.h b/libs/gui/include/gui/ITransactionCompletedListener.h index 29ab02692..774ad46b1 100644 --- a/libs/gui/include/gui/ITransactionCompletedListener.h +++ b/libs/gui/include/gui/ITransactionCompletedListener.h @@ -34,18 +34,6 @@ class ITransactionCompletedListener; using CallbackId = int64_t; -struct CallbackIdsHash { - // CallbackId vectors have several properties that let us get away with this simple hash. - // 1) CallbackIds are never 0 so if something has gone wrong and our CallbackId vector is - // empty we can still hash 0. - // 2) CallbackId vectors for the same listener either are identical or contain none of the - // same members. It is sufficient to just check the first CallbackId in the vectors. If - // they match, they are the same. If they do not match, they are not the same. - std::size_t operator()(const std::vector<CallbackId> callbackIds) const { - return std::hash<CallbackId>{}((callbackIds.size() == 0) ? 0 : callbackIds.front()); - } -}; - class SurfaceStats : public Parcelable { public: status_t writeToParcel(Parcel* output) const override; @@ -65,6 +53,15 @@ public: status_t writeToParcel(Parcel* output) const override; status_t readFromParcel(const Parcel* input) override; + TransactionStats() = default; + TransactionStats(const std::vector<CallbackId>& ids) : callbackIds(ids) {} + TransactionStats(const std::unordered_set<CallbackId>& ids) + : callbackIds(ids.begin(), ids.end()) {} + TransactionStats(const std::vector<CallbackId>& ids, nsecs_t latch, const sp<Fence>& present, + const std::vector<SurfaceStats>& surfaces) + : callbackIds(ids), latchTime(latch), presentFence(present), surfaceStats(surfaces) {} + + std::vector<CallbackId> callbackIds; nsecs_t latchTime = -1; sp<Fence> presentFence = nullptr; std::vector<SurfaceStats> surfaceStats; @@ -79,7 +76,7 @@ public: const std::unordered_set<CallbackId>& callbackIds); sp<ITransactionCompletedListener> listener; - std::unordered_map<std::vector<CallbackId>, TransactionStats, CallbackIdsHash> transactionStats; + std::vector<TransactionStats> transactionStats; }; class ITransactionCompletedListener : public IInterface { |