Bug 158933

Summary: [iOS][WK2] When an animation frame is missed, the UI process should immediately notify the Web process once a frame is committed
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: AnimationsAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dino, simon.fraser, thorton
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Said Abou-Hallawa
Reported 2016-06-20 00:52:39 PDT
When a frame is committed, the UI process schedules a CADisplayLink and waits until the next didRefreshDisplay event is fired. This causes more delay in the scenario where there are frames are dropped. didRefreshDisplay() should be called immediately when commitLayerTree message is received and the last frame was dropped. The fix is to have the CADisplayLink active all the times. It should be paused only when we detect at least one frame is dropped. In this case we should not send a message to the UI process since it has not sent the last requested LayerTree. Also we should not waste the CPU time by scheduling a new CADisplayLink since we have not processed the last event. We should resume CADisplayLink timer once a commitLayerTree message is received. We are going to introduce the state variable m_didUpdateMessageState to RemoteLayerTreeDrawingAreaProxy whose value is one of the following: { NotSent, Sent, MissedCommit }. Here is its state table. The only events that affect its value are commitLayerTree() and didRefreshDisplay() CurrentValue commitLayerTree didRefreshDisplay NotSent NotSent Sent (message is sent to the WebProcess) Sent NotSent MissedCommit (no message is sent and the CADisplayLink is paused) MissedCommit NotSent (call didRefreshDisplay()) MissedCommit (no message)
Attachments
Patch (5.46 KB, patch)
2016-06-20 01:00 PDT, Said Abou-Hallawa
no flags
Patch (4.14 KB, patch)
2016-06-21 12:20 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2016-06-20 01:00:55 PDT
Tim Horton
Comment 2 2016-06-20 10:31:51 PDT
Comment on attachment 281637 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281637&action=review > Source/WebKit2/ChangeLog:30 > + * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h: > + * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: > + (-[WKOneShotDisplayLinkHandler pause]): > + (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): > + (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): > + (-[WKOneShotDisplayLinkHandler displayLinkFired:]): Deleted. > + * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm: > + (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush): > + We should clear the graphics contexts when the drawing layers are flushed > + in the commitQueue thread instead of delaying this to be done in the main > + thread when the old m_pendingBackingStoreFlusher is released. This should probably happen in a different patch so we can separate the performance impact of the two unrelated changes.
Said Abou-Hallawa
Comment 3 2016-06-20 13:25:53 PDT
Said Abou-Hallawa
Comment 4 2016-06-21 12:20:54 PDT
Said Abou-Hallawa
Comment 5 2016-06-21 12:22:44 PDT
Comment on attachment 281637 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281637&action=review >> Source/WebKit2/ChangeLog:30 >> + thread when the old m_pendingBackingStoreFlusher is released. > > This should probably happen in a different patch so we can separate the performance impact of the two unrelated changes. This part was removed but I did not notice much difference in MotionMark score between adding it or removing it. So I am mot sure if it is worth adding it a separate patch even.
Said Abou-Hallawa
Comment 6 2016-06-21 12:32:44 PDT
This patch shows 8% progression in MotionMark score on iPad Air.
WebKit Commit Bot
Comment 7 2016-06-21 13:53:55 PDT
Comment on attachment 281768 [details] Patch Clearing flags on attachment: 281768 Committed r202291: <http://trac.webkit.org/changeset/202291>
WebKit Commit Bot
Comment 8 2016-06-21 13:53:59 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.