fuchsia: Do not return error if client tries importing non-colorBuffer memory.
This matches the behavior with other Vulkan device drivers on
Fuchsia, where importing a read-only host memory VMO into
Vulkan driver doesn't work, while it is not considered as an
error if trying to do so. Vulkan driver could return a
VkMemoryZirconHandlePropertiesFUCHSIA with memoryTypeBits of 0
indicating that the DeviceMemory cannot be allocated.
TEST=gfx_unittests on FEMU
Change-Id: I38efd07cbc50822517bccf1190cfabee4ee0d963
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index 09947a5..456764a 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -1788,9 +1788,14 @@
// ColorBuffer/Buffer is created at sysmem allocation time.
memoryProperty = MEMORY_PROPERTY_DEVICE_LOCAL;
} else {
- ALOGE("mControlDevice->GetBufferHandleInfo error: %d",
- result->result.err());
- return VK_ERROR_INITIALIZATION_FAILED;
+ // Importing read-only host memory into the Vulkan driver should not
+ // work, but it is not an error to try to do so. Returning a
+ // VkMemoryZirconHandlePropertiesFUCHSIA with no available
+ // memoryType bits should be enough for clients. See fxbug.dev/24225
+ // for other issues this this flow.
+ ALOGW("GetBufferHandleInfo failed: %d", result->result.err());
+ pProperties->memoryTypeBits = 0;
+ return VK_SUCCESS;
}
pProperties->memoryTypeBits = 0;