Bug 71638 - [chromium] Fix handling of setNeedsCommit and setNeedsAnimate in threaded mode
Summary: [chromium] Fix handling of setNeedsCommit and setNeedsAnimate in threaded mode
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nat Duca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-06 14:55 PST by Nat Duca
Modified: 2011-11-17 18:08 PST (History)
4 users (show)

See Also:


Attachments
Patch (8.02 KB, patch)
2011-11-06 14:55 PST, Nat Duca
no flags Details | Formatted Diff | Diff
Patch (11.39 KB, patch)
2011-11-17 17:08 PST, Nat Duca
jamesr: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nat Duca 2011-11-06 14:55:26 PST
[chromium] Fix handling of setNeedsCommit and setNeedsAnimate in threaded mode
Comment 1 Nat Duca 2011-11-06 14:55:57 PST
Created attachment 113805 [details]
Patch
Comment 2 James Robinson 2011-11-06 18:25:16 PST
Comment on attachment 113805 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=113805&action=review

almost there but i see one possible issue

> Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp:64
> +    : m_animationRequested(false)

huh, so we had an m_animationRequested bool but weren't using it? odd

i think i'd spell it m_animateRequested

> Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp:202
> +    if (m_animationRequested)

hm, this change means we might trigger 2 setNeedsCommit calls on the impl side whereas before we wouldn't. looking at the scheduler and state machine i think this will be fine but could you double check? i'm thinking of this case in particular:

main thread: setNeedsAnimate() -> post setNeedsAnimateOnImplThread
impl thread: setNeedsAnimateOnImplThread -> BFAC sent
main thread: setNeedsCommit() -> post setNeedsCommitOnImplThread, clears m_needsCommit on CCSchedulerStateMachine
impl thread: setNeedsCommitOnImplThread -> sets need commit on scheduler even though a BFAC is pending
main thread: BFAC -> animate, layout, post BFAC on impl thread
impl thread: run commit

at this point we'll still have m_needsCommit set on the scheduler state machine, and i think we'll do another spurious commit once the state machine goes back to idle.

i think the fix is to set m_needsCommit to false in CCSchedulerStateMachine::beginFrameComplete() instead of ::updateState()

> Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp:377
> +    m_layerTreeHost->applyScrollDeltas(*scrollInfo.get());

nit: i realize this was already here, but the .get() is redundant. operator* on WebKit smart pointer types does the right thing

> Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp:647
> +    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)

i think test should really be checking for animateAndLayout() calls, not drawing. the fact that we draw multiple times on this test is a consequence of the fact that we always draw after commit, which IMO is a bug - we should draw when the commit does something requiring drawing, but otherwise no. setNeedsAnimate() should trigger an animateAndLayout() at the right time - commit/draw interaction is a different piece of the system
Comment 3 Nat Duca 2011-11-17 17:08:15 PST
Created attachment 115711 [details]
Patch
Comment 4 James Robinson 2011-11-17 17:28:44 PST
Comment on attachment 115711 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115711&action=review

R=me

> Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp:692
> +    virtual void animateAndLayout(double impl)

parameter name doesn't make much sense here
Comment 5 Nat Duca 2011-11-17 18:08:52 PST
Committed r100708: <http://trac.webkit.org/changeset/100708>