Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80616cdb authored by John Reck's avatar John Reck Committed by Android Build Coastguard Worker
Browse files

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
parent 6ef65723
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -994,7 +994,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() {