anv: Fix stride mismatch in mesa and minigbm

It is observed that in display resolutions where width is not equal to
stride, vulkan rendering is being distorted. This is happening due to
stride calculation mismatch between minigbm and mesa.

This fix makes sure that the stride calculated in minigbm is passed to
anv and isl.

The issue was found while debugging the following android cts tests and
thus fixes them as well.
android.graphics.cts.VulkanPreTransformTest#testVulkanPreTransformNotSetToMatchCurrentTransform
android.graphics.cts.VulkanPreTransformTest#testVulkanPreTransformSetToMatchCurrentTransform

Signed-off-by: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22163>
This commit is contained in:
Sai Teja Pottumuttu 2023-03-28 10:13:05 +00:00 committed by Marge Bot
parent ca4ec49b0e
commit 11d32fb44f
3 changed files with 6 additions and 1 deletions

View file

@ -532,6 +532,8 @@ anv_image_init_from_gralloc(struct anv_device *device,
base_info->tiling);
assert(format != ISL_FORMAT_UNSUPPORTED);
anv_info.stride = gralloc_info->stride * (isl_format_get_layout(format)->bpb / 8);
result = anv_image_init(device, image, &anv_info);
if (result != VK_SUCCESS)
goto fail_init;

View file

@ -1399,7 +1399,7 @@ anv_image_init(struct anv_device *device, struct anv_image *image,
mod_explicit_info, isl_tiling_flags,
create_info->isl_extra_usage_flags);
} else {
r = add_all_surfaces_implicit_layout(device, image, fmt_list, 0,
r = add_all_surfaces_implicit_layout(device, image, fmt_list, create_info->stride,
isl_tiling_flags,
create_info->isl_extra_usage_flags);
}

View file

@ -3985,6 +3985,9 @@ struct anv_image_create_info {
/** These flags will be added to any derived from VkImageCreateInfo. */
isl_surf_usage_flags_t isl_extra_usage_flags;
/** An opt-in stride, should be 0 for implicit layouts */
uint32_t stride;
};
VkResult anv_image_init(struct anv_device *device, struct anv_image *image,