summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2024-04-18 14:15:03 -0400
committer John Reck <jreck@google.com> 2024-04-18 14:15:03 -0400
commit254972cf117af611b3ed27e46657344a162616a9 (patch)
tree195818d6afba4ca8a54b6cbaf9160f36052ee055 /libs/hwui/renderthread
parente234e53b6fd78784d691c94b8b47ef792bd19e89 (diff)
Fix HardwareRenderers becoming invalidated by TRIM
Fixes: 335646931 Test: repro steps in bug Change-Id: I6b22d202b71effa1a7136a20f51b38732d0fde74
Diffstat (limited to 'libs/hwui/renderthread')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 66e089627a7b..8bb11badb607 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -1010,7 +1010,15 @@ void CanvasContext::destroyHardwareResources() {
}
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() {