diff options
author | 2024-08-26 20:43:49 +0800 | |
---|---|---|
committer | 2024-08-30 23:11:21 +0800 | |
commit | 255ee52dd9254ba8bbe68bef0c1182aae91dbf41 (patch) | |
tree | 43e3937f8391fba62101a2521eaa51eb946f9bba | |
parent | 14a533a83d74880734c865648101e0ab62481642 (diff) |
HWUI: Make releaseQueueOwnership thread-safety
We encountered a Skia Resource Cache SIGTRAP NE Issue, caused by deleting DeferredLayerUpdater on the wrong thread, FinalizerDaemon.
Make AutoBackendTextureRelease::releaseQueueOwnership thread-safety. Avoid multi-thread access to the Skia Resource Cache.
Bug:
Test:Manual
1.Install and Launch APK
2.Run Monkey Test
adb shell monkey -v -p com.ss.android.article.news --throttle 3000 99999
Change-Id: Icb5098e9460ce4be799db8575d9916a9910d61a1
-rw-r--r-- | libs/hwui/AutoBackendTextureRelease.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/hwui/AutoBackendTextureRelease.cpp b/libs/hwui/AutoBackendTextureRelease.cpp index 5f5ffe97e953..86fede5eb98c 100644 --- a/libs/hwui/AutoBackendTextureRelease.cpp +++ b/libs/hwui/AutoBackendTextureRelease.cpp @@ -140,6 +140,13 @@ void AutoBackendTextureRelease::releaseQueueOwnership(GrDirectContext* context) return; } + if (!RenderThread::isCurrent()) { + // releaseQueueOwnership needs to run on RenderThread to prevent multithread calling + // setBackendTextureState will operate skia resource cache which need single owner + RenderThread::getInstance().queue().post([this, context]() { releaseQueueOwnership(context); }); + return; + } + LOG_ALWAYS_FATAL_IF(Properties::getRenderPipelineType() != RenderPipelineType::SkiaVulkan); if (mBackendTexture.isValid()) { // Passing in VK_IMAGE_LAYOUT_UNDEFINED means we keep the old layout. |