Add inputEventId to SurfaceFrame
SurfaceFrame will now be aware of the id of the input event that caused
the current frame.
The flow of input event id is inputflinger -> app -> surfaceflinger.
Here, we are adding the 'inputEventId' parameter to the
'setFrameTimelineVsync' call. This call will now be responsible for
setting two pieces of information: the vsync id, and the input event id.
Since it will no longer be limited to the vsync id, we rename this call
to "setFrameTimelineInfo".
Once the inputEventId is stored in SurfaceFrame, we will add a binder
call to send the frame timing information to inputflinger (separate,
future CL). This will allow input to reconstruct the entire sequence of
events (at what time was input event getting processed in system_server,
app, and surfaceflinger) and will provide the ability to measure
end-to-end touch latency.
In a separate change, we will also add ATRACE calls to allow manual /
script-based latency analysis for local debugging. We will now know
which input event is being processed in surfaceflinger.
Bug: 169866723
Bug: 129481165
Design doc: https://docs.google.com/document/d/1G3bLaZYSmbe6AKcL-6ZChvrw_B_LXEz29Z6Ed9QoYXY/edit#
Test: atest WMShellUnitTests SurfaceParcelable_test libgui_test IPC_test SurfaceFlinger_test
Change-Id: If7e0eee82603b38b396b53ad7ced660973efcb50
Merged-In: If7e0eee82603b38b396b53ad7ced660973efcb50
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 50d6099..323ed40 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -343,7 +343,7 @@
virtual ~SurfaceFlinger();
virtual uint32_t setClientStateLocked(
- int64_t frameTimelineVsyncId, const ComposerState& composerState,
+ const FrameTimelineInfo& info, const ComposerState& composerState,
int64_t desiredPresentTime, bool isAutoTimestamp, int64_t postTime, bool privileged,
std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks,
int originPid, int originUid) REQUIRES(mStateLock);
@@ -435,14 +435,15 @@
};
struct TransactionState {
- TransactionState(int64_t frameTimelineVsyncId, const Vector<ComposerState>& composerStates,
+ TransactionState(const FrameTimelineInfo& frameTimelineInfo,
+ const Vector<ComposerState>& composerStates,
const Vector<DisplayState>& displayStates, uint32_t transactionFlags,
int64_t desiredPresentTime, bool isAutoTimestamp,
const client_cache_t& uncacheBuffer, int64_t postTime, bool privileged,
bool hasListenerCallbacks,
std::vector<ListenerCallbacks> listenerCallbacks, int originPid,
int originUid, uint64_t transactionId)
- : frameTimelineVsyncId(frameTimelineVsyncId),
+ : frameTimelineInfo(frameTimelineInfo),
states(composerStates),
displays(displayStates),
flags(transactionFlags),
@@ -457,7 +458,7 @@
originUid(originUid),
id(transactionId) {}
- int64_t frameTimelineVsyncId;
+ FrameTimelineInfo frameTimelineInfo;
Vector<ComposerState> states;
Vector<DisplayState> displays;
uint32_t flags;
@@ -522,7 +523,8 @@
void destroyDisplay(const sp<IBinder>& displayToken) override;
std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const override;
sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const override;
- status_t setTransactionState(int64_t frameTimelineVsyncId, const Vector<ComposerState>& state,
+ status_t setTransactionState(const FrameTimelineInfo& frameTimelineInfo,
+ const Vector<ComposerState>& state,
const Vector<DisplayState>& displays, uint32_t flags,
const sp<IBinder>& applyToken,
const InputWindowCommands& inputWindowCommands,
@@ -608,8 +610,8 @@
int8_t compatibility, bool shouldBeSeamless) override;
status_t acquireFrameRateFlexibilityToken(sp<IBinder>* outToken) override;
- status_t setFrameTimelineVsync(const sp<IGraphicBufferProducer>& surface,
- int64_t frameTimelineVsyncId) override;
+ status_t setFrameTimelineInfo(const sp<IGraphicBufferProducer>& surface,
+ const FrameTimelineInfo& frameTimelineInfo) override;
status_t addTransactionTraceListener(
const sp<gui::ITransactionTraceListener>& listener) override;
@@ -727,7 +729,7 @@
/*
* Transactions
*/
- void applyTransactionState(int64_t frameTimelineVsyncId, const Vector<ComposerState>& state,
+ void applyTransactionState(const FrameTimelineInfo& info, const Vector<ComposerState>& state,
const Vector<DisplayState>& displays, uint32_t flags,
const InputWindowCommands& inputWindowCommands,
const int64_t desiredPresentTime, bool isAutoTimestamp,