summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/ClientCache.h
AgeCommit message (Collapse)Author
2023-08-10Update BUFFER_CACHE_MAX_SIZE Patrick Williams
Bug: 293398212 Test: presubmits Change-Id: I4d82ebacc8ef7c2ae32c61f40720082aa0af6941
2022-12-09Push HWC cache slot generation down into CompositionEngine Brian Lindahl
Stop caching buffers inside SurfaceFlinger and remove the tight coupling between SurfaceFlinger's ClientCache and the Hardware Composer cache. This allows a better seperation of responsibility, where buffer cache management is not split between HwcSlotGenerator and HwcBufferCache, but is instead solely handled by HwcBufferCache. Note that FramebufferSurface and VirtualDisplaySurface no longer use HwcBufferCache, but instead use their own cache slot management that is solely based on BufferQueue slot numbers. Also do minor refactoring in FramebufferSurface to simplify code. Bug: 258196272 Test: started and stopped multiple YouTube videos on adt4 and verified no change in graphic buffer usage Test: atest HwcBufferCacheTest Test: atest OutputPrepareTest Change-Id: Ica7955ab4bc70e3c70207390e36dff73a2fc4949
2022-10-20SF: Trigger ANR when buffer cache is full Patrick Williams
* Updates the transaction queue stall listener to take a string that contains the reason for hanging. * Updates ClientCache::add to indicate whether or not a failure is due to the cache being full * Calls the transaction queue stall listener when the ClientCache is full Bug: 244218818 Test: presubmits Change-Id: I5fdc9aef0f0a1601ace1c42cfac5024c3de8d299
2021-04-16Revert "Revert "Add ExternalTexture class into RenderEngine inte..." Alec Mouri
Revert submission 14199598-revert-14086921-renderengine-external-tex-QJNBWQMQEU Reason for revert: Prepare for relanding Reverted Changes: I01e65a7f4:Revert "Update WaylandRenderSurface to accomodate ... I7d58118c1:Revert "Update Readback VTS to align with RenderEn... I1501890f4:Revert "Add ExternalTexture class into RenderEngin... Added the following fixes: 1. CachedSet renders to intermediate texture variable rather than mTexture directly, since mTexture is not guaranteed to be nonnull. 2. Add null check when setting new buffer in BLAST. Bug: 185524947 Bug: 180767535 Test: builds, boots Test: librenderengine_test Change-Id: I52ea82e24336b496d996bbe3e445db0affe1abb8
2021-04-15Revert "Add ExternalTexture class into RenderEngine interface" Alec Mouri
Revert submission 14086921-renderengine-external-tex Reason for revert: Potential culprit for b/185361988 Reverted Changes: I7796764e2:Update WaylandRenderSurface to accomodate interfac... I13904eec4:Update Readback VTS to align with RenderEngine int... I222c71e6e:Add ExternalTexture class into RenderEngine interf... Change-Id: I1501890f4861a3df7ce273f1fe2ccdb275e2632c
2021-04-13Add ExternalTexture class into RenderEngine interface Alec Mouri
ExternalTexture is an RAII structure that wraps raw GraphicBuffers that are passed into RenderEngine. ExternalTexture's role is to help with managing GPU resources of GraphicBuffers by mapping buffers into textures, EGLImages, or AutoBackendTextures depending on the RenderEngine backend. Under the hood, mapExternalTextureBuffer and unmapExternalTextureBuffer (renamed from cacheExternalTextureBuffer and unbindExternalTextureBuffer respectively) are used to help tie resource management to the ExternalTexture lifetime. The main motivation for this is that currently managing buffer lifecycle has historically been errorprone and caused memory leaks, so this improves code health. As part of this: * mapExternalTextureBuffer and unmapExternalTextureBuffer are now protected methods, and are never called outside of RenderEngine with the exception of creating and destroying ExternalTextures. * Because GLESRenderEngine's output buffers are cached differently from Skia RenderEngine, if there are output-only buffers then disable the mapExternalTextureBuffer calls whenever GLESRenderEngine is used. * Custom RAII classes in the Planner and in BufferLayerConsumer are now removed since they're subsumed by ExternalTexture * RenderSurface now controls its own management of ExternalTextures in a small queue * cleanFramebufferCache is now unimplemented for Skia, because ExternalTextures are now deleted whenever a RenderSurface is deleted. Bug: 180767535 Test: libsurfaceflinger_unittest Test: libcompositionengine_test Test: librenderengine_test Test: Simulate virtual displays Test: Screen reotation Test: Movie playback on Google TV Test: Force GPU composition Test: screenshot Change-Id: I222c71e6e1c67485cdeac49e2cb829289af9efec
2021-02-16SurfaceFlinger: Add ClientCache dumps Robert Carr
Can be useful in debugging buffer leaks. Bug: 176691195 Test: Existing tests pass Change-Id: I8b318f272a7da3dde76d9153b21ced94127f0d8b
2019-11-19Keeping sp<IBinder> around in ClientCache Valerie Hau
binderDied is no longer called if all sp references are dropped in SF process. Keep an sp<IBinder> around so that we can get notified to clean up the ClientCache/RenderEngine Bug: b/144371238 Test: build, boot, manual (script to open and close Chrome repeatedly, check RenderEngine image cache size in dumpsys), SurfaceFlinger_test, libsurfaceflinger_unittest Change-Id: Ib9374c02db59e09ca53280acc64419bda6827a4d
2019-08-12[SurfaceFlinger] Callback to renderengine when erasing BLAST buffers Alec Mouri
Otherwise we may leak if BufferStateLayer is destroyed first. Bug: 137514000 Test: Over 61 hours, ran: while [ true ]; do am start -n \ com.android.chrome/com.google.android.apps.chrome.Main \ http://m.youtube.com; sleep 10; input tap 740 740 ; sleep 10; input \ keyevent HOME; sleep 0.5; am force-stop com.android.chrome; sleep 0.5; \ done Test: Over >30 minutes: while [ true ]; do am start -n \ com.android.chrome/com.google.android.apps.chrome.Main \ http://m.youtube.com; sleep 10; input tap 740 740; \ sleep 1; content insert --uri content://settings/system --bind \ name:s:user_rotation --bind value:i:1; sleep 4; content insert --uri \ content://settings/system --bind name:s:user_rotation --bind value:i:0; \ sleep 5; input keyevent HOME; sleep 0.5; \ am force-stop com.android.chrome; sleep 0.5; done Test: CtsViewTestCases:ASurfaceControlTest Test: CtsViewTestCases:SurfaceControlTest Test: Transaction_test Change-Id: I743eb8bd9887d17e08b6f1b8e8ec5874359df175
2019-04-16Change slot generation for BufferState Marissa Wall
BufferState layers now do slot generation with buffer death considered appropriately. When a buffer dies, the slot will be pushed onto a stack of available slots to be reused at the next opportunity. This should mimic BufferQueue slot behavior and prevent Composer Resources from growing too large. Test: build, boot, manual Bug: 129351223 Change-Id: Icef9592593cacb0b5c6b12f6679fc2c4dabdcd19