panvk: Prepare for Valhall image views

There's no image attribute on Valhall, storage images are passed as
texture descriptors.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29654>
This commit is contained in:
Boris Brezillon 2024-02-02 12:53:24 +01:00 committed by Marge Bot
parent 1aab0fc4f5
commit 970d382117
2 changed files with 15 additions and 2 deletions

View file

@ -29,7 +29,11 @@ struct panvk_image_view {
struct {
struct mali_texture_packed tex;
#if PAN_ARCH <= 7
/* Valhall passes a texture descriptor to the LEA_TEX instruction. */
struct mali_attribute_buffer_packed img_attrib_buf[2];
#endif
} descs;
};

View file

@ -115,8 +115,15 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
view->vk.view_format == VK_FORMAT_S8_UINT)
view->pview.format = PIPE_FORMAT_X32_S8X24_UINT;
if (view->vk.usage &
(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) {
VkImageUsageFlags tex_usage_mask =
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
#if PAN_ARCH >= 9
/* Valhall passes a texture descriptor to LEA_TEX. */
tex_usage_mask |= VK_IMAGE_USAGE_STORAGE_BIT;
#endif
if (view->vk.usage & tex_usage_mask) {
/* Use a temporary pan_image_view so we can tweak it for texture
* descriptor emission without changing the original definition.
*/
@ -150,6 +157,7 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
GENX(panfrost_new_texture)(&pview, view->descs.tex.opaque, &ptr);
}
#if PAN_ARCH <= 7
if (view->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) {
bool is_3d = image->pimage.layout.dim == MALI_TEXTURE_DIMENSION_3D;
unsigned offset = image->pimage.data.offset;
@ -184,6 +192,7 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
}
}
}
#endif
*pView = panvk_image_view_to_handle(view);
return VK_SUCCESS;