SurfaceFlinger: get expectedPresentTime from Scheduler
DispSync is owned by Scheduler when it is enabled.
This is a fix to get expectedPresentTime from Scheduler instead of
directly from DispSync.
Test: scroll within app and check systrace
Change-Id: I103d2a56767c49fc5d0c472c6307f3d84e353ac9
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index cb83c62..5268c8c 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -238,6 +238,10 @@
mHWVsyncAvailable = makeAvailable;
}
+nsecs_t Scheduler::expectedPresentTime() {
+ return mPrimaryDispSync->expectedPresentTime();
+}
+
void Scheduler::addFramePresentTimeForLayer(const nsecs_t framePresentTime, bool isAutoTimestamp,
const std::string layerName) {
// This is V1 logic. It calculates the average FPS based on the timestamp frequency
diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h
index 4abf027..089d579 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.h
+++ b/services/surfaceflinger/Scheduler/Scheduler.h
@@ -109,6 +109,7 @@
void addPresentFence(const std::shared_ptr<FenceTime>& fenceTime);
void setIgnorePresentFences(bool ignore);
void makeHWSyncAvailable(bool makeAvailable);
+ nsecs_t expectedPresentTime();
// Adds the present time for given layer to the history of present times.
void addFramePresentTimeForLayer(const nsecs_t framePresentTime, bool isAutoTimestamp,
const std::string layerName);
@@ -142,9 +143,6 @@
// Function that is called when the timer expires.
void expiredTimerCallback();
- // TODO(b/113612090): Instead of letting BufferQueueLayer to access mDispSync directly, it
- // should make request to Scheduler to compute next refresh.
- friend class BufferQueueLayer;
// If fences from sync Framework are supported.
const bool mHasSyncFramework;