panvk: Transition panvk_{image,buffer}_view to panvk_priv_bo

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Constantine Shablya <constantine.shablya@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26698>
This commit is contained in:
Boris Brezillon
2023-12-11 15:24:02 +01:00
committed by Marge Bot
parent d09f388824
commit 01c7abf56f
3 changed files with 17 additions and 13 deletions

View File

@@ -265,7 +265,7 @@ panvk_DestroyImageView(VkDevice _device, VkImageView _view,
if (!view)
return;
panfrost_bo_unreference(view->bo);
panvk_priv_bo_destroy(view->bo, NULL);
vk_image_view_destroy(&device->vk, pAllocator, &view->vk);
}
@@ -279,7 +279,7 @@ panvk_DestroyBufferView(VkDevice _device, VkBufferView bufferView,
if (!view)
return;
panfrost_bo_unreference(view->bo);
panvk_priv_bo_destroy(view->bo, pAllocator);
vk_object_free(&device->vk, pAllocator, view);
}

View File

@@ -967,7 +967,7 @@ struct panvk_image_view {
struct pan_image_view pview;
struct panfrost_bo *bo;
struct panvk_priv_bo *bo;
struct {
uint32_t tex[TEXTURE_DESC_WORDS];
uint32_t img_attrib_buf[ATTRIB_BUF_DESC_WORDS * 2];
@@ -983,7 +983,7 @@ struct panvk_sampler {
struct panvk_buffer_view {
struct vk_object_base base;
struct panfrost_bo *bo;
struct panvk_priv_bo *bo;
struct {
uint32_t tex[TEXTURE_DESC_WORDS];
uint32_t img_attrib_buf[ATTRIB_BUF_DESC_WORDS * 2];

View File

@@ -113,19 +113,23 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
};
panvk_convert_swizzle(&view->vk.swizzle, view->pview.swizzle);
struct panfrost_device *pdev = &device->pdev;
if (view->vk.usage &
(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) {
unsigned bo_size =
GENX(panfrost_estimate_texture_payload_size)(&view->pview) +
pan_size(TEXTURE);
view->bo = panfrost_bo_create(pdev, bo_size, 0, "Texture descriptor");
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));
GENX(panfrost_new_texture)
(&view->pview, &view->descs.tex, &view->bo->ptr);
struct panfrost_ptr ptr = {
.gpu = view->bo->addr.dev,
.cpu = view->bo->addr.host,
};
GENX(panfrost_new_texture)(&view->pview, &view->descs.tex, &ptr);
}
if (view->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) {
@@ -185,7 +189,6 @@ panvk_per_arch(CreateBufferView)(VkDevice _device,
view->fmt = vk_format_to_pipe_format(pCreateInfo->format);
struct panfrost_device *pdev = &device->pdev;
mali_ptr address = panvk_buffer_gpu_ptr(buffer, pCreateInfo->offset);
unsigned size =
panvk_buffer_range(buffer, pCreateInfo->offset, pCreateInfo->range);
@@ -196,9 +199,10 @@ panvk_per_arch(CreateBufferView)(VkDevice _device,
if (buffer->vk.usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) {
unsigned bo_size = pan_size(SURFACE_WITH_STRIDE);
view->bo = panfrost_bo_create(pdev, bo_size, 0, "Texture descriptor");
view->bo = panvk_priv_bo_create(device, bo_size, 0, pAllocator,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
pan_pack(view->bo->ptr.cpu, SURFACE_WITH_STRIDE, cfg) {
pan_pack(view->bo->addr.host, SURFACE_WITH_STRIDE, cfg) {
cfg.pointer = address;
}
@@ -211,7 +215,7 @@ panvk_per_arch(CreateBufferView)(VkDevice _device,
cfg.texel_ordering = MALI_TEXTURE_LAYOUT_LINEAR;
cfg.levels = 1;
cfg.array_size = 1;
cfg.surfaces = view->bo->ptr.gpu;
cfg.surfaces = view->bo->addr.dev;
cfg.maximum_lod = cfg.minimum_lod = 0;
}
}