Reduce Android display latency by setting the desired frame timestamp - #6792
Open
shiumano wants to merge 4 commits into
Open
Reduce Android display latency by setting the desired frame timestamp#6792shiumano wants to merge 4 commits into
shiumano wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Display latency is reduced by two frames.
latency-before-after.mp4
I also checked using Perfetto, the official Android profiling tool.
(Trace coinfig: config.txtpb.txt)
Before
After
The meanings of each location are as follows:
①: The application has started rendering
②: The application has finished rendering
③: The frame to be composited has been selected
④: The frame has been displayed on the screen
I haven't addressed the time taken for the ①→② step this time; please disregard it, as it varies significantly depending on the situation.
The improvement made this time concerns the time taken for the ②→③ step.
Description of changes for ec1a4f5
After calling
eglPresentationTimeANDROID, VSync no longer worked as expected even with SwapInterval set to 1.Therefore, I implemented Choreographer as an alternative to VSync.
Details
By the way, Choreographer is extremely strict .
If the load increases even slightly, the frame rate immediately drops from 120fps to 60fps—far more drastically than with
SwapInterval(1).As it stands, I believe there are only a handful of devices capable of consistently maintaining 120fps with VSync.
Furthermore, unfortunately, 240fps results in less latency than 120fps with V-Sync.