anv/image: Fix interpretation of 'disjoint'

The calculation of the subsurfaces' memory requirements assumed that the
image was disjoint if the image was created with
VK_IMAGE_CREATE_DISJOINT_BIT. But the Vulkan spec also requires that the
VkFormat be multi-planar.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8097>
This commit is contained in:
Chad Versace
2021-02-05 12:07:08 -08:00
committed by chadversary
parent 6fa56273be
commit 449df3808f
2 changed files with 11 additions and 3 deletions

View File

@@ -804,11 +804,18 @@ anv_image_create(VkDevice _device,
image->usage = anv_image_create_usage(pCreateInfo, pCreateInfo->usage); image->usage = anv_image_create_usage(pCreateInfo, pCreateInfo->usage);
image->create_flags = pCreateInfo->flags; image->create_flags = pCreateInfo->flags;
image->tiling = pCreateInfo->tiling; image->tiling = pCreateInfo->tiling;
image->disjoint = pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT;
image->needs_set_tiling = wsi_info && wsi_info->scanout; image->needs_set_tiling = wsi_info && wsi_info->scanout;
image->drm_format_mod = isl_mod_info ? isl_mod_info->modifier : image->drm_format_mod = isl_mod_info ? isl_mod_info->modifier :
DRM_FORMAT_MOD_INVALID; 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) { if (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
image->stencil_usage = pCreateInfo->usage; image->stencil_usage = pCreateInfo->usage;
const VkImageStencilUsageCreateInfoEXT *stencil_usage_info = const VkImageStencilUsageCreateInfoEXT *stencil_usage_info =

View File

@@ -3759,8 +3759,9 @@ struct anv_image {
VkDeviceSize size; VkDeviceSize size;
uint32_t alignment; uint32_t alignment;
/* Whether the image is made of several underlying buffer objects rather a /**
* single one with different offsets. * Image has multi-planar format and was created with
* VK_IMAGE_CREATE_DISJOINT_BIT.
*/ */
bool disjoint; bool disjoint;