Add a TexturePool class into layer caching
In order to reduce the risk of buffer allocations burning cycles during rendering, add a texture pool which preallocates a set of screen-sized buffers available for use for layer caching. This texture pool has some properties to ease implementation details: 1. Textures are allocated synchronously. It's not very hard to add asynchronous support, but that does add a bit of complexity and Android 12 is almost finalized. It's also not yet clear if asynchronous allocation is needed since we can just tune the min texture pool size so that more buffers are preallocated; although it is certainly more flexible if we're able to defer allocations off-thread. 2. The texture pool is soft-bounded. If needed additional textures may be allocated to allow for complex geometries, but beyond an upper bound any additional textures may be deallocated. 3. The texture pool only supports screen-sized buffers, so we don't allocate smaller scratch buffers to save on memory. However, typically layer caching only caches screen-sized buffers. This also means that if the display size changes, then the texture pool must be reallocated. Note that the "display size" really refers to the framebuffer size, not necessarily the app-visible display. Bug: 184860700 Test: builds, boots Test: libcompositionengine_test Change-Id: Ic084310bae2b41be49c2cfe9f8c5a20ff683d1ad
Loading
Please register or sign in to comment