panvk: Make panvk_image_view per-gen

This way we can use mali_xxx_packed structs for the descriptor
templates.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28170>
This commit is contained in:
Boris Brezillon
2023-12-19 15:42:50 +01:00
committed by Marge Bot
parent 4aeb7aa22f
commit 9ff7971b16
3 changed files with 14 additions and 13 deletions
+9 -5
View File
@@ -6,16 +6,19 @@
#ifndef PANVK_IMAGE_VIEW_H
#define PANVK_IMAGE_VIEW_H
#ifndef PAN_ARCH
#error "PAN_ARCH must be defined"
#endif
#include <stdint.h>
#include "vk_image.h"
#include "pan_texture.h"
struct panvk_priv_bo;
#include "genxml/gen_macros.h"
#define TEXTURE_DESC_WORDS 8
#define ATTRIB_BUF_DESC_WORDS 4
struct panvk_priv_bo;
struct panvk_image_view {
struct vk_image_view vk;
@@ -23,9 +26,10 @@ struct panvk_image_view {
struct pan_image_view pview;
struct panvk_priv_bo *bo;
struct {
uint32_t tex[TEXTURE_DESC_WORDS];
uint32_t img_attrib_buf[ATTRIB_BUF_DESC_WORDS * 2];
struct mali_texture_packed tex;
struct mali_attribute_buffer_packed img_attrib_buf[2];
} descs;
};
@@ -296,7 +296,7 @@ panvk_write_tex_desc(struct panvk_descriptor_set *set, uint32_t binding,
{
VK_FROM_HANDLE(panvk_image_view, view, pImageInfo->imageView);
memcpy(panvk_tex_desc(set, binding, elem), view->descs.tex,
memcpy(panvk_tex_desc(set, binding, elem), view->descs.tex.opaque,
pan_size(TEXTURE));
panvk_fill_image_desc(panvk_desc_ubo_data(set, binding, elem), view);
+4 -7
View File
@@ -105,18 +105,15 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
view->bo = panvk_priv_bo_create(device, bo_size, 0, pAllocator,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
STATIC_ASSERT(sizeof(view->descs.tex) >= pan_size(TEXTURE));
struct panfrost_ptr ptr = {
.gpu = view->bo->addr.dev,
.cpu = view->bo->addr.host,
};
GENX(panfrost_new_texture)(&view->pview, &view->descs.tex, &ptr);
GENX(panfrost_new_texture)(&view->pview, view->descs.tex.opaque, &ptr);
}
if (view->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) {
uint8_t *attrib_buf = (uint8_t *)view->descs.img_attrib_buf;
bool is_3d = image->pimage.layout.dim == MALI_TEXTURE_DIMENSION_3D;
unsigned offset = image->pimage.data.offset;
offset +=
@@ -124,7 +121,7 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
is_3d ? 0 : view->pview.first_layer,
is_3d ? view->pview.first_layer : 0);
pan_pack(attrib_buf, ATTRIBUTE_BUFFER, cfg) {
pan_pack(view->descs.img_attrib_buf[0].opaque, ATTRIBUTE_BUFFER, cfg) {
cfg.type = image->pimage.layout.modifier == DRM_FORMAT_MOD_LINEAR
? MALI_ATTRIBUTE_TYPE_3D_LINEAR
: MALI_ATTRIBUTE_TYPE_3D_INTERLEAVED;
@@ -133,8 +130,8 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
cfg.size = pan_kmod_bo_size(image->bo) - offset;
}
attrib_buf += pan_size(ATTRIBUTE_BUFFER);
pan_pack(attrib_buf, ATTRIBUTE_BUFFER_CONTINUATION_3D, cfg) {
pan_pack(view->descs.img_attrib_buf[1].opaque,
ATTRIBUTE_BUFFER_CONTINUATION_3D, cfg) {
unsigned level = view->pview.first_level;
cfg.s_dimension = u_minify(image->pimage.layout.width, level);