<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>234923</bug_id>
          
          <creation_ts>2022-01-06 07:31:39 -0800</creation_ts>
          <short_desc>REGRESSION (iOS 15 / r275792): rAF sometimes seems to lose connection to v-sync signal and runs at &lt; 60 fps</short_desc>
          <delta_ts>2022-07-11 03:29:01 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Canvas</component>
          <version>Safari 15</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=234913</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=235114</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=224395</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Taylor">simontaylor1</reporter>
          <assigned_to name="Simon Fraser (smfr)">simon.fraser</assigned_to>
          <cc>ap</cc>
    
    <cc>dino</cc>
    
    <cc>graouts</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1828607</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-01-06 07:31:39 -0800</bug_when>
    <thetext>On some navigations the rAF loop on iOS 15.2 runs at less than the v-sync rate.

The page below has a rAF callback that doesn&apos;t do anything apart from busy-loop for 8ms:
https://tango-bravo.net/webkit-bug-234303/raf_busyloop.html

This appears to be the behaviour, 100% reproducible from a clean start on iPhone 12 Pro and other iOS 15.2 devices (Safari killed, no tabs open, even cleared all data and rebooted first but this isn&apos;t necessary):

1) Visit this bugzilla page
2) Click the link above to the no-op demo page
3) Note rAF loop runs at 60 FPS
4) Back to this page
5) Click the link again (or another one on the same domain, eg https://tango-bravo.net/webkit-bug-234303/clear_color_cycle_busyloop.html )
6) Note rAF now runs at &lt;60 FPS. &lt;60FPS persists through refresh, background / foreground app switch, history navigation.
7) Kill Safari (still with tab open) and re-open. Back to 60 FPS.

It appears that the affected tab is somehow disconnected from the display v-sync signal, and instead waits ~16.6ms from the end of the previous rAF callback before triggering the following one (hence the whole loop running at &lt;60FPS).

Could it perhaps have something to do with content process isolation, when switching back to an existing content process from another domain? (I don&apos;t even know if WebKit does that but know it&apos;s a thing in Chrome)

Copying/pasting the URL from a &lt;60FPS tab into a new one also gets 60FPS, so seems something to do with the Tab &amp; Domain combo that is affected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829159</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-01-07 17:50:44 -0800</bug_when>
    <thetext>Thank you for the report! Could you please confirm if this issue is new in iOS 15.x, or if it affected earlier versions too?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1830173</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-01-12 09:36:05 -0800</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #1)
&gt; Thank you for the report! Could you please confirm if this issue is new in
&gt; iOS 15.x, or if it affected earlier versions too?

I think it&apos;s a 15.x regression - I can&apos;t reproduce on a 14.8.1 iPhone 12 mini.

100% reproducible on iPhone 12 Pro and iPod touch 7th gen, both on 15.2. I don&apos;t have any devices on other 15.x releases I&apos;m afraid.

In terms of relation to Bug 235114 - they are distinct, but both hinting at issues on tabs becoming foregrounded.

If you go back and forth to the demo on that page, you can repro this bug too. Note in &quot;normal&quot; case the rAF loop is &lt; 60 FPS on the Bug 235114 demo page though - that&apos;s on purpose to trigger high clocks and keep the CPU busy. So that demo is typically 50 FPS unless this bug is also in play, when it&apos;ll drop to 25 FPS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1830183</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-01-12 09:56:55 -0800</bug_when>
    <thetext>&lt;rdar://problem/87465488&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1830502</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-01-13 03:09:24 -0800</bug_when>
    <thetext>&gt; (In reply to Alexey Proskuryakov from comment #1)
&gt; &gt; Thank you for the report! Could you please confirm if this issue is new in
&gt; &gt; iOS 15.x, or if it affected earlier versions too?
&gt; 
&gt; I think it&apos;s a 15.x regression - I can&apos;t reproduce on a 14.8.1 iPhone 12
&gt; mini.
&gt; 
&gt; 100% reproducible on iPhone 12 Pro and iPod touch 7th gen, both on 15.2. I
&gt; don&apos;t have any devices on other 15.x releases I&apos;m afraid.

It does also reproduce on the 15.0 Simulator if that helps narrow things down at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1842206</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-02-16 02:53:10 -0800</bug_when>
    <thetext>Still reproduces easily in iOS 15.4 beta 3, iPhone 12 Pro.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1846596</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-02-28 04:07:17 -0800</bug_when>
    <thetext>Still with us on 15.4 beta 4 (verified on iPod touch 7th gen).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1853177</commentid>
    <comment_count>7</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2022-03-21 07:10:05 -0700</bug_when>
    <thetext>RemoteLayerTreeDisplayRefreshMonitor::requestRefreshCallback() returns false because there is no m_drawingArea. As a result RenderingUpdateScheduler::scheduleRenderingUpdate() falls back to using a timer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1853283</commentid>
    <comment_count>8</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2022-03-21 12:09:35 -0700</bug_when>
    <thetext>This regressed with r275792, the fix for bug 224395.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1880904</commentid>
    <comment_count>9</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-07-05 22:11:02 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/2113</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881122</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-07-06 14:36:13 -0700</bug_when>
    <thetext>Committed 252188@main (0842b6a96626): &lt;https://commits.webkit.org/252188@main&gt;

Reviewed commits have been landed. Closing PR #2113 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881605</commentid>
    <comment_count>11</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-07-08 02:42:25 -0700</bug_when>
    <thetext>Great, thanks for the fix.

Another potential related issue that was much harder to reproduce - occasionally when initially viewing a tab (I commonly access pages via QR scans in the camera, and often from the same domain) I&apos;ve seen it look like it&apos;s being actively throttled with a lower rAF rate - almost as if Webkit considers the tab to be a background one.

Looking at the commit message (with a very limited understanding) - is it possible the same underlying bug might have caused this behaviour?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881689</commentid>
    <comment_count>12</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-07-08 10:14:59 -0700</bug_when>
    <thetext>It&apos;s possible, but if you can figure out steps to reproduce this reliably I can test it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1882039</commentid>
    <comment_count>13</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2022-07-11 03:29:01 -0700</bug_when>
    <thetext>I wasn&apos;t able to find reproduction steps last time I tried - it might be that Safari needs to have been idle for a while with some particular state of open tabs to trigger it, or it might just be something timing related that makes it not very reproducible anyway.

Once this fix ships in an iOS release I&apos;ll keep my eye out for it.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>