summaryrefslogtreecommitdiff
path: root/libs/hwui/AutoBackendTextureRelease.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-05-27 16:38:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-05-27 16:38:57 +0000
commit433ba6df077c26ad1aa8455f1f87e7cf1ecda706 (patch)
treec6ec82189c27b7db1cb9cdd6b05cd72375c19799 /libs/hwui/AutoBackendTextureRelease.cpp
parent6addf5854a72a3a1c581fa2f23c3a7cf70ac3231 (diff)
parent27e1fa257b9c538c53bcfbf30f6fc1833342b055 (diff)
Merge "In Vk DeferredLayerUpdater make sure we releause buffers to foreign queue." into sc-dev
Diffstat (limited to 'libs/hwui/AutoBackendTextureRelease.cpp')
-rw-r--r--libs/hwui/AutoBackendTextureRelease.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/hwui/AutoBackendTextureRelease.cpp b/libs/hwui/AutoBackendTextureRelease.cpp
index 33264d5d5c86..ef5eacbdb4ad 100644
--- a/libs/hwui/AutoBackendTextureRelease.cpp
+++ b/libs/hwui/AutoBackendTextureRelease.cpp
@@ -89,5 +89,27 @@ void AutoBackendTextureRelease::newBufferContent(GrDirectContext* context) {
}
}
+void AutoBackendTextureRelease::releaseQueueOwnership(GrDirectContext* context) {
+ if (!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.
+ GrBackendSurfaceMutableState newState(VK_IMAGE_LAYOUT_UNDEFINED,
+ VK_QUEUE_FAMILY_FOREIGN_EXT);
+
+ // The unref for this ref happens in the releaseProc passed into setBackendTextureState. The
+ // releaseProc callback will be made when the work to set the new state has finished on the
+ // gpu.
+ ref();
+ // Note that we don't have an explicit call to set the backend texture back onto the
+ // graphics queue when we use the VkImage again. Internally, Skia will notice that the image
+ // is not on the graphics queue and will do the transition automatically.
+ context->setBackendTextureState(mBackendTexture, newState, nullptr, releaseProc, this);
+ }
+}
+
} /* namespace uirenderer */
} /* namespace android */