-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Migrate rendering plugins to SurfaceProducer after stable release #139702
Copy link
Copy link
Closed
flutter/packages
#6989Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.e: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.fyi-androidFor the attention of Android platform teamFor the attention of Android platform teamfyi-ecosystemFor the attention of Ecosystem teamFor the attention of Ecosystem teamplatform-androidAndroid applications specificallyAndroid applications specificallyteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.e: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.fyi-androidFor the attention of Android platform teamFor the attention of Android platform teamfyi-ecosystemFor the attention of Ecosystem teamFor the attention of Ecosystem teamplatform-androidAndroid applications specificallyAndroid applications specificallyteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
tl;dr:
SurfaceTextureAPI in Impeller (on Android with Vulkan)SurfaceTextureis not a desirable integration point (based on talking to the Android team directly)Background
The Flutter engine on Android supports two external rendering sources,
SurfaceTexture123 (an OpenGLES texture) andImageReader456 (a GPU-ready buffer).Image.getHardwareBuffer, which is used by ourImageReader-based code path, is only supported on newer Android API versions (API level 28).In Impeller, for the first time, we'll support Vulkan, starting at Android API version 29, over OpenGLES (all Flutter Android apps currently use Skia, which in turn uses OpenGLES). Unfortunately, it's non-trivial to use an OpenGLES texture (
SurfaceTexture) in Vulkan, and after some internal discussion with the Android team, we've come to the conclusion thatSurfaceTextureis not the right integration point in general.I did a quick scan of usage of
(create|register)SurfaceTexture, both internally and externally:org: flutter, we have about 17 usagesProposal
We'll add a new, parallel API/extension point, i.e.
(create|register)Surface7. Similar to our platform view mechanics, we'll transparently either useSurfaceTexture(on older devices) orImageReader(on newer devices), and end-users (users that consume plugins that use(create|register)Surfacewill not have to do or configure anything.Timeline
(create|register)Surface, which delegates (internally) toSurfaceTextureorImageReaderorg: flutterplugins and examples(create|register)SurfaceTexture. In Impeller, issue a warning at runtime if it is used (Proposal: Decide what parts of the Java embedder rendering APIs to deprecate #148557)ERRORinstead of anINFOfor a non-working API. engine#52892)(create|register)SurfaceTextureentirelyTesting Strategy
Our ability to run comprehensive Android device tests in the engine repository is very limited (as of 2023-12-06):
@johnmccutchan coincidentally has a napkin-math proposal to improve the state of Android platform testing, which is critical for stability of our Android platform views and plugins. As necessary I plan to pair with him to iron out that proposal, land it, and then consume whatever infrastructure we built out/refactor out to also test our
(create|register)SurfaceAPI.Some scenarios will include:
ImageReader)/cc @dnfield @jonahwilliams @gaaclarke @johnmccutchan @reidbaker
Footnotes
android.graphics.SurfaceTexture↩surface_texture_external_texture.h↩platform_view_android.cc↩android.media.ImageReader↩image_external_texture.h↩platform_view_android.cc↩android.view.Surface↩