anv/android: fix image creation with external format

This fixes crashes seen with following group of tests:
   android.graphics.cts.BasicVulkanGpuTest

Fixes: 6fa56273be ("anv/image: Drop duplicate 'format' in anv_image_create()")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9799>
This commit is contained in:
Tapani Pälli 2021-03-24 14:22:18 +02:00
parent 02492bea5f
commit 382e5f2737
1 changed files with 10 additions and 9 deletions

View File

@ -930,7 +930,6 @@ anv_image_create(VkDevice _device,
pCreateInfo->extent);
image->vk_format = pCreateInfo->format;
image->format = anv_get_format(pCreateInfo->format);
image->n_planes = image->format->n_planes;
image->aspects = vk_format_aspects(image->vk_format);
image->levels = pCreateInfo->mipLevels;
image->array_size = pCreateInfo->arrayLayers;
@ -942,14 +941,6 @@ anv_image_create(VkDevice _device,
image->drm_format_mod = isl_mod_info ? isl_mod_info->modifier :
DRM_FORMAT_MOD_INVALID;
/* The Vulkan 1.2.165 glossary says:
*
* A disjoint image consists of multiple disjoint planes, and is created
* with the VK_IMAGE_CREATE_DISJOINT_BIT bit set.
*/
image->disjoint = image->format->n_planes > 1 &&
(pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT);
if (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
image->stencil_usage = pCreateInfo->usage;
const VkImageStencilUsageCreateInfoEXT *stencil_usage_info =
@ -977,6 +968,16 @@ anv_image_create(VkDevice _device,
return VK_SUCCESS;
}
image->n_planes = image->format->n_planes;
/* The Vulkan 1.2.165 glossary says:
*
* A disjoint image consists of multiple disjoint planes, and is created
* with the VK_IMAGE_CREATE_DISJOINT_BIT bit set.
*/
image->disjoint = image->format->n_planes > 1 &&
(pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT);
const isl_tiling_flags_t isl_tiling_flags =
choose_isl_tiling_flags(&device->info, create_info, isl_mod_info,
image->needs_set_tiling);