1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright 2019 Google LLC 3bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * based in part on anv and radv which are: 6bf215546Sopenharmony_ci * Copyright © 2015 Intel Corporation 7bf215546Sopenharmony_ci * Copyright © 2016 Red Hat. 8bf215546Sopenharmony_ci * Copyright © 2016 Bas Nieuwenhuizen 9bf215546Sopenharmony_ci */ 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ci#ifndef VN_BUFFER_H 12bf215546Sopenharmony_ci#define VN_BUFFER_H 13bf215546Sopenharmony_ci 14bf215546Sopenharmony_ci#include "vn_common.h" 15bf215546Sopenharmony_ci 16bf215546Sopenharmony_cistruct vn_buffer_memory_requirements { 17bf215546Sopenharmony_ci VkMemoryRequirements2 memory; 18bf215546Sopenharmony_ci VkMemoryDedicatedRequirements dedicated; 19bf215546Sopenharmony_ci}; 20bf215546Sopenharmony_ci 21bf215546Sopenharmony_cistruct vn_buffer_cache_entry { 22bf215546Sopenharmony_ci const VkBufferCreateInfo *create_info; 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci struct vn_buffer_memory_requirements requirements; 25bf215546Sopenharmony_ci}; 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_cistruct vn_buffer_cache { 28bf215546Sopenharmony_ci /* cache memory type requirement for AHB backed VkBuffer */ 29bf215546Sopenharmony_ci uint32_t ahb_mem_type_bits; 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci uint64_t max_buffer_size; 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci /* cache memory requirements for common native buffer infos */ 34bf215546Sopenharmony_ci struct vn_buffer_cache_entry *entries; 35bf215546Sopenharmony_ci uint32_t entry_count; 36bf215546Sopenharmony_ci}; 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_cistruct vn_buffer { 39bf215546Sopenharmony_ci struct vn_object_base base; 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci struct vn_buffer_memory_requirements requirements; 42bf215546Sopenharmony_ci}; 43bf215546Sopenharmony_ciVK_DEFINE_NONDISP_HANDLE_CASTS(vn_buffer, 44bf215546Sopenharmony_ci base.base, 45bf215546Sopenharmony_ci VkBuffer, 46bf215546Sopenharmony_ci VK_OBJECT_TYPE_BUFFER) 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_cistruct vn_buffer_view { 49bf215546Sopenharmony_ci struct vn_object_base base; 50bf215546Sopenharmony_ci}; 51bf215546Sopenharmony_ciVK_DEFINE_NONDISP_HANDLE_CASTS(vn_buffer_view, 52bf215546Sopenharmony_ci base.base, 53bf215546Sopenharmony_ci VkBufferView, 54bf215546Sopenharmony_ci VK_OBJECT_TYPE_BUFFER_VIEW) 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ciVkResult 57bf215546Sopenharmony_civn_buffer_create(struct vn_device *dev, 58bf215546Sopenharmony_ci const VkBufferCreateInfo *create_info, 59bf215546Sopenharmony_ci const VkAllocationCallbacks *alloc, 60bf215546Sopenharmony_ci struct vn_buffer **out_buf); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ciVkResult 63bf215546Sopenharmony_civn_buffer_cache_init(struct vn_device *dev); 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_civoid 66bf215546Sopenharmony_civn_buffer_cache_fini(struct vn_device *dev); 67bf215546Sopenharmony_ci 68bf215546Sopenharmony_ci#endif /* VN_BUFFER_H */ 69