| Index: cc/scheduler_state_machine.cc
|
| diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc
|
| index 5d6229703f8fd5285d6c4bf5e0b9d09e884f6a59..01f2f0098baee6b40e627047db0f7f76965190ce 100644
|
| --- a/cc/scheduler_state_machine.cc
|
| +++ b/cc/scheduler_state_machine.cc
|
| @@ -15,9 +15,11 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
|
| , m_currentFrameNumber(0)
|
| , m_lastFrameNumberWhereDrawWasCalled(-1)
|
| , m_lastFrameNumberWhereTreeActivationAttempted(-1)
|
| + , m_lastFrameNumberWhereCheckForCompletedTexturesCalled(-1)
|
| , m_consecutiveFailedDraws(0)
|
| , m_maximumNumberOfFailedDrawsBeforeDrawIsForced(3)
|
| , m_needsRedraw(false)
|
| + , m_swapUsedIncompleteTexture(false)
|
| , m_needsForcedRedraw(false)
|
| , m_needsForcedRedrawAfterNextCommit(false)
|
| , m_needsCommit(false)
|
| @@ -38,12 +40,16 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
|
| std::string SchedulerStateMachine::toString()
|
| {
|
| std::string str;
|
| + base::StringAppendF(&str, "m_settings.implSidePainting = %d; ", m_settings.implSidePainting);
|
| base::StringAppendF(&str, "m_commitState = %d; ", m_commitState);
|
| base::StringAppendF(&str, "m_currentFrameNumber = %d; ", m_currentFrameNumber);
|
| base::StringAppendF(&str, "m_lastFrameNumberWhereDrawWasCalled = %d; ", m_lastFrameNumberWhereDrawWasCalled);
|
| + base::StringAppendF(&str, "m_lastFrameNumberWhereTreeActivationAttempted = %d; ", m_lastFrameNumberWhereTreeActivationAttempted);
|
| + base::StringAppendF(&str, "m_lastFrameNumberWhereCheckForCompletedTexturesCalled = %d; ", m_lastFrameNumberWhereCheckForCompletedTexturesCalled);
|
| base::StringAppendF(&str, "m_consecutiveFailedDraws = %d; ", m_consecutiveFailedDraws);
|
| base::StringAppendF(&str, "m_maximumNumberOfFailedDrawsBeforeDrawIsForced = %d; ", m_maximumNumberOfFailedDrawsBeforeDrawIsForced);
|
| base::StringAppendF(&str, "m_needsRedraw = %d; ", m_needsRedraw);
|
| + base::StringAppendF(&str, "m_swapUsedIncompleteTexture = %d; ", m_swapUsedIncompleteTexture);
|
| base::StringAppendF(&str, "m_needsForcedRedraw = %d; ", m_needsForcedRedraw);
|
| base::StringAppendF(&str, "m_needsForcedRedrawAfterNextCommit = %d; ", m_needsForcedRedrawAfterNextCommit);
|
| base::StringAppendF(&str, "m_needsCommit = %d; ", m_needsCommit);
|
| @@ -71,6 +77,12 @@ bool SchedulerStateMachine::hasAttemptedTreeActivationThisFrame() const
|
| return m_currentFrameNumber == m_lastFrameNumberWhereTreeActivationAttempted;
|
| }
|
|
|
| +bool SchedulerStateMachine::hasCheckedForCompletedTexturesThisFrame() const
|
| +{
|
| + return m_currentFrameNumber ==
|
| + m_lastFrameNumberWhereCheckForCompletedTexturesCalled;
|
| +}
|
| +
|
| bool SchedulerStateMachine::drawSuspendedUntilCommit() const
|
| {
|
| if (!m_canDraw)
|
| @@ -109,7 +121,19 @@ bool SchedulerStateMachine::shouldDraw() const
|
|
|
| bool SchedulerStateMachine::shouldAttemptTreeActivation() const
|
| {
|
| - return m_hasPendingTree && m_insideVSync && !hasAttemptedTreeActivationThisFrame();
|
| + return m_hasPendingTree && m_insideVSync && !hasAttemptedTreeActivationThisFrame();
|
| +}
|
| +
|
| +bool SchedulerStateMachine::shouldCheckForCompletedTextures() const
|
| +{
|
| + if (!m_settings.implSidePainting)
|
| + return false;
|
| + if (hasCheckedForCompletedTexturesThisFrame())
|
| + return false;
|
| +
|
| + return shouldAttemptTreeActivation() ||
|
| + shouldDraw() ||
|
| + m_swapUsedIncompleteTexture;
|
| }
|
|
|
| bool SchedulerStateMachine::shouldAcquireLayerTexturesForMainThread() const
|
| @@ -144,6 +168,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const
|
| return ACTION_BEGIN_OUTPUT_SURFACE_RECREATION;
|
| if (m_outputSurfaceState == OUTPUT_SURFACE_RECREATING)
|
| return ACTION_NONE;
|
| + if (shouldCheckForCompletedTextures())
|
| + return ACTION_CHECK_FOR_NEW_TEXTURES;
|
| if (shouldAttemptTreeActivation())
|
| return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED;
|
| if (shouldDraw())
|
| @@ -154,6 +180,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const
|
| return ACTION_NONE;
|
|
|
| case COMMIT_STATE_FRAME_IN_PROGRESS:
|
| + if (shouldCheckForCompletedTextures())
|
| + return ACTION_CHECK_FOR_NEW_TEXTURES;
|
| if (shouldAttemptTreeActivation())
|
| return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED;
|
| if (shouldDraw())
|
| @@ -164,6 +192,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const
|
| return ACTION_COMMIT;
|
|
|
| case COMMIT_STATE_WAITING_FOR_FIRST_DRAW: {
|
| + if (shouldCheckForCompletedTextures())
|
| + return ACTION_CHECK_FOR_NEW_TEXTURES;
|
| if (shouldAttemptTreeActivation())
|
| return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED;
|
| if (shouldDraw() || m_outputSurfaceState == OUTPUT_SURFACE_LOST)
|
| @@ -177,6 +207,8 @@ SchedulerStateMachine::Action SchedulerStateMachine::nextAction() const
|
| }
|
|
|
| case COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW:
|
| + if (shouldCheckForCompletedTextures())
|
| + return ACTION_CHECK_FOR_NEW_TEXTURES;
|
| if (shouldAttemptTreeActivation())
|
| return ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED;
|
| if (m_needsForcedRedraw)
|
| @@ -193,6 +225,10 @@ void SchedulerStateMachine::updateState(Action action)
|
| case ACTION_NONE:
|
| return;
|
|
|
| + case ACTION_CHECK_FOR_NEW_TEXTURES:
|
| + m_lastFrameNumberWhereCheckForCompletedTexturesCalled = m_currentFrameNumber;
|
| + return;
|
| +
|
| case ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED:
|
| m_lastFrameNumberWhereTreeActivationAttempted = m_currentFrameNumber;
|
| return;
|
| @@ -277,6 +313,9 @@ bool SchedulerStateMachine::vsyncCallbackNeeded() const
|
| if (m_needsForcedRedraw)
|
| return true;
|
|
|
| + if (m_visible && m_swapUsedIncompleteTexture)
|
| + return true;
|
| +
|
| return m_needsRedraw && m_visible && m_outputSurfaceState == OUTPUT_SURFACE_ACTIVE;
|
| }
|
|
|
| @@ -301,6 +340,11 @@ void SchedulerStateMachine::setNeedsRedraw()
|
| m_needsRedraw = true;
|
| }
|
|
|
| +void SchedulerStateMachine::didSwapUseIncompleteTexture()
|
| +{
|
| + m_swapUsedIncompleteTexture = true;
|
| +}
|
| +
|
| void SchedulerStateMachine::setNeedsForcedRedraw()
|
| {
|
| m_needsForcedRedraw = true;
|
|
|