Only cache framebuffers for internal displays for drawLayers.
Currently SkiaGlRenderEngine leaks memory when virtual displays are created and destroyed because their output buffers are cached into a texture and then never evicted. The simplest workaround which is implemented in this patch is to never cache framebuffers for virtual displays; we only cache when driving internal displays. On phones, there is usually one primary internal display and that display is never destroyed, so this assumption is safe for the majority of phone form factors. In the very near future we should remove this assumption by changing the RenderEngine interface to take in a struct that manages GPU textures on creation and destruction so that SurfaceFlinger can maintain its own cached set, but that change is longer than a few lines of code, which motivates this patch. Bug: 178539829 Test: builds, boots Change-Id: I8e501d297090b6f5056a0b0ead598f85bb4b9f07
Loading
Please register or sign in to comment