intel/vulkan: Allow modifiers supporting fast clear

Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Acked-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25651>
This commit is contained in:
Jianxun Zhang
2023-09-25 13:50:15 -07:00
committed by Marge Bot
parent ab6f1b1d57
commit a26d62df6b

View File

@@ -1305,38 +1305,36 @@ add_all_surfaces_explicit_layout(
isl_drm_modifier_has_aux(drm_info->drmFormatModifier);
VkResult result;
/* About valid usage in the Vulkan spec:
*
* Unlike vanilla vkCreateImage, which produces undefined behavior on user
* error, here the spec requires the implementation to return
* VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT if the app provides
* a bad plane layout. However, the spec does require
* drmFormatModifierPlaneCount to be valid.
*
* Most validation of plane layout occurs in add_surface().
*/
/* We support a restricted set of images with modifiers.
*
* With aux usage on platforms without flat-CCS,
* - Format plane count must be 1.
* - Memory plane count must be 2.
* Otherwise,
* - Each format plane must map to a distint memory plane.
*
* For the other cases, currently there is no way to properly map memory
* planes to format planes and aux planes due to the lack of defined ABI
* for external multi-planar images.
/* Currently there is no way to properly map memory planes to format planes
* and aux planes due to the lack of defined ABI for external multi-planar
* images.
*/
if (image->n_planes == 1)
assert(image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT);
else
assert(!(image->vk.aspects & ~VK_IMAGE_ASPECT_PLANES_BITS_ANV));
if (mod_has_aux && !devinfo->has_flat_ccs)
assert(image->n_planes == 1 && mod_plane_count == 2);
else
if (mod_has_aux) {
assert(image->n_planes == 1);
/* About valid usage in the Vulkan spec:
*
* Unlike vanilla vkCreateImage, which produces undefined behavior on user
* error, here the spec requires the implementation to return
* VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT if the app provides
* a bad plane layout. However, the spec does require
* drmFormatModifierPlaneCount to be valid.
*
* Most validation of plane layout occurs in add_surface().
*/
uint32_t n_mod_planes =
isl_drm_modifier_get_plane_count(devinfo,
drm_info->drmFormatModifier,
image->n_planes);
assert(n_mod_planes == mod_plane_count);
} else {
assert(image->n_planes == mod_plane_count);
}
/* Reject special values in the app-provided plane layouts. */
for (uint32_t i = 0; i < mod_plane_count; ++i) {