diff options
author | 2024-10-03 15:08:57 +0000 | |
---|---|---|
committer | 2024-10-03 15:08:57 +0000 | |
commit | ffd04a7f132c266609f5504772ccb21da7d86c48 (patch) | |
tree | a6a4ce9622f46f8245de0905510d9ba34e5e53ba /libs/hwui/AutoBackendTextureRelease.cpp | |
parent | f9b389f332a255a77561c04bd1126ed7b7664c95 (diff) | |
parent | d7fb91da39fbc8cfc15fcf753c26ff818b830fc1 (diff) |
Merge "HWUI: Make releaseQueueOwnership thread-safety" into main am: cf9208796d am: d7fb91da39
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3247597
Change-Id: Ia6f256a67c0297d3d46d441f2633c09e6389d093
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 27add3542c01..430519606d9b 100644 --- a/libs/hwui/AutoBackendTextureRelease.cpp +++ b/libs/hwui/AutoBackendTextureRelease.cpp @@ -141,6 +141,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. |