1 /* 2 * Copyright © 2024 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 #ifndef ANV_RMV_H 25 #define ANV_RMV_H 26 27 #include <stdbool.h> 28 #include <stdint.h> 29 30 #include "vulkan/vulkan_core.h" 31 32 struct anv_device; 33 struct anv_device_memory; 34 struct anv_physical_device; 35 struct anv_descriptor_pool; 36 struct anv_buffer; 37 struct anv_image; 38 struct anv_bo; 39 struct anv_event; 40 struct anv_graphics_pipeline; 41 struct anv_compute_pipeline; 42 struct anv_ray_tracing_pipeline; 43 44 enum anv_image_memory_binding; 45 46 #define ANV_RMV(func, device, ...) do { \ 47 if (unlikely((device)->vk.memory_trace_data.is_enabled)) \ 48 anv_rmv_log_##func(device, __VA_ARGS__); \ 49 } while (0) 50 51 void anv_memory_trace_init(struct anv_device *device); 52 void anv_rmv_fill_device_info(const struct anv_physical_device *device, 53 struct vk_rmv_device_info *info); 54 void anv_memory_trace_finish(struct anv_device *device); 55 56 void anv_rmv_log_heap_create(struct anv_device *device, 57 struct anv_device_memory *memory, 58 bool is_internal, 59 VkMemoryAllocateFlags alloc_flags); 60 void anv_rmv_log_bo_gtt_map(struct anv_device *device, 61 struct anv_bo *bo); 62 void anv_rmv_log_bo_gtt_unmap(struct anv_device *device, 63 struct anv_bo *bo); 64 void anv_rmv_log_bos_gtt_map(struct anv_device *device, 65 struct anv_bo **bos, 66 uint32_t bo_count); 67 void anv_rmv_log_vm_binds(struct anv_device *device, 68 struct anv_vm_bind *binds, 69 uint32_t bind_count); 70 void anv_rmv_log_bo_allocate(struct anv_device *device, 71 struct anv_bo *bo); 72 void anv_rmv_log_bo_destroy(struct anv_device *device, struct anv_bo *bo); 73 void anv_rmv_log_buffer_create(struct anv_device *device, 74 bool is_internal, 75 struct anv_buffer *buffer); 76 void anv_rmv_log_buffer_destroy(struct anv_device *device, 77 struct anv_buffer *buffer); 78 void anv_rmv_log_buffer_bind(struct anv_device *device, struct anv_buffer *buffer); 79 void anv_rmv_log_image_create(struct anv_device *device, 80 bool is_internal, 81 struct anv_image *image); 82 void anv_rmv_log_image_destroy(struct anv_device *device, 83 struct anv_image *image); 84 void anv_rmv_log_image_bind(struct anv_device *device, 85 struct anv_image *image, 86 enum anv_image_memory_binding binding); 87 void anv_rmv_log_query_pool_create(struct anv_device *device, 88 struct anv_query_pool *pool, 89 bool is_internal); 90 void anv_rmv_log_cmd_buffer_create(struct anv_device *device, 91 struct anv_cmd_buffer *cmd_buffer); 92 void anv_rmv_log_cmd_buffer_destroy(struct anv_device *device, 93 struct anv_cmd_buffer *cmd_buffer); 94 void anv_rmv_log_sparse_add_residency(struct anv_device *device, 95 struct anv_bo *src_bo, 96 uint64_t offset); 97 void anv_rmv_log_sparse_remove_residency(struct anv_device *device, 98 struct anv_bo *src_bo, 99 uint64_t offset); 100 void anv_rmv_log_descriptor_pool_create(struct anv_device *device, 101 const VkDescriptorPoolCreateInfo *create_info, 102 struct anv_descriptor_pool *pool, 103 bool is_internal); 104 void anv_rmv_log_graphics_pipeline_create(struct anv_device *device, 105 struct anv_graphics_pipeline *pipeline, 106 bool is_internal); 107 void anv_rmv_log_compute_pipeline_create(struct anv_device *device, 108 struct anv_compute_pipeline *pipeline, 109 bool is_internal); 110 void anv_rmv_log_rt_pipeline_create(struct anv_device *device, 111 struct anv_ray_tracing_pipeline *pipeline, 112 bool is_internal); 113 void anv_rmv_log_event_create(struct anv_device *device, 114 struct anv_event *event, 115 VkEventCreateFlags flags, bool is_internal); 116 void anv_rmv_log_resource_destroy(struct anv_device *device, const void *obj); 117 118 #endif /* ANV_RMV_H */ 119