v3dv: use div_round_up for division by block size
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 29 Jun 2023 08:07:45 +0000 (10:07 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Jun 2023 10:13:42 +0000 (10:13 +0000)
We always want to round up when we divide by the block size.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23919>

src/broadcom/vulkan/v3dv_meta_copy.c

index 8e31cc7..1b953cb 100644 (file)
@@ -703,8 +703,8 @@ gather_image_to_buffer_info(struct v3dv_cmd_buffer *cmd_buffer,
       vk_format_get_blockwidth(image->planes[plane].vk_format);
    uint32_t block_height =
       vk_format_get_blockheight(image->planes[plane].vk_format);
-   buf_width = buf_width / block_width;
-   buf_height = buf_height / block_height;
+   buf_width = DIV_ROUND_UP(buf_width, block_width);
+   buf_height = DIV_ROUND_UP(buf_height, block_height);
 
    out_info->src_format = src_format;
    out_info->dst_format = dst_format;