Unified BeginFrame
Simon Hong & Tim Ansell
NAVER Labs &
Chrome Scheduling Team
Who are we?
Tim 'mithro' Ansell
This talk will include
Background
How do displays work?
How do displays work?
How do displays work?
How do displays work?
vsync
vertical retraces
vertical blank interval
vsync
How do displays work?
Further reading
BeginFrame
What is it and why do I care?
What is a BeginFrame message?
Layout
Composite
time
BeginFrame
arrives
Paint
JS
BeginFrame
arrives
JS
vsync period
Why are BeginFrames needed?
vsync
vsync
BeginFrame
VS.
Why are BeginFrames needed?
When are BeginFrames needed?
How are BeginFrames used?
How are BeginFrames used?
main thread
impl thread
ImplFrame
MainFrame
time
ImplFrame
BeginImplFrame
BeginImplFrame
commit
BeginMainFrame
MainFrame
What does a BeginFrame contain?
main thread
impl thread
ImplFrame
MainFrame
time
BeginImplFrame
commit
BeginMainFrame
Draw
Activate
BeginFrame.
Deadline
BeginMainFrame.
Deadline
BeginFrame
swap
Vsync
Unified BeginFrame API
XXXXXBeginFrameSource
BeginFrameSource
SetNeedsBeginFrame()
DidFinishFrame()
Add/Remove observer()
Timer
BeginFrameObserver
Scheduler
BeginFrameSource
SchedulerClient
BeginFrameObserver
OnBeginFrame()
LastUsedBeginFrameArgs()
SchedulerClient
ScheduledActionSendBeginMainFrame()
ScheduledActionCommit()
ScheduledActionAnimate()
...
CC
Where do BeginFrames originate?
BeginFrame
Request “Please draw me pixels”
with Common abstract API
Unified BeginFrame Scheduling
What is it and why do I care?
&
VSync Aligned Input
What is it and why do I care?
BeginFrame Scheduling
Browser process
Renderer process
BeginFrame message
State of BeginFrame Scheduling
Unified BeginFrame Scheduling!
The problem
The problem
ImplFrame
vsync
BeginFrame message
MainFrame
Input
vsync
Draw
Input handling
ImplFrame
MainFrame
Draw
BeginFrame message
Input
main thread
impl thread
vsync-unaligned input handling
Android Solution
Android Solution in Chrome
java
c++
Input
vsync
Content layer
Compositor
Browser
Renderer
1
2
External BFS
BeginFrame generator
The improvement
Input handling
ImplFrame
Input
MainFrame
Input
Input handling
ImplFrame
MainFrame
BeginFrame
BeginFrame
main thread
impl thread
Input
Input
Further reading about vsync scheduling in android (by @skyostil):
BeginImplFrame
Request BeginMainFrame
Draw
OnVSync
Handling
Gesture
Gesture
Scroll
Update
TouchEnd
BeginImplFrame
Handling
TouchEnd
BeginMainFrame
Gesture
Scroll
Update
OnVSync
Unified BeginFrame Scheduling
The effort to bring Android’s BeginFrame
handling to other platforms�
VSync Aligned Input
Using Unified BeginFrame Scheduling
to replicate Android's input model
Unified BeginFrame Scheduling
The effort to bring Android’s BeginFrame
handling to other platforms�
VSync Aligned Input
Using Unified BeginFrame Scheduling
to replicate Android's input model
BeginFrame
Implementation
How are we going to do this?
Lets start with Aura!
BeginFrame Scheduling on Aura
BeginFrame Scheduling on Aura
BeginFrame Scheduling on Aura
BeginFrame Scheduling on Aura
BeginFrame Scheduling on Aura
content layer
CC
ui::Compositor
BeginFrameSource
Scheduler
RWHVAura
Renderer
Renderer
Renderer
Browser
Renderers
BeginFrame Aligned Buffered Input handling on Aura
TODOs for BeginFrame Scheduling
The Future
What is next?
Unified Begin Frame enables new things
Unified Begin Frame enables new things
"things we have wanted for a long time but have been too hard"
Filtering / Improving VSync Signal
VSync information reported from OS has noise!
(Some platforms are better than others.)
Now have one place to fix it!
Output Time / "Glass Time"
It takes time to do work
Gave a talk at BlinkOn 2 in Zurich
Rendering for “Glass Time”
Surfaces Display Scheduler - WIP
"Surfaces are a concept to allow graphical embedding of heterogeneous untrusting clients efficiently into one scene."�
“Please render me stuff”
Surfaces Display Scheduler - WIP
Global Browser Level Scheduler
Global knowledge about focus and content
Enables more things!
Unified�BeginFrame
VSync Aligned Input
Glass Time
Output Time
Surfaces Display Scheduler
Partial Updates
Blink Scheduler
Jank Free Animations
Jank Free Input
Bad Actor
Sin Bin
Latency Recovery
Better Performance
Less
Memory Usage
?????
Motion Vectors
?????
Special thanks to
Brian C. Anderson <brianderson@chromium.org>
Jared Duke <jdduke@chromium.org>
Sami Kyöstilä <skyostil@chromium.org>
and many more!
Q&A
scheduler-dev@chromium.org