1 /* 2 * Copyright © 2022 Collabora Ltd. and Red Hat Inc. 3 * SPDX-License-Identifier: MIT 4 */ 5 #ifndef NVK_CMD_POOL_H 6 #define NVK_CMD_POOL_H 7 8 #include "nvk_private.h" 9 10 #include "vk_command_pool.h" 11 12 #define NVK_CMD_BO_SIZE 64*1024 13 14 /* Recyclable command buffer BO, used for both push buffers and upload */ 15 struct nvk_cmd_bo { 16 struct nouveau_ws_bo *bo; 17 18 void *map; 19 20 /** Link in nvk_cmd_pool::free_bos or nvk_cmd_buffer::bos */ 21 struct list_head link; 22 }; 23 24 struct nvk_cmd_pool { 25 struct vk_command_pool vk; 26 27 /** List of nvk_cmd_bo */ 28 struct list_head free_bos; 29 struct list_head free_gart_bos; 30 }; 31 32 VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_cmd_pool, vk.base, VkCommandPool, 33 VK_OBJECT_TYPE_COMMAND_POOL) 34 35 static inline struct nvk_device * nvk_cmd_pool_device(struct nvk_cmd_pool * pool)36nvk_cmd_pool_device(struct nvk_cmd_pool *pool) 37 { 38 return (struct nvk_device *)pool->vk.base.device; 39 } 40 41 VkResult nvk_cmd_pool_alloc_bo(struct nvk_cmd_pool *pool, 42 bool force_gart, 43 struct nvk_cmd_bo **bo_out); 44 45 void nvk_cmd_pool_free_bo_list(struct nvk_cmd_pool *pool, 46 struct list_head *bos); 47 void nvk_cmd_pool_free_gart_bo_list(struct nvk_cmd_pool *pool, 48 struct list_head *bos); 49 #endif /* NVK_CMD_POOL_H */ 50