pvr: restrict the scope of copy_{buffer,image}_to_{image,buffer}

Do not conflate api and internal driver use of copy commands and make the
correct assumptions for the api path, according to the Vulkan spec.

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37512>
This commit is contained in:
Luigi Santivetti 2025-09-11 11:03:34 +01:00 committed by Marge Bot
parent 2c2fdac093
commit 6c4883bc9d
2 changed files with 14 additions and 15 deletions

View file

@ -853,7 +853,7 @@ pvr_copy_buffer_to_image_region_format(struct pvr_cmd_buffer *const cmd_buffer,
return VK_SUCCESS;
}
VkResult
static VkResult
pvr_copy_buffer_to_image_region(struct pvr_cmd_buffer *const cmd_buffer,
const pvr_dev_addr_t buffer_dev_addr,
const struct pvr_image *const image,
@ -864,6 +864,12 @@ pvr_copy_buffer_to_image_region(struct pvr_cmd_buffer *const cmd_buffer,
VkFormat dst_format;
uint32_t flags = 0;
/* From the Vulkan spec:
*
* dstImage must have a sample count equal to VK_SAMPLE_COUNT_1_BIT
*/
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT);
if (vk_format_has_depth(image->vk.format) &&
vk_format_has_stencil(image->vk.format)) {
flags |= PVR_TRANSFER_CMD_FLAGS_DSMERGE;
@ -930,9 +936,6 @@ pvr_copy_image_to_buffer_region_format(struct pvr_cmd_buffer *const cmd_buffer,
uint32_t max_depth_slice;
VkSubresourceLayout info;
/* Only images with VK_SAMPLE_COUNT_1_BIT can be copied to buffer. */
assert(image->vk.samples == 1);
if (region->bufferRowLength == 0)
buffer_row_length = region->imageExtent.width;
else
@ -1042,7 +1045,7 @@ pvr_copy_image_to_buffer_region_format(struct pvr_cmd_buffer *const cmd_buffer,
return VK_SUCCESS;
}
VkResult
static VkResult
pvr_copy_image_to_buffer_region(struct pvr_cmd_buffer *const cmd_buffer,
const struct pvr_image *const image,
const pvr_dev_addr_t buffer_dev_addr,
@ -1053,6 +1056,12 @@ pvr_copy_image_to_buffer_region(struct pvr_cmd_buffer *const cmd_buffer,
VkFormat src_format = pvr_get_copy_format(image->vk.format);
VkFormat dst_format;
/* From the Vulkan spec:
*
* srcImage must have a sample count equal to VK_SAMPLE_COUNT_1_BIT
*/
assert(image->vk.samples == VK_SAMPLE_COUNT_1_BIT);
/* Color and depth aspect copies can nearly all be done using an appropriate
* raw format.
*/

View file

@ -43,11 +43,6 @@ pvr_copy_or_resolve_color_image_region(struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_image *dst,
const VkImageCopy2 *region);
VkResult pvr_copy_buffer_to_image_region(struct pvr_cmd_buffer *cmd_buffer,
pvr_dev_addr_t buffer_dev_addr,
const struct pvr_image *image,
const VkBufferImageCopy2 *region);
VkResult
pvr_copy_buffer_to_image_region_format(struct pvr_cmd_buffer *cmd_buffer,
pvr_dev_addr_t buffer_dev_addr,
@ -57,11 +52,6 @@ pvr_copy_buffer_to_image_region_format(struct pvr_cmd_buffer *cmd_buffer,
VkFormat dst_format,
uint32_t flags);
VkResult pvr_copy_image_to_buffer_region(struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_image *image,
pvr_dev_addr_t buffer_dev_addr,
const VkBufferImageCopy2 *region);
VkResult
pvr_copy_image_to_buffer_region_format(struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_image *image,