-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
We should be able to create an ASurfaceControl from the ANativeWindow, and use that ASurfaceControl to create one or more ASurfaceTransactions that set an AHardwareBuffer to them (using ASurfaceTransaction_setBuffer).
This should replace the current swapchain implementation on Vulkan - we'd have to wrap the AHardwareBuffers into whatever Vulkan objects (I assume a VkImage?) that get used by the rest of Impeller.
This gives us a few more knobs that aren't available in the straight Vulkan APIs:
- Better HDR support (not 100% clear on how but it's in the docs).
- Set a completion callback that gives us stats
- Some more methods we could try to use to handle cases where we submit two frames in a single vsync, e.g. https://developer.android.com/ndk/reference/group/native-activity#asurfacetransaction_setframetimeline and https://developer.android.com/ndk/reference/group/native-activity#asurfacetransaction_setdesiredpresenttime and https://developer.android.com/ndk/reference/group/native-activity#asurfacetransaction_setenablebackpressure
In theory it could help as well since we'll be talking directly to surfaceflinger with this API rather than going through whatever the Vulkan driver is doing. These APIs are all 29+, but we're already restricting Vulkan on Impeller to 29+ anyway.
This last part is what I think will give us better integration with Android native tracing capabilities.