Bug 208709 - Break out of timer loop on display refresh
Summary: Break out of timer loop on display refresh
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-06 05:52 PST by Antti Koivisto
Modified: 2020-03-06 07:58 PST (History)
2 users (show)

See Also:


Attachments
wip (13.02 KB, patch)
2020-03-06 05:54 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2020-03-06 05:52:13 PST
We currently process timers for 50ms in a loop. We should break out immediately when there is a display refresh to allow rendering update.
Comment 1 Antti Koivisto 2020-03-06 05:54:39 PST
Created attachment 392711 [details]
wip
Comment 2 Simon Fraser (smfr) 2020-03-06 07:58:44 PST
Comment on attachment 392711 [details]
wip

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

> Source/WebCore/platform/ThreadTimers.cpp:129
> +        if (DisplayRefreshMonitorManager::sharedManager().hasPendingRefresh() && !m_didBreakForPendingDisplayRefreshWithoutFiringTimers) {

It's a bit gross for timers to know about DisplayRefreshMonitorManager, and we need something that works on iOS too.

> Source/WebCore/platform/graphics/DisplayRefreshMonitor.h:86
> +    WEBCORE_EXPORT void setIsPreviousFrameDone(bool);

I presume this is WEBCORE_EXPORT just to satisfy the linker, not because anyone else calls it (because it doesn't lock).

> Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp:250
> +    DisplayRefreshMonitorManager::sharedManager().displayWasUpdated(displayID);

Which thread are we on here?

DisplayRefreshMonitorManager::displayWasUpdated() doesn't look thread safe.