diff options
author | Yilong Li <liyl@google.com> | 2020-09-18 10:07:59 -0700 |
---|---|---|
committer | Yilong Li <liyl@google.com> | 2020-09-18 13:44:16 -0700 |
commit | ab89e17faf95f6180907067b5f79023972ef48c0 (patch) | |
tree | 6d14053ede9676802fae5017aed7eb0c5a2ed2ff | |
parent | dcac4016ab98b5b54a98bded4ec371e776194d3b (diff) | |
download | device_generic_goldfish-opengl-ab89e17faf95f6180907067b5f79023972ef48c0.tar.gz device_generic_goldfish-opengl-ab89e17faf95f6180907067b5f79023972ef48c0.tar.bz2 device_generic_goldfish-opengl-ab89e17faf95f6180907067b5f79023972ef48c0.zip |
fuchsia: Set sysmem constraints only if format/tiling/usage valid on host.
Host Vulkan driver may not support some specific format, tiling and
image usage combinations. Before guest ICD set up sysmem buffer
collection constraints, guest needs to verify the image properties
to ensure that this works on host Vulkan driver, otherwise it may
cause further issues with the ColorBuffer/guest Vulkan image.
TEST=chromium test on FEMU.
Change-Id: I391c564a39cfecf35e8e2ca6486f8e35bed5ee96
-rw-r--r-- | system/vulkan_enc/ResourceTracker.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp index c20e394f..b00a5627 100644 --- a/system/vulkan_enc/ResourceTracker.cpp +++ b/system/vulkan_enc/ResourceTracker.cpp @@ -1830,6 +1830,32 @@ public: VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, }; + } else { + // If image format is predefined, check on host if the format, + // tiling and usage is supported. + AutoLock lock(mLock); + auto deviceIt = info_VkDevice.find(device); + if (deviceIt == info_VkDevice.end()) { + return VK_ERROR_INITIALIZATION_FAILED; + } + auto& deviceInfo = deviceIt->second; + + VkImageFormatProperties format_properties; + auto result = enc->vkGetPhysicalDeviceImageFormatProperties( + deviceInfo.physdev, pImageInfo->format, pImageInfo->imageType, + pImageInfo->tiling, pImageInfo->usage, pImageInfo->flags, &format_properties); + if (result != VK_SUCCESS) { + ALOGE( + "%s: Image format (%u) type (%u) tiling (%u) " + "usage (%u) flags (%u) not supported by physical " + "device", + __func__, static_cast<uint32_t>(pImageInfo->format), + static_cast<uint32_t>(pImageInfo->imageType), + static_cast<uint32_t>(pImageInfo->tiling), + static_cast<uint32_t>(pImageInfo->usage), + static_cast<uint32_t>(pImageInfo->flags)); + return VK_ERROR_FORMAT_NOT_SUPPORTED; + } } constraints.image_format_constraints_count = formats.size(); uint32_t format_index = 0; |