SurfaceFlinger: calculate expected present once
Calculate the expected present time in the beginning of the frame
and use the same value across the frame composition.
Bug: 137873466
Test: App transitions
Change-Id: I0b41c62796f6150702e8d50ec7d28838d3a5aa87
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 556a4b9..d836795 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -301,10 +301,11 @@
// TODO: this should be made accessible only to MessageQueue
void onMessageReceived(int32_t what);
- // Returns the expected present time for this frame.
+ // populates the expected present time for this frame.
// When we are in negative offsets, we perform a correction so that the
// predicted vsync for the *next* frame is used instead.
- nsecs_t getExpectedPresentTime();
+ void populateExpectedPresentTime();
+ nsecs_t getExpectedPresentTime() const { return mExpectedPresentTime; }
// for debugging only
// TODO: this should be made accessible only to HWComposer
@@ -1184,6 +1185,8 @@
// Flags to capture the state of Vsync in HWC
HWC2::Vsync mHWCVsyncState = HWC2::Vsync::Disable;
HWC2::Vsync mHWCVsyncPendingState = HWC2::Vsync::Disable;
+
+ nsecs_t mExpectedPresentTime;
};
} // namespace android