diff options
author | Tapani Pälli <[email protected]> | 2019-10-07 09:07:48 +0300 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-10-08 09:18:22 -0700 |
commit | 06b8b29a0a88ed902b6a41971a39ef646b4bf62e (patch) | |
tree | 6c006f0f95ac13de74932274bf68691411a04e4b | |
parent | 905231856507cc1852da5be5ea9851be9c44bb6a (diff) |
anv/android: fix images created with external format support
This fixes a case where user first creates image and then later binds it
with memory created from AHW buffer.
Cc: <[email protected]>
Signed-off-by: Tapani Pälli <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
(cherry picked from commit e4a826b2c8af8ac9194a7527c568e876c71b0dee)
-rw-r--r-- | src/intel/vulkan/anv_image.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 36c43f26634..66116a8a67d 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -735,6 +735,17 @@ anv_CreateImage(VkDevice device, return anv_image_from_external(device, pCreateInfo, create_info, pAllocator, pImage); + bool use_external_format = false; + const struct VkExternalFormatANDROID *ext_format = + vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID); + + /* "If externalFormat is zero, the effect is as if the + * VkExternalFormatANDROID structure was not present. Otherwise, the image + * will have the specified external format." + */ + if (ext_format && ext_format->externalFormat != 0) + use_external_format = true; + const VkNativeBufferANDROID *gralloc_info = vk_find_struct_const(pCreateInfo->pNext, NATIVE_BUFFER_ANDROID); if (gralloc_info) @@ -750,6 +761,7 @@ anv_CreateImage(VkDevice device, return anv_image_create(device, &(struct anv_image_create_info) { .vk_info = pCreateInfo, + .external_format = use_external_format, }, pAllocator, pImage); |