anv: support all dimensions of image for LINEAR dmabufs

> Allowing 1D and 3D images, and array images too, with DRM_FORMAT_MOD_LINEAR, is ok
> because VkImageDrmFormatModifierExplicitCreateInfoEXT::pPlaneLayouts is able to fully
> describe the image layout. IF miplevels == 1, which this patch continues to enforce.

Reviewed-by: Lina Versace <lina@kiwitree.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33668>
This commit is contained in:
Mike Blumenkrantz 2025-02-21 09:28:36 -05:00 committed by Marge Bot
parent a3504b79fb
commit 6a29d2ed66
4 changed files with 11 additions and 15 deletions

View file

@ -684,6 +684,3 @@ spec@ext_framebuffer_multisample@interpolation 2 centroid-deriv-disabled,Fail
# New crash with Xe KMD
spec@!opengl 1.1@streaming-texture-leak,Crash
# ANV doesn't support 3D dmabufs
spec@egl 1.4@egl-ext_egl_image_storage,Crash

View file

@ -670,6 +670,3 @@ glx@glx_arb_sync_control@swapbuffersmsc-return,Fail
glx@glx_arb_sync_control@swapbuffersmsc-divisor-zero,Fail
glx@glx_arb_sync_control@swapbuffersmsc-return swap_interval 0,Fail
glx@glx_arb_sync_control@swapbuffersmsc-return swap_interval 1,Fail
# ANV doesn't support 3D dmabufs
spec@egl 1.4@egl-ext_egl_image_storage,Crash

View file

@ -864,7 +864,8 @@ anv_get_image_format_features2(const struct anv_physical_device *physical_device
* has no type suffix) or sfloat (if it has suffix F). No format
* contains mixed types. (as of 2021-06-14)
*/
if (isl_layout->uniform_channel_type != ISL_UNORM &&
if (isl_mod_info->modifier != DRM_FORMAT_MOD_LINEAR &&
isl_layout->uniform_channel_type != ISL_UNORM &&
isl_layout->uniform_channel_type != ISL_SFLOAT)
return 0;
break;
@ -1639,14 +1640,15 @@ anv_get_image_format_properties(
/* We support modifiers only for "simple" (that is, non-array
* non-mipmapped single-sample) 2D images.
*/
if (info->type != VK_IMAGE_TYPE_2D) {
if (info->type != VK_IMAGE_TYPE_2D && isl_mod_info->modifier != DRM_FORMAT_MOD_LINEAR) {
vk_errorf(physical_device, VK_ERROR_FORMAT_NOT_SUPPORTED,
"VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT "
"non-linear VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT "
"requires VK_IMAGE_TYPE_2D");
goto unsupported;
}
maxArraySize = 1;
if (isl_mod_info->modifier != DRM_FORMAT_MOD_LINEAR)
maxArraySize = 1;
maxMipLevels = 1;
sampleCounts = VK_SAMPLE_COUNT_1_BIT;

View file

@ -1161,11 +1161,11 @@ check_drm_format_mod(const struct anv_device *device,
assert(isl_drm_modifier_get_score(device->info, isl_mod_info->modifier));
/* Enforced by us, not the Vulkan spec. */
assert(image->vk.image_type == VK_IMAGE_TYPE_2D);
assert(image->vk.image_type == VK_IMAGE_TYPE_2D || image->vk.drm_format_mod == DRM_FORMAT_MOD_LINEAR);
assert(!(image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT));
assert(!(image->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT));
assert(image->vk.mip_levels == 1);
assert(image->vk.array_layers == 1);
assert(image->vk.array_layers == 1 || image->vk.drm_format_mod == DRM_FORMAT_MOD_LINEAR);
assert(image->vk.samples == 1);
for (int i = 0; i < image->n_planes; ++i) {
@ -2896,8 +2896,8 @@ anv_get_image_subresource_layout(struct anv_device *device,
image->planes[0].primary_surface.memory_range.binding);
/* We are working with a non-arrayed 2D image. */
assert(image->vk.image_type == VK_IMAGE_TYPE_2D);
assert(image->vk.array_layers == 1);
assert(image->vk.image_type == VK_IMAGE_TYPE_2D || image->vk.drm_format_mod == DRM_FORMAT_MOD_LINEAR);
assert(image->vk.array_layers == 1 || image->vk.drm_format_mod == DRM_FORMAT_MOD_LINEAR);
} else {
const uint32_t plane =
anv_image_aspect_to_plane(image,