[Mesa-dev] [PATCH] radv/gfx9: fix image resource handling.
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Wed Sep 13 07:01:26 UTC 2017
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
On Wed, Sep 13, 2017 at 6:50 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> GFX9 changes how images are layed out, so this needs updating.
>
> Fixes: dEQP-VK.query_pool.statistics_query.*
>
> CC: "17.2" <mesa-stable at lists.freedesktop.org
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/amd/vulkan/radv_image.c | 27 +++++++++++++++++++--------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index df28866..46b6205 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -1059,23 +1059,34 @@ radv_DestroyImage(VkDevice _device, VkImage _image,
> }
>
> void radv_GetImageSubresourceLayout(
> - VkDevice device,
> + VkDevice _device,
> VkImage _image,
> const VkImageSubresource* pSubresource,
> VkSubresourceLayout* pLayout)
> {
> RADV_FROM_HANDLE(radv_image, image, _image);
> + RADV_FROM_HANDLE(radv_device, device, _device);
> int level = pSubresource->mipLevel;
> int layer = pSubresource->arrayLayer;
> struct radeon_surf *surface = &image->surface;
>
> - pLayout->offset = surface->u.legacy.level[level].offset + surface->u.legacy.level[level].slice_size * layer;
> - pLayout->rowPitch = surface->u.legacy.level[level].nblk_x * surface->bpe;
> - pLayout->arrayPitch = surface->u.legacy.level[level].slice_size;
> - pLayout->depthPitch = surface->u.legacy.level[level].slice_size;
> - pLayout->size = surface->u.legacy.level[level].slice_size;
> - if (image->type == VK_IMAGE_TYPE_3D)
> - pLayout->size *= u_minify(image->info.depth, level);
> + if (device->physical_device->rad_info.chip_class >= GFX9) {
> + pLayout->offset = surface->u.gfx9.offset[level] + surface->u.gfx9.surf_slice_size * layer;
> + pLayout->rowPitch = surface->u.gfx9.surf_pitch * surface->bpe;
> + pLayout->arrayPitch = surface->u.gfx9.surf_slice_size;
> + pLayout->depthPitch = surface->u.gfx9.surf_slice_size;
> + pLayout->size = surface->u.gfx9.surf_slice_size;
> + if (image->type == VK_IMAGE_TYPE_3D)
> + pLayout->size *= u_minify(image->info.depth, level);
> + } else {
> + pLayout->offset = surface->u.legacy.level[level].offset + surface->u.legacy.level[level].slice_size * layer;
> + pLayout->rowPitch = surface->u.legacy.level[level].nblk_x * surface->bpe;
> + pLayout->arrayPitch = surface->u.legacy.level[level].slice_size;
> + pLayout->depthPitch = surface->u.legacy.level[level].slice_size;
> + pLayout->size = surface->u.legacy.level[level].slice_size;
> + if (image->type == VK_IMAGE_TYPE_3D)
> + pLayout->size *= u_minify(image->info.depth, level);
> + }
> }
>
>
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list