diff options
author | 2024-10-03 14:50:22 +0000 | |
---|---|---|
committer | 2024-10-03 14:50:22 +0000 | |
commit | d7fb91da39fbc8cfc15fcf753c26ff818b830fc1 (patch) | |
tree | 799b4b58a8e946a24f104eb04c6f71966c1eb43e /libs/hwui/AutoBackendTextureRelease.cpp | |
parent | 2667b9eb84a3ec52a14ad85ff21ca75342e1d40f (diff) | |
parent | cf9208796d929be7bf93915b5d67165205cbaf91 (diff) |
Merge "HWUI: Make releaseQueueOwnership thread-safety" into main am: cf9208796d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3247597
Change-Id: I26d3d49f7fa9147bc7d3709ee2cb787c3bffb1ea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'libs/hwui/AutoBackendTextureRelease.cpp')
-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. |