summaryrefslogtreecommitdiff
path: root/libs/hwui/AutoBackendTextureRelease.cpp
diff options
context:
space:
mode:
authorBrian Orr <brianorr@google.com>2021-06-15 12:47:53 -0700
committerDaniel Norman <danielnorman@google.com>2021-06-17 13:37:54 -0700
commit71c831703ae59baf47e0afe611fecd714c481cdf (patch)
tree06731a987032723085b9e1a65951cf96abbc19cf /libs/hwui/AutoBackendTextureRelease.cpp
parent065c9e9a6e9d61d4383a91721eb56a3de253bdbe (diff)
parent81833820d54b9a6b27894f9f8dfd72222d416992 (diff)
Merge SP1A.210604.001
Change-Id: I5200ee05285ae422d5e9c1c00f45709a5d6188be
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 */