RESOLVED FIXED 94719
[Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer.
https://bugs.webkit.org/show_bug.cgi?id=94719
Summary [Chromium] Unnecessary delay when starting to update resources with an inacti...
David Reveman
Reported 2012-08-22 09:29:32 PDT
We're calling CCDelayBasedTimeSource::nextTickTime() before the timer is activated and nextTickTime() then returns 0.
Attachments
Patch (1.76 KB, patch)
2012-08-22 09:32 PDT, David Reveman
no flags
Patch (2.52 KB, patch)
2012-08-22 13:10 PDT, David Reveman
no flags
Patch (7.46 KB, patch)
2012-08-22 14:59 PDT, David Reveman
no flags
Patch (8.98 KB, patch)
2012-08-22 15:29 PDT, David Reveman
no flags
David Reveman
Comment 1 2012-08-22 09:32:46 PDT
Created attachment 159953 [details] Patch Simple fix. It might be more appropriate to re-factor CCScheduler to not call nextTickTime() on an inactive timer
Nat Duca
Comment 2 2012-08-22 10:03:09 PDT
Comment on attachment 159953 [details] Patch I like this. @brianderson?
David Reveman
Comment 3 2012-08-22 11:52:56 PDT
Increasing priority as this bug is causing animations driven of requestAnimationFrame to run at half of the nominal frame rate.
James Robinson
Comment 4 2012-08-22 12:18:31 PDT
This seems OK. The complexity here is getting scary. Is there any way we could have caught this regression more directly? I think Brian should take a look but we should land ASAP to get coverage back on the perf bots downstream.
Brian Anderson
Comment 5 2012-08-22 12:44:01 PDT
I'm fine with getting this in, but would like to change it eventually, since it's lying about what the next tick time actually is. Also, the behavior for nextTickTime becomes intertwined with specific use cases of CCScheduler, which is only okay for now because CCDelayBasedTimeSource isn't used in many places. Note: There is a comment in CCDelayBasedTimeSource.h indicating nextTickTime will return 0 if not active. That comment should be changed to reflect the new behavior.
Brian Anderson
Comment 6 2012-08-22 12:59:27 PDT
Comment on attachment 159953 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=159953&action=review > Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp:107 > + return monotonicTimeNow() + m_currentParameters.interval; jbates brought up a good point that this fake time will not be vsync aligned. Could this cause the texture uploading to run long and prevent us from going active again ASAP?
David Reveman
Comment 7 2012-08-22 13:10:01 PDT
(In reply to comment #6) > (From update of attachment 159953 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=159953&action=review > > > Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp:107 > > + return monotonicTimeNow() + m_currentParameters.interval; > > jbates brought up a good point that this fake time will not be vsync aligned. Could this cause the texture uploading to run long and prevent us from going active again ASAP? It looks to me as if tickTarget always becomes "now + interval" when the timer goes from inactive to active state. Maybe I'm missing something?
David Reveman
Comment 8 2012-08-22 13:10:16 PDT
Created attachment 159996 [details] Patch Move comment to header
David Reveman
Comment 9 2012-08-22 13:17:14 PDT
(In reply to comment #5) > I'm fine with getting this in, but would like to change it eventually, since it's lying about what the next tick time actually is. Also, the behavior for nextTickTime becomes intertwined with specific use cases of CCScheduler, which is only okay for now because CCDelayBasedTimeSource isn't used in many places. Would changing CCScheduler so that it always activates the timer before calling nextTickTime() be enough? > > Note: There is a comment in CCDelayBasedTimeSource.h indicating nextTickTime will return 0 if not active. That comment should be changed to reflect the new behavior. Fixed in latest patch.
Brian Anderson
Comment 10 2012-08-22 13:45:14 PDT
> It looks to me as if tickTarget always becomes "now + interval" when the timer goes from inactive to active state. Maybe I'm missing something? There is some additional logic in CCDelayBasedTimeSource::postNextTickTask that aligns "now" to the nearest vsync when the timer is activated. > Would changing CCScheduler so that it always activates the timer before calling nextTickTime() be enough? That would prevent us from lying and would also automatically align nextTickTime to a vsync. We would end up with ticks that are no-ops, but the overhead should be negligible. Sounds like a good trade off to me.
Nat Duca
Comment 11 2012-08-22 14:19:20 PDT
Recapping verbal discussion, how about reusing the lastTickTime of the DBTS?
David Reveman
Comment 12 2012-08-22 14:59:56 PDT
Created attachment 160016 [details] Patch Add nextTickTimeIfActivated and use postNextTickTask logic determine tick target when inactive
WebKit Review Bot
Comment 13 2012-08-22 15:10:36 PDT
Comment on attachment 160016 [details] Patch Attachment 160016 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13561421
David Reveman
Comment 14 2012-08-22 15:29:51 PDT
Created attachment 160021 [details] Patch Fix unit test and ASSERT in postNextTickTask
Brian Anderson
Comment 15 2012-08-22 16:02:01 PDT
Comment on attachment 160021 [details] Patch New version looks good. It returns a vsync aligned timestamp, the function name doesn't lie about what it's doing, and it doesn't spuriously activate ticking.
WebKit Review Bot
Comment 16 2012-08-23 08:42:11 PDT
Comment on attachment 160021 [details] Patch Clearing flags on attachment: 160021 Committed r126431: <http://trac.webkit.org/changeset/126431>
WebKit Review Bot
Comment 17 2012-08-23 08:42:15 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.