summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2021-01-13 10:28:00 -1000
committer Siarhei Vishniakou <svv@google.com> 2021-01-29 18:48:01 +0000
commitfc434acf530cbde198c8936bf1bc09fad5861031 (patch)
tree2f22c6a51fe8cd66f106004d9b438f52c8eeccf2 /libs/gui/LayerState.cpp
parent99599940f68158aeef735d8763980d0dbd397b51 (diff)
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
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 2946aaed37..a4b054a5ff 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -63,7 +63,7 @@ layer_state_t::layer_state_t()
shouldBeSeamless(true),
fixedTransformHint(ui::Transform::ROT_INVALID),
frameNumber(0),
- frameTimelineVsyncId(ISurfaceComposer::INVALID_VSYNC_ID),
+ frameTimelineInfo(),
autoRefresh(false) {
matrix.dsdx = matrix.dtdy = 1.0f;
matrix.dsdy = matrix.dtdx = 0.0f;
@@ -151,7 +151,7 @@ status_t layer_state_t::write(Parcel& output) const
SAFE_PARCEL(output.writeBool, shouldBeSeamless);
SAFE_PARCEL(output.writeUint32, fixedTransformHint);
SAFE_PARCEL(output.writeUint64, frameNumber);
- SAFE_PARCEL(output.writeInt64, frameTimelineVsyncId);
+ SAFE_PARCEL(frameTimelineInfo.write, output);
SAFE_PARCEL(output.writeBool, autoRefresh);
SAFE_PARCEL(output.writeUint32, blurRegions.size());
@@ -270,7 +270,7 @@ status_t layer_state_t::read(const Parcel& input)
SAFE_PARCEL(input.readUint32, &tmpUint32);
fixedTransformHint = static_cast<ui::Transform::RotationFlags>(tmpUint32);
SAFE_PARCEL(input.readUint64, &frameNumber);
- SAFE_PARCEL(input.readInt64, &frameTimelineVsyncId);
+ SAFE_PARCEL(frameTimelineInfo.read, input);
SAFE_PARCEL(input.readBool, &autoRefresh);
uint32_t numRegions = 0;
@@ -537,15 +537,9 @@ void layer_state_t::merge(const layer_state_t& other) {
what |= eFrameNumberChanged;
frameNumber = other.frameNumber;
}
- if (other.what & eFrameTimelineVsyncChanged) {
- // When merging vsync Ids we take the oldest valid one
- if (frameTimelineVsyncId != ISurfaceComposer::INVALID_VSYNC_ID &&
- other.frameTimelineVsyncId != ISurfaceComposer::INVALID_VSYNC_ID) {
- frameTimelineVsyncId = std::max(frameTimelineVsyncId, other.frameTimelineVsyncId);
- } else if (frameTimelineVsyncId == ISurfaceComposer::INVALID_VSYNC_ID) {
- frameTimelineVsyncId = other.frameTimelineVsyncId;
- }
- what |= eFrameTimelineVsyncChanged;
+ if (other.what & eFrameTimelineInfoChanged) {
+ what |= eFrameTimelineInfoChanged;
+ frameTimelineInfo.merge(other.frameTimelineInfo);
}
if (other.what & eAutoRefreshChanged) {
what |= eAutoRefreshChanged;