pvr: respect has_pbe_stride_align_1pixel

This makes us either use the rogue-define, or a single pixel. This
feature isn't available in any HW we support yet, but that is going to
change soon.

Reviewed-by: Ashish Chauhan <ashish.chauhan@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38423>
This commit is contained in:
Erik Faye-Lund 2025-11-13 12:18:41 +01:00 committed by Marge Bot
parent ba47e03908
commit b8721b7436

View file

@ -65,7 +65,9 @@ static void pvr_image_init_memlayout(struct pvr_image *image)
}
}
static void pvr_image_init_physical_extent(struct pvr_image *image)
static void
pvr_image_init_physical_extent(struct pvr_image *image,
unsigned pbe_stride_align)
{
assert(image->memlayout != PVR_MEMLAYOUT_UNDEFINED);
@ -90,8 +92,7 @@ static void pvr_image_init_physical_extent(struct pvr_image *image)
if (image->vk.usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
image->physical_extent.width =
align(image->physical_extent.width,
ROGUE_PBESTATE_REG_WORD0_LINESTRIDE_UNIT_SIZE);
align(image->physical_extent.width, pbe_stride_align);
}
}
}
@ -153,6 +154,13 @@ static void pvr_image_setup_mip_levels(struct pvr_image *image)
image->size = image->layer_size * image->vk.array_layers;
}
static unsigned
get_pbe_stride_align(const struct pvr_device_info *dev_info)
{
return PVR_HAS_FEATURE(dev_info, pbe_stride_align_1pixel) ?
1 : ROGUE_PBESTATE_REG_WORD0_LINESTRIDE_UNIT_SIZE;
}
VkResult pvr_CreateImage(VkDevice _device,
const VkImageCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
@ -182,9 +190,12 @@ VkResult pvr_CreateImage(VkDevice _device,
*/
image->alignment = 4096U;
unsigned pbe_stride_align =
get_pbe_stride_align(&device->pdevice->dev_info);
/* Initialize the image using the saved information from pCreateInfo */
pvr_image_init_memlayout(image);
pvr_image_init_physical_extent(image);
pvr_image_init_physical_extent(image, pbe_stride_align);
pvr_image_setup_mip_levels(image);
*pImage = pvr_image_to_handle(image);