isl: add a usage flag to request 2D/3D compatible views

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23620>
This commit is contained in:
Lionel Landwerlin 2023-06-24 00:47:25 +03:00 committed by Marge Bot
parent 7c5015e181
commit 15648dcbba
4 changed files with 17 additions and 0 deletions

View file

@ -1129,6 +1129,7 @@ typedef uint64_t isl_surf_usage_flags_t;
#define ISL_SURF_USAGE_PROTECTED_BIT (1u << 16)
#define ISL_SURF_USAGE_VIDEO_DECODE_BIT (1u << 17)
#define ISL_SURF_USAGE_STREAM_OUT_BIT (1u << 18)
#define ISL_SURF_USAGE_2D_3D_COMPATIBLE_BIT (1u << 19)
/** @} */
/**

View file

@ -107,6 +107,12 @@ isl_gfx125_filter_tiling(const struct isl_device *dev,
if (isl_format_is_yuv(info->format))
*flags &= ~ISL_TILING_64_BIT;
/* Tile64 tilings for 3D have a different swizzling than a 2D surface. So
* filter them out if the usage wants 2D/3D compatibility.
*/
if (info->usage & ISL_SURF_USAGE_2D_3D_COMPATIBLE_BIT)
*flags &= ~ISL_TILING_64_BIT;
/* From RENDER_SURFACE_STATE::NumberofMultisamples,
*
* This field must not be programmed to anything other than

View file

@ -251,6 +251,12 @@ isl_gfx6_filter_tiling(const struct isl_device *dev,
*flags &= ~ISL_TILING_STD_Y_MASK;
}
/* Again, Yf and Ys tilings for 3D have a different swizzling than a 2D
* surface. So filter them out if the usage wants 2D/3D compatibility.
*/
if (info->usage & ISL_SURF_USAGE_2D_3D_COMPATIBLE_BIT)
*flags &= ~ISL_TILING_STD_Y_MASK;
if (isl_surf_usage_is_stencil(info->usage)) {
if (ISL_GFX_VER(dev) >= 12) {
/* Stencil requires Y. */

View file

@ -230,6 +230,10 @@ choose_isl_surf_usage(VkImageCreateFlags vk_create_flags,
if (vk_create_flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
isl_usage |= ISL_SURF_USAGE_CUBE_BIT;
if (vk_create_flags & (VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT |
VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT))
isl_usage |= ISL_SURF_USAGE_2D_3D_COMPATIBLE_BIT;
/* Even if we're only using it for transfer operations, clears to depth and
* stencil images happen as depth and stencil so they need the right ISL
* usage bits or else things will fall apart.