WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
97918
[Chromium] Smoother animation for non-RAF 2D canvas animations
https://bugs.webkit.org/show_bug.cgi?id=97918
Summary
[Chromium] Smoother animation for non-RAF 2D canvas animations
Justin Novosad
Reported
2012-09-28 08:39:38 PDT
[Chromium] Smoother animation for non-RAF 2D canvas animations
Attachments
Patch
(17.89 KB, patch)
2012-09-28 10:49 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Patch
(16.51 KB, patch)
2012-10-02 14:01 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Patch
(16.50 KB, patch)
2012-10-03 10:56 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Patch
(17.14 KB, patch)
2012-10-03 13:39 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Patch
(16.81 KB, patch)
2012-10-04 07:59 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Patch for landing
(16.47 KB, patch)
2012-10-04 10:06 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Patch
(16.70 KB, patch)
2012-10-10 13:57 PDT
,
Justin Novosad
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Justin Novosad
Comment 1
2012-09-28 10:49:33 PDT
Created
attachment 166277
[details]
Patch
Stephen White
Comment 2
2012-09-28 11:41:22 PDT
Comment on
attachment 166277
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166277&action=review
> Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp:139 > + m_flushNeeded = false; > + switch (m_state) { > + case FreshState: > + if (m_didRecordDrawCommand && !isFreshFrame()) > + m_state = StaleState; > + break; > + case StaleState: > + if (m_didRecordDrawCommand) { > + if (isFreshFrame()) > + m_state = FreshState; > + else { > + if (!m_didFlushSinceLastRecordedFrame) > + m_flushNeeded = true; > + } > + } > + break; > + } > + if (m_didRecordDrawCommand) > + m_didFlushSinceLastRecordedFrame = false; > + m_didRecordDrawCommand = false;
As discussed, I think this logic would be a lot clearer if we replaced isFreshFrame() with a "skippedPendingCommands()" notification from the deferred canvas. Then we could simply have a counter on the bridge which counts the frames-since-last-flush, which is reset to zero on flushedPendingCommands() or skippedPendingCommands(), and we don't need this state machine at all.
> Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp:89 > + for (Canvas2DLayerBridge* layer = m_layerList.head(); layer; layer = layer->next()) > + layer->flush();
As discussed, I think we can get away with only flushing the one layer, since the rest of the layers will be taken care of at commit time.
Justin Novosad
Comment 3
2012-10-02 14:01:46 PDT
Created
attachment 166746
[details]
Patch
Stephen White
Comment 4
2012-10-02 14:27:53 PDT
Comment on
attachment 166746
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166746&action=review
Thanks, this seems much cleaner to me. Just some naming and we're done, I think.
> Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp:82 > + layer->didDrawFrame();
<bikeshed> Perhaps didDrawFrame() is misnamed? It seems to be called regardless of whether that particular canvas drew anything or not. Unless we mean a compositor frame, in which case maybe it should be didDrawCompositorFrame()? </bikeshed>
Justin Novosad
Comment 5
2012-10-03 06:54:54 PDT
(In reply to
comment #4
)
> (From update of
attachment 166746
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=166746&action=review
> > Thanks, this seems much cleaner to me. Just some naming and we're done, I think. > > > Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp:82 > > + layer->didDrawFrame(); > > <bikeshed> Perhaps didDrawFrame() is misnamed? It seems to be called regardless of whether that particular canvas drew anything or not. Unless we mean a compositor frame, in which case maybe it should be didDrawCompositorFrame()? </bikeshed>
This does not refer to a compositor frame, but to a frame in the atomic JS execution sense. Since we are just propagating the task observer signal, we could just use the same name as the observer interface: didProcessTask, The it would be up to the Canvas2DLayerBridge to figure out whether the task drew a new canvas frame.
Stephen White
Comment 6
2012-10-03 07:21:14 PDT
Comment on
attachment 166746
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166746&action=review
>>> Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp:82 >>> + layer->didDrawFrame(); >> >> <bikeshed> Perhaps didDrawFrame() is misnamed? It seems to be called regardless of whether that particular canvas drew anything or not. Unless we mean a compositor frame, in which case maybe it should be didDrawCompositorFrame()? </bikeshed> > > This does not refer to a compositor frame, but to a frame in the atomic JS execution sense. Since we are just propagating the task observer signal, we could just use the same name as the observer interface: didProcessTask, The it would be up to the Canvas2DLayerBridge to figure out whether the task drew a new canvas frame.
You're right; it's not a compositor frame. didProcessTask() is a bit generic, though, and I usually prefer to name things by what they do, rather than when they're called. Maybe flushFrameBacklog()? rateLimit()? limitPendingFrames()? flushExcessiveFrames()?
> Source/WebCore/platform/graphics/chromium/Canvas2DLayerManager.cpp:96 > + m_deferredFrameStarted = true;
More bikeshedding, just 'cause I'm annoying that way: m_taskObserverStarted?
Justin Novosad
Comment 7
2012-10-03 10:56:24 PDT
Created
attachment 166922
[details]
Patch
Stephen White
Comment 8
2012-10-03 11:46:17 PDT
Comment on
attachment 166922
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166922&action=review
> Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp:139 > storageAllocatedForRecordingChanged(deferredCanvas()->storageAllocatedForRecording());
As discussed, let's mock storageAllocatedForRecordingChanged() itself, instead of creating didFlushPendingCommands() for mocking purposes.
Justin Novosad
Comment 9
2012-10-03 13:39:45 PDT
Created
attachment 166952
[details]
Patch
Stephen White
Comment 10
2012-10-03 13:50:31 PDT
Comment on
attachment 166952
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166952&action=review
> Source/WebKit/chromium/tests/Canvas2DLayerManagerTest.cpp:88 > + size_t m_fakeStorageAllocatedForRecording;
This member variable seems to be unused.
Justin Novosad
Comment 11
2012-10-04 07:59:36 PDT
Created
attachment 167105
[details]
Patch
Stephen White
Comment 12
2012-10-04 09:11:48 PDT
Comment on
attachment 167105
[details]
Patch Looks good. Looks like the patch has conflicts, but I trust you to fix them. :) r=me
Justin Novosad
Comment 13
2012-10-04 10:06:20 PDT
Created
attachment 167116
[details]
Patch for landing
WebKit Review Bot
Comment 14
2012-10-04 11:12:42 PDT
Comment on
attachment 167116
[details]
Patch for landing Rejecting
attachment 167116
[details]
from commit-queue. New failing tests: Canvas2DLayerManagerTest.testDeferredFrame Full output:
http://queues.webkit.org/results/14183038
Justin Novosad
Comment 15
2012-10-10 13:57:51 PDT
Created
attachment 168067
[details]
Patch
Justin Novosad
Comment 16
2012-10-10 13:59:59 PDT
Comment on
attachment 168067
[details]
Patch Fixed release build test failure caused by uninitialized m_taskObserverActive in Canvas2DLayerManager
Stephen White
Comment 17
2012-10-10 14:00:57 PDT
Comment on
attachment 168067
[details]
Patch Looks good (bots willing). r=me
WebKit Review Bot
Comment 18
2012-10-10 19:05:13 PDT
Comment on
attachment 168067
[details]
Patch Clearing flags on attachment: 168067 Committed
r130994
: <
http://trac.webkit.org/changeset/130994
>
WebKit Review Bot
Comment 19
2012-10-10 19:05:17 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug