Bug 211482 - Re-enable 'OutsideViewport' rAF throttling
Summary: Re-enable 'OutsideViewport' rAF throttling
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-05 19:36 PDT by Said Abou-Hallawa
Modified: 2020-05-13 16:28 PDT (History)
7 users (show)

See Also:


Attachments
Patch (6.54 KB, patch)
2020-05-05 19:45 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (12.99 KB, patch)
2020-05-06 15:45 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (13.79 KB, patch)
2020-05-06 19:12 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2020-05-05 19:36:42 PDT
The OutsideViewport throttling was not implemented in r261113. It has been disabled since r242624 because the RenderingUpdate is currently serving the rAF callbacks with its speed regardless the rAF is throttled or not. The goal of the OutsideViewport throttling to save power by stoping calling the rAF callbacks of any <iframe> which is outside the viewport.
Comment 1 Said Abou-Hallawa 2020-05-05 19:45:18 PDT
Created attachment 398578 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2020-05-06 10:54:05 PDT
<rdar://problem/62937165>
Comment 3 Said Abou-Hallawa 2020-05-06 11:21:30 PDT
These two tests fail consistently with this patch.

webgl/2.0.0/conformance/canvas/rapid-resizing.html
webgl/2.0.0/conformance2/rendering/canvas-resizing-with-pbo-bound.html

These conformance tests are run by putting the test itself inside an <iframe> element. The script of the test relies on calling requestAnimationFrame() multiple times.

The problem is the <iframe> in these tests are outside the viewport of the test window (800x600). Because the patch throttles the OutsideViewport rAF for 10 seconds, the rAF callback is called only every 10 seconds. And this is why they time out.
Comment 4 Said Abou-Hallawa 2020-05-06 13:30:15 PDT
Possible solutions:

1. Add an internal setting to enable the 'OutsideViewport' rAF throttling. This setting will be on by default but it will be disabled for DRT and WTR. The new test which is attache here will enable it through Internals.setOutsideViewportThrottlingEnabled().

2. Throttle rAF only for 3rd party <iframe> which is will be cross origin. But do not throttle rAF for 1st party <iframe> which will be same origin.

3. Adjust these tests to show the <iframe> even if partially.
Comment 5 Said Abou-Hallawa 2020-05-06 15:45:22 PDT
Created attachment 398675 [details]
Patch
Comment 6 Said Abou-Hallawa 2020-05-06 19:12:21 PDT
Created attachment 398697 [details]
Patch
Comment 7 Simon Fraser (smfr) 2020-05-07 10:23:20 PDT
(In reply to Said Abou-Hallawa from comment #4)
> Possible solutions:
> 
> 1. Add an internal setting to enable the 'OutsideViewport' rAF throttling.
> This setting will be on by default but it will be disabled for DRT and WTR.
> The new test which is attache here will enable it through
> Internals.setOutsideViewportThrottlingEnabled().

This one.
Comment 8 Said Abou-Hallawa 2020-05-07 21:03:26 PDT
(In reply to Simon Fraser (smfr) from comment #7)
> (In reply to Said Abou-Hallawa from comment #4)
> > Possible solutions:
> > 
> > 1. Add an internal setting to enable the 'OutsideViewport' rAF throttling.
> > This setting will be on by default but it will be disabled for DRT and WTR.
> > The new test which is attache here will enable it through
> > Internals.setOutsideViewportThrottlingEnabled().
> 
> This one.

It is implemented in the attached patch.
Comment 9 EWS 2020-05-13 16:28:39 PDT
Committed r261663: <https://trac.webkit.org/changeset/261663>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 398697 [details].