commit | 80616cdb1b3867b96bb96bf586e926405a727b6c | [log] [tgz] |
---|---|---|
author | John Reck <jreck@google.com> | Thu Apr 18 14:15:03 2024 -0400 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue May 21 14:07:45 2024 +0000 |
tree | d0b972c5ae77914fcdf73bd7dba71b3c6d52dc23 | |
parent | 6ef657239356ca36d2cfa356991096f8d55356f3 [diff] |
Fix HardwareRenderers becoming invalidated by TRIM Fixes: 335646931 Test: repro steps in bug (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:254972cf117af611b3ed27e46657344a162616a9) Merged-In: I6b22d202b71effa1a7136a20f51b38732d0fde74 Change-Id: I6b22d202b71effa1a7136a20f51b38732d0fde74
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 1d03301..ad864ec 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -994,7 +994,15 @@ } void CanvasContext::onContextDestroyed() { - destroyHardwareResources(); + // We don't want to destroyHardwareResources as that will invalidate display lists which + // the client may not be expecting. Instead just purge all scratch resources + if (mRenderPipeline->isContextReady()) { + freePrefetchedLayers(); + for (const sp<RenderNode>& node : mRenderNodes) { + node->destroyLayers(); + } + mRenderPipeline->onDestroyHardwareResources(); + } } DeferredLayerUpdater* CanvasContext::createTextureLayer() {