Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore whether providing a pbuffer surface before the SurfaceView is available helps first frame latency #90835

Closed
dnfield opened this issue Sep 27, 2021 · 3 comments
Assignees
Labels
customer: money (g3) engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list platform-android Android applications specifically

Comments

@dnfield
Copy link
Contributor

dnfield commented Sep 27, 2021

Currently, the SurfaceView does not get a Surface until the Choreographer inflates the view in its first doFrame. On lower end devices, this can take a significant amount of time, and may be delaying signals to the running Dart code that could be used to prepare the drawing of an initial frame.

It may be worth providing a pbuffer surface until the actual on screen surface is available, so that the framework can start trying to do work earlier. One thing I still have to explore is how much this helps applications that try to rapidly draw something without doing much other initialization work, since the traces I'm currently looking at do a substantial amount of initialization work before trying to draw a frame. It may be that those are what really take the time rather than waiting for a surface to be available.

/cc @blasten @goderbauer @xster fyi

@dnfield dnfield added platform-android Android applications specifically engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list labels Sep 27, 2021
@dnfield dnfield self-assigned this Sep 27, 2021
@blasten
Copy link

blasten commented Sep 27, 2021

This dependency is blocking the rasterizer for sure:
https://github.com/flutter/engine/blob/ffdaa4bb54c148bfe36216bfe6eebe326f423aa3/shell/common/rasterizer.cc#L377

Does it block Dart too?

@dnfield
Copy link
Contributor Author

dnfield commented Nov 15, 2021

Our real problem here was tht we were blocking the platform thread on the UI thread (fixed in flutter/engine#29145). I was incorrectly assuming that creating a surfaceview was taking a long time.

@dnfield dnfield closed this as completed Nov 15, 2021
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer: money (g3) engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list platform-android Android applications specifically
Projects
None yet
Development

No branches or pull requests

3 participants