v3dv: only apply simulator stride alignment for from_wsi images

This adds from_wsi field to v3dv_image, so we can apply simulator stride
 alignment only to WSI images.

Handling VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA at
v3dv_GetPhysicalDeviceFormatProperties2 also removes debug warnings like:

MESA: debug: v3dv_GetPhysicalDeviceImageFormatProperties2: ignored VkStructureType Unknown VkStructureType value.(1000001002)

Fixes: 562bb8b62b ("v3dv: align width to 256 when using simulator")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38374>
This commit is contained in:
Jose Maria Casanova Crespo 2025-11-11 13:45:31 +01:00 committed by Marge Bot
parent 7411acaa77
commit a0b8ee614d
3 changed files with 13 additions and 3 deletions

View file

@ -678,7 +678,7 @@ v3dv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
/* Extract input structs */
vk_foreach_struct_const(s, base_info->pNext) {
switch (s->sType) {
switch ((unsigned)s->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO:
external_info = (const void *) s;
break;
@ -698,6 +698,9 @@ v3dv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
assert("Unknown DRM format modifier");
}
break;
case VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA:
/* Do nothing, v3dv_image_init will handle it */;
break;
default:
vk_debug_ignored_stype(s->sType);
break;

View file

@ -246,8 +246,7 @@ v3d_setup_plane_slices(struct v3dv_device *device, struct v3dv_image *image,
/* Ensure stride alignment matches the one required by the GPU that
* drives the display.
*/
if (!image->tiled &&
image->vk.image_type == VK_IMAGE_TYPE_2D) {
if (image->from_wsi) {
slice->stride =
align(slice->stride,
v3d_simulator_get_raster_stride_align(device->pdevice->render_fd));
@ -437,6 +436,10 @@ v3dv_image_init(struct v3dv_device *device,
modifier = eci.drmFormatModifier;
}
const struct wsi_image_create_info *wsi_info =
vk_find_struct_const(pCreateInfo->pNext, WSI_IMAGE_CREATE_INFO_MESA);
image->from_wsi = wsi_info != NULL;
if (tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
mod_info =
vk_find_struct_const(pCreateInfo->pNext,

View file

@ -746,6 +746,10 @@ struct v3dv_image {
* This holds a tiled copy of the image we can use for that purpose.
*/
struct v3dv_image *shadow;
/* Image is a WSI image.
*/
bool from_wsi;
};
VkResult