Page MenuHomePhabricator

Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty, or if we skipped paints because of pending transactions, r=mstange,bas
ClosedPublic

Authored by smaug on Oct 13 2022, 11:40 AM.
Referenced Files
Unknown Object (File)
Apr 12 2025, 5:17 PM
Unknown Object (File)
Jan 10 2025, 11:52 AM
Unknown Object (File)
Jan 10 2025, 12:15 AM
Unknown Object (File)
Jan 9 2025, 9:23 PM
Unknown Object (File)
Jan 8 2025, 7:06 AM
Unknown Object (File)
Dec 31 2024, 9:13 PM
Unknown Object (File)
Oct 8 2024, 1:38 PM
Unknown Object (File)
Oct 13 2022, 7:56 PM
Subscribers

Details

Summary

There are (at least) two different cases leading to lower fps.
Motionmark seems to hit FinishedWaitingForTransaction() case rather often, but the testcase in the bug
hits the other case more often.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Lint Not Applicable
Unit
Tests Not Applicable
Build Status
Buildable 470682
Build 566433: arc lint + arc unit

Event Timeline

smaug created this revision.
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Oct 13 2022, 11:40 AM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
smaug updated this revision to Diff 634986.
smaug retitled this revision from WIP: Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty to WIP: Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty, or if we skipped paints because of pending transactions.
smaug edited the summary of this revision. (Show Details)

Doesn't seem to affect motionmark numbers on CI.

smaug requested review of this revision.Oct 14 2022, 7:48 AM
smaug retitled this revision from WIP: Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty, or if we skipped paints because of pending transactions to Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty, or if we skipped paints because of pending transactions.
smaug added inline comments.
layout/base/nsRefreshDriver.cpp
697

The idea here is just to push a normal priority task to the queue, and when it runs, trigger a refreshdriver tick if there aren't other tasks. This seems to be hit quite often.
This could be also implemented also in another level, closer to TaskController/Thread, so that in AfterProcessTask callback we'd check if there are other tasks to run.
But decided to keep this RefreshDriver scheduling code in one place and the implemented approach seems to work quite well in many cases.

2902

This is effectively backing out bug 1371668, but because DidComposite is now using control priority (and JS shouldn't run at that point), we want to dispatch a new runnable which uses vsync priority.
And because of that, it needs to do extra checks whether it still makes sense to trigger tick. CanDoCatchUpTick() happens to have the reasonable checks, so reusing it here. This is after another type of catch-up tick.

Bas reviewed bug 1371668, so might want to review this :)
Or mstange.

I couldn't see differences in motionmark numbers, but when profiling locally, the behavior was different, less idle time. And I manually verified the extra tick from nsRefreshDriver::FinishedWaitingForTransaction()
is hit rather often.

layout/base/nsRefreshDriver.cpp
2902

Also, the old code, before bug 1371668, didn't use information about the latest missing vsync, but passed wrong /now/ time to the Tick. This is trying to pass more reasonable value.

smaug retitled this revision from Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty, or if we skipped paints because of pending transactions to Bug 1778575, try to run a pending vsync asap if the main thread is otherwise empty, or if we skipped paints because of pending transactions, r=mstange,bas.
smaug edited the summary of this revision. (Show Details)
smaug edited the summary of this revision. (Show Details)
smaug edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Oct 18 2022, 2:32 PM

This revision requires a Testing Policy Project Tag to be set before landing. Please apply one of testing-approved, testing-exception-unchanged, testing-exception-ui, testing-exception-elsewhere, testing-exception-other. Tip: this Firefox add-on makes it easy!