Loading services/surfaceflinger/EventThread.cpp +6 −3 Original line number Original line Diff line number Diff line Loading @@ -44,13 +44,14 @@ static void vsyncOffCallback(union sigval val) { return; return; } } EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger) EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs) : mVSyncSource(src), : mVSyncSource(src), mFlinger(flinger), mFlinger(flinger), mUseSoftwareVSync(false), mUseSoftwareVSync(false), mVsyncEnabled(false), mVsyncEnabled(false), mDebugVsyncEnabled(false), mDebugVsyncEnabled(false), mVsyncHintSent(false) { mVsyncHintSent(false), mInterceptVSyncs(interceptVSyncs) { for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) { for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) { mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; Loading Loading @@ -226,7 +227,9 @@ Vector< sp<EventThread::Connection> > EventThread::waitForEvent( timestamp = mVSyncEvent[i].header.timestamp; timestamp = mVSyncEvent[i].header.timestamp; if (timestamp) { if (timestamp) { // we have a vsync event to dispatch // we have a vsync event to dispatch if (mInterceptVSyncs) { mFlinger.mInterceptor.saveVSyncEvent(timestamp); mFlinger.mInterceptor.saveVSyncEvent(timestamp); } *event = mVSyncEvent[i]; *event = mVSyncEvent[i]; mVSyncEvent[i].header.timestamp = 0; mVSyncEvent[i].header.timestamp = 0; vsyncCount = mVSyncEvent[i].vsync.count; vsyncCount = mVSyncEvent[i].vsync.count; Loading services/surfaceflinger/EventThread.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ class EventThread : public Thread, private VSyncSource::Callback { public: public: EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger); EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs); sp<Connection> createEventConnection() const; sp<Connection> createEventConnection() const; status_t registerDisplayEventConnection(const sp<Connection>& connection); status_t registerDisplayEventConnection(const sp<Connection>& connection); Loading Loading @@ -132,6 +132,7 @@ private: bool mDebugVsyncEnabled; bool mDebugVsyncEnabled; bool mVsyncHintSent; bool mVsyncHintSent; const bool mInterceptVSyncs; timer_t mTimerId; timer_t mTimerId; }; }; Loading services/surfaceflinger/SurfaceFlinger.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -503,10 +503,10 @@ void SurfaceFlinger::init() { // start the EventThread // start the EventThread sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, vsyncPhaseOffsetNs, true, "app"); vsyncPhaseOffsetNs, true, "app"); mEventThread = new EventThread(vsyncSrc, *this); mEventThread = new EventThread(vsyncSrc, *this, false); sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sfVsyncPhaseOffsetNs, true, "sf"); sfVsyncPhaseOffsetNs, true, "sf"); mSFEventThread = new EventThread(sfVsyncSrc, *this); mSFEventThread = new EventThread(sfVsyncSrc, *this, true); mEventQueue.setEventThread(mSFEventThread); mEventQueue.setEventThread(mSFEventThread); // set SFEventThread to SCHED_FIFO to minimize jitter // set SFEventThread to SCHED_FIFO to minimize jitter Loading Loading @@ -896,7 +896,7 @@ status_t SurfaceFlinger::enableVSyncInjections(bool enable) { ALOGV("VSync Injections enabled"); ALOGV("VSync Injections enabled"); if (mVSyncInjector.get() == nullptr) { if (mVSyncInjector.get() == nullptr) { mVSyncInjector = new InjectVSyncSource(); mVSyncInjector = new InjectVSyncSource(); mInjectorEventThread = new EventThread(mVSyncInjector, *this); mInjectorEventThread = new EventThread(mVSyncInjector, *this, false); } } mEventQueue.setEventThread(mInjectorEventThread); mEventQueue.setEventThread(mInjectorEventThread); } else { } else { Loading services/surfaceflinger/SurfaceFlinger_hwc1.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -499,10 +499,10 @@ void SurfaceFlinger::init() { // start the EventThread // start the EventThread sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, vsyncPhaseOffsetNs, true, "app"); vsyncPhaseOffsetNs, true, "app"); mEventThread = new EventThread(vsyncSrc, *this); mEventThread = new EventThread(vsyncSrc, *this, false); sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sfVsyncPhaseOffsetNs, true, "sf"); sfVsyncPhaseOffsetNs, true, "sf"); mSFEventThread = new EventThread(sfVsyncSrc, *this); mSFEventThread = new EventThread(sfVsyncSrc, *this, true); mEventQueue.setEventThread(mSFEventThread); mEventQueue.setEventThread(mSFEventThread); // set SFEventThread to SCHED_FIFO to minimize jitter // set SFEventThread to SCHED_FIFO to minimize jitter Loading Loading @@ -859,7 +859,7 @@ status_t SurfaceFlinger::enableVSyncInjections(bool enable) { ALOGV("VSync Injections enabled"); ALOGV("VSync Injections enabled"); if (mVSyncInjector.get() == nullptr) { if (mVSyncInjector.get() == nullptr) { mVSyncInjector = new InjectVSyncSource(); mVSyncInjector = new InjectVSyncSource(); mInjectorEventThread = new EventThread(mVSyncInjector, *this); mInjectorEventThread = new EventThread(mVSyncInjector, *this, false); } } mEventQueue.setEventThread(mInjectorEventThread); mEventQueue.setEventThread(mInjectorEventThread); } else { } else { Loading Loading
services/surfaceflinger/EventThread.cpp +6 −3 Original line number Original line Diff line number Diff line Loading @@ -44,13 +44,14 @@ static void vsyncOffCallback(union sigval val) { return; return; } } EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger) EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs) : mVSyncSource(src), : mVSyncSource(src), mFlinger(flinger), mFlinger(flinger), mUseSoftwareVSync(false), mUseSoftwareVSync(false), mVsyncEnabled(false), mVsyncEnabled(false), mDebugVsyncEnabled(false), mDebugVsyncEnabled(false), mVsyncHintSent(false) { mVsyncHintSent(false), mInterceptVSyncs(interceptVSyncs) { for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) { for (int32_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) { mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; Loading Loading @@ -226,7 +227,9 @@ Vector< sp<EventThread::Connection> > EventThread::waitForEvent( timestamp = mVSyncEvent[i].header.timestamp; timestamp = mVSyncEvent[i].header.timestamp; if (timestamp) { if (timestamp) { // we have a vsync event to dispatch // we have a vsync event to dispatch if (mInterceptVSyncs) { mFlinger.mInterceptor.saveVSyncEvent(timestamp); mFlinger.mInterceptor.saveVSyncEvent(timestamp); } *event = mVSyncEvent[i]; *event = mVSyncEvent[i]; mVSyncEvent[i].header.timestamp = 0; mVSyncEvent[i].header.timestamp = 0; vsyncCount = mVSyncEvent[i].vsync.count; vsyncCount = mVSyncEvent[i].vsync.count; Loading
services/surfaceflinger/EventThread.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ class EventThread : public Thread, private VSyncSource::Callback { public: public: EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger); EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs); sp<Connection> createEventConnection() const; sp<Connection> createEventConnection() const; status_t registerDisplayEventConnection(const sp<Connection>& connection); status_t registerDisplayEventConnection(const sp<Connection>& connection); Loading Loading @@ -132,6 +132,7 @@ private: bool mDebugVsyncEnabled; bool mDebugVsyncEnabled; bool mVsyncHintSent; bool mVsyncHintSent; const bool mInterceptVSyncs; timer_t mTimerId; timer_t mTimerId; }; }; Loading
services/surfaceflinger/SurfaceFlinger.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -503,10 +503,10 @@ void SurfaceFlinger::init() { // start the EventThread // start the EventThread sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, vsyncPhaseOffsetNs, true, "app"); vsyncPhaseOffsetNs, true, "app"); mEventThread = new EventThread(vsyncSrc, *this); mEventThread = new EventThread(vsyncSrc, *this, false); sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sfVsyncPhaseOffsetNs, true, "sf"); sfVsyncPhaseOffsetNs, true, "sf"); mSFEventThread = new EventThread(sfVsyncSrc, *this); mSFEventThread = new EventThread(sfVsyncSrc, *this, true); mEventQueue.setEventThread(mSFEventThread); mEventQueue.setEventThread(mSFEventThread); // set SFEventThread to SCHED_FIFO to minimize jitter // set SFEventThread to SCHED_FIFO to minimize jitter Loading Loading @@ -896,7 +896,7 @@ status_t SurfaceFlinger::enableVSyncInjections(bool enable) { ALOGV("VSync Injections enabled"); ALOGV("VSync Injections enabled"); if (mVSyncInjector.get() == nullptr) { if (mVSyncInjector.get() == nullptr) { mVSyncInjector = new InjectVSyncSource(); mVSyncInjector = new InjectVSyncSource(); mInjectorEventThread = new EventThread(mVSyncInjector, *this); mInjectorEventThread = new EventThread(mVSyncInjector, *this, false); } } mEventQueue.setEventThread(mInjectorEventThread); mEventQueue.setEventThread(mInjectorEventThread); } else { } else { Loading
services/surfaceflinger/SurfaceFlinger_hwc1.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -499,10 +499,10 @@ void SurfaceFlinger::init() { // start the EventThread // start the EventThread sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, vsyncPhaseOffsetNs, true, "app"); vsyncPhaseOffsetNs, true, "app"); mEventThread = new EventThread(vsyncSrc, *this); mEventThread = new EventThread(vsyncSrc, *this, false); sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, sfVsyncPhaseOffsetNs, true, "sf"); sfVsyncPhaseOffsetNs, true, "sf"); mSFEventThread = new EventThread(sfVsyncSrc, *this); mSFEventThread = new EventThread(sfVsyncSrc, *this, true); mEventQueue.setEventThread(mSFEventThread); mEventQueue.setEventThread(mSFEventThread); // set SFEventThread to SCHED_FIFO to minimize jitter // set SFEventThread to SCHED_FIFO to minimize jitter Loading Loading @@ -859,7 +859,7 @@ status_t SurfaceFlinger::enableVSyncInjections(bool enable) { ALOGV("VSync Injections enabled"); ALOGV("VSync Injections enabled"); if (mVSyncInjector.get() == nullptr) { if (mVSyncInjector.get() == nullptr) { mVSyncInjector = new InjectVSyncSource(); mVSyncInjector = new InjectVSyncSource(); mInjectorEventThread = new EventThread(mVSyncInjector, *this); mInjectorEventThread = new EventThread(mVSyncInjector, *this, false); } } mEventQueue.setEventThread(mInjectorEventThread); mEventQueue.setEventThread(mInjectorEventThread); } else { } else { Loading