Bug 215745 - Throttling requestAnimation Frame to 30 FPS in low power mode on iOS 14 (but not iOS 13)
Summary: Throttling requestAnimation Frame to 30 FPS in low power mode on iOS 14 (but ...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Frames (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad Other
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-21 16:59 PDT by Sirong Chen
Modified: 2020-08-24 09:47 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sirong Chen 2020-08-21 16:59:10 PDT
Overview
We noticed that this FPS throttling behavior in low power mode is reproducible on iOS 14 beta 4, but not on iOS 13. We want to confirm whether this change on iOS 14 is feature or a bug.

Steps to Reproduce: 
On iOS 14 beta 4. Turning on the low power mode, the max threshold of requestAnimationFrame FPS will be 30. This behavior was not there on iOS 13.

Expected Results: 
Same to iOS 13, the FPS is not throttled.
Comment 1 Radar WebKit Bug Importer 2020-08-22 15:59:02 PDT
<rdar://problem/67625514>
Comment 2 Said Abou-Hallawa 2020-08-24 09:47:20 PDT
This is intentional. In fact the behavior in iOS 13 was a bug. Her is the history of the low power mode throttling:

1. In r213169, rAF was throttled to 30fps when low power mode is on.
2. In r244182, Page::updateRendering() step was introduced but this broke the low power mode throttling. It actually made it worse by having rAF runs at 90fps with Lowe power mode. This was happening because ScriptedAnimationController had a throttling timer which runs at 30fps and Page::updateRendering() uses DisplayRefreshMonitor which runs at 60fps. Running them both at the same time causes the 90fps bug.
3. In r261113, the low power mode throttling was fixed by removing ScriptedAnimationController throttling timer and having the DisplayRefreshMonitor of the Page::updateRendering() runs as 30fps.

Webkit and other browsers strive hard to achieve 60fps for rAF but it is not guaranteed. If the animation is really complex such that the frame is drawn in more than 16ms, rAF will be running lower than 60fps. A similar situation is when the device is busy, warm, or low in memory. Low power mode is an exceptional state of the device also in which WebKit is required to save power as much it can with expensive operations like animation. Running rAF with 30fps is a little bit rough but it is okay.