v3dv: align width to 256 when using simulator

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37887>
This commit is contained in:
Juan A. Suarez Romero 2025-10-24 13:59:46 +02:00 committed by Marge Bot
parent 08e2da2379
commit 562bb8b62b

View file

@ -93,8 +93,8 @@ v3d_get_dimension_mpad(uint32_t dimension, uint32_t level, uint32_t block_dimens
} }
static bool static bool
v3d_setup_plane_slices(struct v3dv_image *image, uint8_t plane, v3d_setup_plane_slices(struct v3dv_device *device, struct v3dv_image *image,
uint32_t plane_offset, uint8_t plane, uint32_t plane_offset,
const VkSubresourceLayout *plane_layouts) const VkSubresourceLayout *plane_layouts)
{ {
assert(image->planes[plane].cpp > 0); assert(image->planes[plane].cpp > 0);
@ -242,6 +242,18 @@ v3d_setup_plane_slices(struct v3dv_image *image, uint8_t plane,
(2 * v3d_utile_height(image->planes[plane].cpp)); (2 * v3d_utile_height(image->planes[plane].cpp));
} }
#if USE_V3D_SIMULATOR
/* 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) {
slice->stride =
align(slice->stride,
v3d_simulator_get_raster_stride_align(device->pdevice->render_fd));
}
#endif
slice->size = level_height * slice->stride; slice->size = level_height * slice->stride;
uint32_t slice_total_size = slice->size * level_depth; uint32_t slice_total_size = slice->size * level_depth;
@ -327,8 +339,8 @@ v3d_setup_plane_slices(struct v3dv_image *image, uint8_t plane,
} }
static VkResult static VkResult
v3d_setup_slices(struct v3dv_image *image, bool disjoint, v3d_setup_slices(struct v3dv_device *device, struct v3dv_image *image,
const VkSubresourceLayout *plane_layouts) bool disjoint, const VkSubresourceLayout *plane_layouts)
{ {
if (disjoint && image->plane_count == 1) if (disjoint && image->plane_count == 1)
disjoint = false; disjoint = false;
@ -336,7 +348,7 @@ v3d_setup_slices(struct v3dv_image *image, bool disjoint,
uint64_t offset = 0; uint64_t offset = 0;
for (uint8_t plane = 0; plane < image->plane_count; plane++) { for (uint8_t plane = 0; plane < image->plane_count; plane++) {
offset = disjoint ? 0 : offset; offset = disjoint ? 0 : offset;
if (!v3d_setup_plane_slices(image, plane, offset, plane_layouts)) { if (!v3d_setup_plane_slices(device, image, plane, offset, plane_layouts)) {
assert(plane_layouts); assert(plane_layouts);
return VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT; return VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT;
} }
@ -387,7 +399,7 @@ v3dv_update_image_layout(struct v3dv_device *device,
image->vk.drm_format_mod = modifier; image->vk.drm_format_mod = modifier;
return v3d_setup_slices(image, disjoint, return v3d_setup_slices(device, image, disjoint,
explicit_mod_info ? explicit_mod_info->pPlaneLayouts : explicit_mod_info ? explicit_mod_info->pPlaneLayouts :
NULL); NULL);
} }