Module: Mesa
Branch: main
Commit: 74e797e6ba6949edd97cdada96b5c62bec0ac107
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=74e797e6ba6949edd97cdada96b5c62bec0ac107

Author: Iago Toral Quiroga <[email protected]>
Date:   Mon May 22 13:55:45 2023 +0200

v3dv: allow TFU transfers for mip levels other than 0

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23180>

---

 src/broadcom/vulkan/v3dv_meta_copy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c 
b/src/broadcom/vulkan/v3dv_meta_copy.c
index d3fcfb90296..0ccfcfbbbb2 100644
--- a/src/broadcom/vulkan/v3dv_meta_copy.c
+++ b/src/broadcom/vulkan/v3dv_meta_copy.c
@@ -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;

Reply via email to