blast: send TransactionStats with callback
Add TransactionStats to callback so the client knows when the
buffers were released and acquired. Also when transaction was
presented and latched.
Test: Transaction_test
Bug: 80477568
Change-Id: I578a7000193a4401783cb2538172167a552b043f
diff --git a/services/surfaceflinger/TransactionCompletedThread.h b/services/surfaceflinger/TransactionCompletedThread.h
index 39cf7e8..5af4097 100644
--- a/services/surfaceflinger/TransactionCompletedThread.h
+++ b/services/surfaceflinger/TransactionCompletedThread.h
@@ -26,6 +26,7 @@
#include <binder/IBinder.h>
#include <gui/ITransactionCompletedListener.h>
+#include <ui/Fence.h>
namespace android {
@@ -37,6 +38,9 @@
sp<ITransactionCompletedListener> listener;
std::vector<CallbackId> callbackIds;
sp<IBinder> surfaceControl;
+
+ bool releasePreviousBuffer = false;
+ nsecs_t acquireTime = -1;
};
class TransactionCompletedThread {
@@ -52,18 +56,22 @@
// presented.
void registerPendingLatchedCallbackHandle(const sp<CallbackHandle>& handle);
// Notifies the TransactionCompletedThread that a pending CallbackHandle has been latched.
- void addLatchedCallbackHandles(const std::deque<sp<CallbackHandle>>& handles);
+ void addLatchedCallbackHandles(const std::deque<sp<CallbackHandle>>& handles, nsecs_t latchTime,
+ const sp<Fence>& previousReleaseFence);
// Adds the Transaction CallbackHandle from a layer that does not need to be relatched and
// presented this frame.
void addUnlatchedCallbackHandle(const sp<CallbackHandle>& handle);
+ void addPresentFence(const sp<Fence>& presentFence);
+
void sendCallbacks();
private:
void threadMain();
- void addCallbackHandle(const sp<CallbackHandle>& handle) REQUIRES(mMutex);
+ void addCallbackHandle(const sp<CallbackHandle>& handle, nsecs_t latchTime = -1)
+ REQUIRES(mMutex);
class ThreadDeathRecipient : public IBinder::DeathRecipient {
public:
@@ -97,6 +105,9 @@
bool mRunning GUARDED_BY(mMutex) = false;
bool mKeepRunning GUARDED_BY(mMutex) = true;
+
+ sp<Fence> mPresentFence GUARDED_BY(mMutex);
+ std::vector<sp<Fence>> mPreviousReleaseFences GUARDED_BY(mMutex);
};
} // namespace android