Loading services/surfaceflinger/BufferQueueLayer.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -143,7 +143,7 @@ bool BufferQueueLayer::framePresentTimeIsCurrent() const { } } Mutex::Autolock lock(mQueueItemLock); Mutex::Autolock lock(mQueueItemLock); return mQueueItems[0].mTimestamp <= mFlinger->mScheduler->expectedPresentTime(); return mQueueItems[0].mTimestamp <= mFlinger->getExpectedPresentTime(); } } nsecs_t BufferQueueLayer::getDesiredPresentTime() { nsecs_t BufferQueueLayer::getDesiredPresentTime() { Loading services/surfaceflinger/BufferStateLayer.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -380,7 +380,7 @@ bool BufferStateLayer::framePresentTimeIsCurrent() const { return true; return true; } } return mDesiredPresentTime <= mFlinger->mScheduler->expectedPresentTime(); return mDesiredPresentTime <= mFlinger->getExpectedPresentTime(); } } nsecs_t BufferStateLayer::getDesiredPresentTime() { nsecs_t BufferStateLayer::getDesiredPresentTime() { Loading services/surfaceflinger/SurfaceFlinger.cpp +13 −2 Original line number Original line Diff line number Diff line Loading @@ -1658,6 +1658,18 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); } } nsecs_t SurfaceFlinger::getExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { DisplayStatInfo stats; mScheduler->getDisplayStatInfo(&stats); const nsecs_t presentTime = mScheduler->expectedPresentTime(); // Inflate the expected present time if we're targetting the next vsync. const nsecs_t correctedTime = mVsyncModulator.getOffsets().sf < mPhaseOffsets->getOffsetThresholdForNextVsync() ? presentTime : presentTime + stats.vsyncPeriod; return correctedTime; } void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { ATRACE_CALL(); ATRACE_CALL(); switch (what) { switch (what) { Loading Loading @@ -3259,8 +3271,7 @@ bool SurfaceFlinger::handlePageFlip() mDrawingState.traverseInZOrder([&](Layer* layer) { mDrawingState.traverseInZOrder([&](Layer* layer) { if (layer->hasReadyFrame()) { if (layer->hasReadyFrame()) { frameQueued = true; frameQueued = true; nsecs_t expectedPresentTime; const nsecs_t expectedPresentTime = getExpectedPresentTime(); expectedPresentTime = mScheduler->expectedPresentTime(); if (layer->shouldPresentNow(expectedPresentTime)) { if (layer->shouldPresentNow(expectedPresentTime)) { mLayersWithQueuedFrames.push_back(layer); mLayersWithQueuedFrames.push_back(layer); } else { } else { Loading services/surfaceflinger/SurfaceFlinger.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -301,6 +301,11 @@ public: // TODO: this should be made accessible only to MessageQueue // TODO: this should be made accessible only to MessageQueue void onMessageReceived(int32_t what); void onMessageReceived(int32_t what); // Returns 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(); // for debugging only // for debugging only // TODO: this should be made accessible only to HWComposer // TODO: this should be made accessible only to HWComposer const Vector<sp<Layer>>& getLayerSortedByZForHwcDisplay(DisplayId displayId); const Vector<sp<Layer>>& getLayerSortedByZForHwcDisplay(DisplayId displayId); Loading Loading
services/surfaceflinger/BufferQueueLayer.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -143,7 +143,7 @@ bool BufferQueueLayer::framePresentTimeIsCurrent() const { } } Mutex::Autolock lock(mQueueItemLock); Mutex::Autolock lock(mQueueItemLock); return mQueueItems[0].mTimestamp <= mFlinger->mScheduler->expectedPresentTime(); return mQueueItems[0].mTimestamp <= mFlinger->getExpectedPresentTime(); } } nsecs_t BufferQueueLayer::getDesiredPresentTime() { nsecs_t BufferQueueLayer::getDesiredPresentTime() { Loading
services/surfaceflinger/BufferStateLayer.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -380,7 +380,7 @@ bool BufferStateLayer::framePresentTimeIsCurrent() const { return true; return true; } } return mDesiredPresentTime <= mFlinger->mScheduler->expectedPresentTime(); return mDesiredPresentTime <= mFlinger->getExpectedPresentTime(); } } nsecs_t BufferStateLayer::getDesiredPresentTime() { nsecs_t BufferStateLayer::getDesiredPresentTime() { Loading
services/surfaceflinger/SurfaceFlinger.cpp +13 −2 Original line number Original line Diff line number Diff line Loading @@ -1658,6 +1658,18 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); } } nsecs_t SurfaceFlinger::getExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { DisplayStatInfo stats; mScheduler->getDisplayStatInfo(&stats); const nsecs_t presentTime = mScheduler->expectedPresentTime(); // Inflate the expected present time if we're targetting the next vsync. const nsecs_t correctedTime = mVsyncModulator.getOffsets().sf < mPhaseOffsets->getOffsetThresholdForNextVsync() ? presentTime : presentTime + stats.vsyncPeriod; return correctedTime; } void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { ATRACE_CALL(); ATRACE_CALL(); switch (what) { switch (what) { Loading Loading @@ -3259,8 +3271,7 @@ bool SurfaceFlinger::handlePageFlip() mDrawingState.traverseInZOrder([&](Layer* layer) { mDrawingState.traverseInZOrder([&](Layer* layer) { if (layer->hasReadyFrame()) { if (layer->hasReadyFrame()) { frameQueued = true; frameQueued = true; nsecs_t expectedPresentTime; const nsecs_t expectedPresentTime = getExpectedPresentTime(); expectedPresentTime = mScheduler->expectedPresentTime(); if (layer->shouldPresentNow(expectedPresentTime)) { if (layer->shouldPresentNow(expectedPresentTime)) { mLayersWithQueuedFrames.push_back(layer); mLayersWithQueuedFrames.push_back(layer); } else { } else { Loading
services/surfaceflinger/SurfaceFlinger.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -301,6 +301,11 @@ public: // TODO: this should be made accessible only to MessageQueue // TODO: this should be made accessible only to MessageQueue void onMessageReceived(int32_t what); void onMessageReceived(int32_t what); // Returns 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(); // for debugging only // for debugging only // TODO: this should be made accessible only to HWComposer // TODO: this should be made accessible only to HWComposer const Vector<sp<Layer>>& getLayerSortedByZForHwcDisplay(DisplayId displayId); const Vector<sp<Layer>>& getLayerSortedByZForHwcDisplay(DisplayId displayId); Loading