From c38c00a9b0050fce324945009c7e455642494cc6 Mon Sep 17 00:00:00 2001 From: Sergey Ulanov Date: Thu, 16 Jan 2020 16:10:42 -0800 Subject: [PATCH] Fix protected image allocation in createVkImageForBackendSurface() GrVkGpu::createVkImageForBackendSurface() was trying to allocate protected CPU-accessible buffer. That operation fails because protected memory is not CPU-accessible. That buffer is used to initialize image content with vkCmdCopyBufferToImage(). vkCmdCopyBufferToImage() allows source buffer to be non-protected even when commandBuffer is protected. Updated buffer allocating logic to always use non-protected buffer. Bug: b/147809344 Change-Id: Id6b89ceb5391c57eb3076884a0d144dec9c43540 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264937 Commit-Queue: Robert Phillips Reviewed-by: Robert Phillips Auto-Submit: Sergey Ulanov --- src/gpu/vk/GrVkGpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 2847778396..e360a1d1df 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1733,7 +1733,7 @@ bool GrVkGpu::createVkImageForBackendSurface(VkFormat vkFormat, VkBufferCreateInfo bufInfo; memset(&bufInfo, 0, sizeof(VkBufferCreateInfo)); bufInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; - bufInfo.flags = fProtectedContext == GrProtected::kYes ? VK_BUFFER_CREATE_PROTECTED_BIT : 0; + bufInfo.flags = 0; bufInfo.size = combinedBufferSize; bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; bufInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;