v3dv: allow TFU transfers for mip levels other than 0
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 22 May 2023 11:55:45 +0000 (13:55 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 24 May 2023 09:28:07 +0000 (09:28 +0000)
We had a check to ensure we were copying full slices, but the
size check was done against the base mip level, so in practice
we were only using the TFU for mip 0.

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

src/broadcom/vulkan/v3dv_meta_copy.c

index d3fcfb9..0ccfcfb 100644 (file)
@@ -1539,11 +1539,13 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
    else
       height = region->bufferImageHeight;
 
-   uint8_t plane =
+   const uint8_t plane =
       v3dv_plane_from_aspect(region->imageSubresource.aspectMask);
 
-   if (width != image->planes[plane].width ||
-       height != image->planes[plane].height)
+   const uint32_t mip_level = region->imageSubresource.mipLevel;
+   const struct v3d_resource_slice *slice = &image->planes[plane].slices[mip_level];
+
+   if (width != slice->width || height != slice->height)
       return false;
 
    /* Handle region semantics for compressed images */
@@ -1566,9 +1568,6 @@ copy_buffer_to_image_tfu(struct v3dv_cmd_buffer *cmd_buffer,
    assert(format->plane_count == 1);
    const struct v3dv_format_plane *format_plane = &format->planes[0];
 
-   const uint32_t mip_level = region->imageSubresource.mipLevel;
-   const struct v3d_resource_slice *slice = &image->planes[plane].slices[mip_level];
-
    uint32_t num_layers;
    if (image->vk.image_type != VK_IMAGE_TYPE_3D)
       num_layers = region->imageSubresource.layerCount;