Bug 223847 - Plumb DisplayUpdate through the display refresh monitors
Summary: Plumb DisplayUpdate through the display refresh monitors
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-27 21:08 PDT by Simon Fraser (smfr)
Modified: 2021-03-29 10:21 PDT (History)
16 users (show)

See Also:


Attachments
Patch (51.18 KB, patch)
2021-03-27 21:23 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (51.77 KB, patch)
2021-03-27 22:07 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (51.77 KB, patch)
2021-03-27 23:19 PDT, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (51.78 KB, patch)
2021-03-27 23:38 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (51.78 KB, patch)
2021-03-28 08:53 PDT, Simon Fraser (smfr)
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-03-27 21:08:23 PDT
Plumb DisplayUpdate through the display refresh monitors
Comment 1 Simon Fraser (smfr) 2021-03-27 21:23:16 PDT
Created attachment 424480 [details]
Patch
Comment 2 Simon Fraser (smfr) 2021-03-27 22:07:25 PDT
Created attachment 424481 [details]
Patch
Comment 3 Simon Fraser (smfr) 2021-03-27 23:19:32 PDT
Created attachment 424482 [details]
Patch
Comment 4 Simon Fraser (smfr) 2021-03-27 23:38:23 PDT
Created attachment 424483 [details]
Patch
Comment 5 Simon Fraser (smfr) 2021-03-28 08:53:57 PDT
Created attachment 424498 [details]
Patch
Comment 6 Sam Weinig 2021-03-28 15:06:02 PDT
Comment on attachment 424498 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424498&action=review

> Source/WebCore/ChangeLog:15
> +        that's that's necessary for downstream clients.

that's that's -> that's

> Source/WebKit/ChangeLog:15
> +        the highest possible frequency; at various stages of propagation the rate might be halved if
> +        that's that's necessary for downstream clients.

that's that's -> that's

> Source/WebKit/ChangeLog:18
> +        To make this frequency splitting logic simple, this patch introduces DisplayUpdate, which
> +        represents the fractional second for the current update. The numerator is the frame index,

The first sentence here is a bit confusing here: "...DisplayUpdate, which represents the fractional second for the current update". It seems more like "DisplayUpdate represents an update of the display, and contains data about it in the form of ...", is that correct?

> Source/WebCore/platform/graphics/DisplayUpdate.h:46
> +    void didUpdate()
> +    {
> +        updateIndex = (updateIndex + 1) % updatesPerSecond;
> +    }

I think this would be a bit more easy to understand if this returned a new DisplayUpdate and was called something like nextUpdate(). That way we could treat these as immutable values, which is a bit easier to think about.

> Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm:40
> +constexpr WebCore::FramesPerSecond DisplayLinkFramesPerSecond = 60;

Should this be named something like preferredDisplayLinkFramesPerSecond or maximumDisplayLinkFramesPerSecond? It's a bit sad this is hard coded here and not something more configurable per-page.

> Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:46
> +    const DisplayUpdate& currentUpdate() const { return m_currentUpdate; }

I think this could just return DisplayUpdate, rather than a reference, give how small it is.
Comment 7 Radar WebKit Bug Importer 2021-03-29 09:40:55 PDT
<rdar://problem/75958114>
Comment 8 Simon Fraser (smfr) 2021-03-29 10:07:52 PDT
(In reply to Sam Weinig from comment #6)
> Comment on attachment 424498 [details]

> > Source/WebCore/platform/graphics/DisplayUpdate.h:46
> > +    void didUpdate()
> > +    {
> > +        updateIndex = (updateIndex + 1) % updatesPerSecond;
> > +    }
> 
> I think this would be a bit more easy to understand if this returned a new
> DisplayUpdate and was called something like nextUpdate(). That way we could
> treat these as immutable values, which is a bit easier to think about.

Done.

> > Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm:40
> > +constexpr WebCore::FramesPerSecond DisplayLinkFramesPerSecond = 60;
> 
> Should this be named something like preferredDisplayLinkFramesPerSecond or
> maximumDisplayLinkFramesPerSecond? It's a bit sad this is hard coded here
> and not something more configurable per-page.

DisplayRefreshMonitorIOS is only used in UIWebView so I think is OK to hardcode 60.

> 
> > Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.h:46
> > +    const DisplayUpdate& currentUpdate() const { return m_currentUpdate; }

Was unused, so I removed it.
Comment 9 Tim Horton 2021-03-29 10:20:29 PDT
(In reply to Simon Fraser (smfr) from comment #8)
> (In reply to Sam Weinig from comment #6)
> > Comment on attachment 424498 [details]
> > > Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm:40
> > > +constexpr WebCore::FramesPerSecond DisplayLinkFramesPerSecond = 60;
> > 
> > Should this be named something like preferredDisplayLinkFramesPerSecond or
> > maximumDisplayLinkFramesPerSecond? It's a bit sad this is hard coded here
> > and not something more configurable per-page.
> 
> DisplayRefreshMonitorIOS is only used in UIWebView so I think is OK to
> hardcode 60.

Maybe you should Legacy- this one like you did the WebView one?
Comment 10 Simon Fraser (smfr) 2021-03-29 10:21:50 PDT
Too late :P

https://trac.webkit.org/changeset/275163/webkit