Descriptioncc: Make the scheduler compositeAndReadback flow not race with WAITING_FOR_FIRST_DRAW
This fixes two problems in the compositeAndReadback flow. If you
compositeAndReadback really fast after a commit and the
scheduler is in WAITING_FOR_FIRST_DRAW but can't draw yet (e.g.
inside a vsync), then:
If canDraw() is false:
- It would try to draw the previous commit and fail. drawing is, at
this point, blocked until the next commit. So it would
ScheduleActionBeginFrame.
- Now it does the C&R beginFrame. This finishes and we enter
WAITING_FOR_FIRST_DRAW.
- We setNeedsRedraw(), which tries to draw, but canDraw() is
false. So it would ScheduleActionBeginFrame. This moves us to
FRAME_IN_PROGRESS.
- Now we setNeedsForcedRedraw(), but we don't draw since we're
now trying to commit.
- Thus we leave the R&C without actually drawing, and
with m_expectImmediateBeginFrame = true.
- Now we set canDraw() true, and it draws and drops back to
FRAME_IN_PROGRESS, and the unit test hangs waiting for the last
commit to complete.
If canDraw() is true:
- Thread proxy does setNeedsForcedCommit which is supposed
to produce a beginFrame. But because we're in WAITING_FOR_FIRST_DRAW,
it would just try to draw the previous commit and fail (we're not
blocked on drawing until the next commit so a beginFrame doesn't
happen).
- Thread proxy checks for a pending commit and sees the
WAITING_FOR_FIRST_DRAW as a pending commit, so it signals
the beginFrame to go.
- Then it does the C&R beginFrame. This finishes and we enter
WAITING_FOR_FIRST_DRAW.
- We force a draw, which works and draws the R&C commit. It moves
us to FRAME_IN_PROGRESS as expected.
Now we've fixed the world.
- We go to WAITING_FOR_FIRST_FORCED_DRAW which never does a beginFrame, so
we don't to rely on inconsistent behaviour based on canDraw().
- Thread proxy does not mistake waiting for a draw as a commit in progress. So
it waits until the previous commit's draw happens, and the beginFrame()
is posted.
BUG=165022
R=jamesr
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=173867
Patch Set 1 #Patch Set 2 : #Patch Set 3 : #Patch Set 4 : #Patch Set 5 : #Patch Set 6 : indents #
Messages
Total messages: 3 (0 generated)
|