SurfaceFlinger: some bug fixes on Scheduler
- use mHWVsyncAvailable from Scheduler instead of SF
- call DispSync::dump() on Scheduler
- Revert VSYNC-app and VSYNC-sf names as systrace expects these
names for vsync events
Test: run some applications
Change-Id: Ida0ba67eee55471d1df7f5e89a7b2ad36ab7074d
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 7fd7762..af439f7 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -190,9 +190,15 @@
}
void Scheduler::setVsyncPeriod(const nsecs_t period) {
+ std::lock_guard<std::mutex> lock(mHWVsyncLock);
mPrimaryDispSync->reset();
mPrimaryDispSync->setPeriod(period);
- enableHardwareVsync();
+
+ if (!mPrimaryHWVsyncEnabled) {
+ mPrimaryDispSync->beginResync();
+ mEventControlThread->setVsyncEnabled(true);
+ mPrimaryHWVsyncEnabled = true;
+ }
}
void Scheduler::addResyncSample(const nsecs_t timestamp) {
@@ -228,10 +234,19 @@
mHWVsyncAvailable = makeAvailable;
}
+bool Scheduler::getHWSyncAvailable() {
+ std::lock_guard<std::mutex> lock(mHWVsyncLock);
+ return mHWVsyncAvailable;
+}
+
nsecs_t Scheduler::expectedPresentTime() {
return mPrimaryDispSync->expectedPresentTime();
}
+void Scheduler::dumpPrimaryDispSync(std::string& result) const {
+ mPrimaryDispSync->dump(result);
+}
+
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