SurfaceFlinger now uses the new VSYNC HAL API.
If h/w composer doesn't support vsync (version < 0.3) we
"fake" it with a timer.
Change-Id: I1e3be79f43c9631d1293ad7d6cf52f9bfc42d65b
diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h
index 65217cb..3f9d452 100644
--- a/services/surfaceflinger/EventThread.h
+++ b/services/surfaceflinger/EventThread.h
@@ -27,6 +27,8 @@
#include <utils/threads.h>
#include <utils/SortedVector.h>
+#include "DisplayHardware/DisplayHardware.h"
+
// ---------------------------------------------------------------------------
namespace android {
@@ -34,11 +36,10 @@
// ---------------------------------------------------------------------------
class SurfaceFlinger;
-class DisplayHardware;
// ---------------------------------------------------------------------------
-class EventThread : public Thread {
+class EventThread : public Thread, public DisplayHardware::VSyncHandler {
class Connection : public BnDisplayEventConnection {
public:
Connection(const sp<EventThread>& eventThread);
@@ -80,12 +81,13 @@
virtual bool threadLoop();
virtual status_t readyToRun();
virtual void onFirstRef();
+ virtual void onVSyncReceived(int, nsecs_t timestamp);
void removeDisplayEventConnection(const wp<Connection>& connection);
// constants
sp<SurfaceFlinger> mFlinger;
- const DisplayHardware& mHw;
+ DisplayHardware& mHw;
mutable Mutex mLock;
mutable Condition mCondition;
@@ -93,6 +95,7 @@
// protected by mLock
SortedVector< wp<Connection> > mDisplayEventConnections;
nsecs_t mLastVSyncTimestamp;
+ nsecs_t mVSyncTimestamp;
// main thread only
size_t mDeliveredEvents;