summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/ClientCache.cpp
AgeCommit message (Collapse)Author
2024-06-28Create a wrapper for atrace macros Vishnu Nair
Create a SF specific macro to call into atrace. This will make the switch to perfetto for capturing atrace tags easier. Flag: EXEMPT refactor Bug: 349905670 Test: perfetto Change-Id: I4d046d837f52ef78b08e3c97556f2eddb06232dd
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
2022-10-11SF: Trace buffer cache errors Patrick Williams
Bug: 244218818 Test: presubmits Change-Id: I68e46d1952fe064f6f21958108cfc75e96976b3a
2022-08-01SF: build with ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION Ady Abraham
Change-Id: I347b2cf57f1df426d11d07a84075419597d4a442 Test: presubmit
2022-01-13SF: Make ExternalTexture mockable Vishnu Nair
Expose GraphicBuffer properties via ExternalTexture class. Within SurfaceFlinger access the buffer via this proxy interface. This allows us to inject and mock GraphicBuffers as needed. Specifically this will be used to recreate layer state from transaction traces. Test: compiles Bug: 200284593 Change-Id: I2e7f6bee28314b70eac477cfadbf9f94c4d70339
2021-09-24Use Transactions for RefreshRateOverlay chaviw
RefreshRateOverlay currently calls directly in Layer to update properties. This is ends up adding confusing code to RefreshRateOverlay since it needs to notify SF to handle the updates. It also creates addtional confusion since there are multiple entries to layer properties. Instead, use the SCC Transaction requests to accomplish the same behavior. This simplifies the code and also allows SF to handle the updates instead of RefreshRateOverlay invoking force updates. Test: RefreshRateOverlay works with rotation, different refresh rates Test: RefreshRateOverlayTest Bug: 200820757 Change-Id: I8503c61456c4c14ce6cbcdb2b27035a340fecbf5
2021-09-09FTL: Extend enum utilities imported from IF Dominik Laskowski
Generalize compile-time and run-time lookup of enumerator names by recognizing ftl_first and ftl_last to customize the range. Add enum_range<E>() for iteration using range-based `for` loop. Bug: 185536303 Test: Check assembly for small LUT in .rodata, and unrolled loops. Test: ftl_test, libinput_tests, inputflinger_tests Test: m libinputflinger Change-Id: I0581611f4cfcf5837b0293867cb323742afb2c87
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-03-24Change log level of superfluous logs Vishnu Nair
Test: go/wm-smoke, check logcat for error logs Bug: 175167649 Change-Id: Iacdff89e4c1ea2827a5783c98d342532666b772f
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