radv: implement VK_EXT_device_address_binding_report
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28373>
This commit is contained in:
committed by
Marge Bot
parent
34e8e5d76f
commit
db736ebf53
@@ -77,9 +77,10 @@ alloc_transfer_temp_bo(struct radv_cmd_buffer *cmd_buffer)
|
||||
return true;
|
||||
|
||||
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
|
||||
const VkResult r = radv_bo_create(device, RADV_SDMA_TRANSFER_TEMP_BYTES, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_NO_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &cmd_buffer->transfer.copy_temp);
|
||||
const VkResult r =
|
||||
radv_bo_create(device, &cmd_buffer->vk.base, RADV_SDMA_TRANSFER_TEMP_BYTES, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_NO_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING, RADV_BO_PRIORITY_SCRATCH, 0, true,
|
||||
&cmd_buffer->transfer.copy_temp);
|
||||
|
||||
if (r != VK_SUCCESS) {
|
||||
vk_command_buffer_set_error(&cmd_buffer->vk, r);
|
||||
|
||||
@@ -661,19 +661,19 @@ radv_import_ahb_memory(struct radv_device *device, struct radv_device_memory *me
|
||||
|
||||
result = radv_image_create_layout(device, create_info, NULL, NULL, mem->image);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_bo_destroy(device, mem->bo);
|
||||
radv_bo_destroy(device, NULL, mem->bo);
|
||||
mem->bo = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (alloc_size < mem->image->size) {
|
||||
radv_bo_destroy(device, mem->bo);
|
||||
radv_bo_destroy(device, NULL, mem->bo);
|
||||
mem->bo = NULL;
|
||||
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
}
|
||||
} else if (mem->buffer) {
|
||||
if (alloc_size < mem->buffer->vk.size) {
|
||||
radv_bo_destroy(device, mem->bo);
|
||||
radv_bo_destroy(device, NULL, mem->bo);
|
||||
mem->bo = NULL;
|
||||
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "radv_private.h"
|
||||
|
||||
#include "vk_common_entrypoints.h"
|
||||
#include "vk_debug_utils.h"
|
||||
|
||||
void
|
||||
radv_buffer_init(struct radv_buffer *buffer, struct radv_device *device, struct radeon_winsys_bo *bo, uint64_t size,
|
||||
@@ -55,7 +56,7 @@ static void
|
||||
radv_destroy_buffer(struct radv_device *device, const VkAllocationCallbacks *pAllocator, struct radv_buffer *buffer)
|
||||
{
|
||||
if ((buffer->vk.create_flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) && buffer->bo)
|
||||
radv_bo_destroy(device, buffer->bo);
|
||||
radv_bo_destroy(device, &buffer->vk.base, buffer->bo);
|
||||
|
||||
radv_rmv_log_resource_destroy(device, (uint64_t)radv_buffer_to_handle(buffer));
|
||||
radv_buffer_finish(buffer);
|
||||
@@ -99,8 +100,8 @@ radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreate
|
||||
if (replay_info && replay_info->opaqueCaptureAddress)
|
||||
replay_address = replay_info->opaqueCaptureAddress;
|
||||
|
||||
VkResult result = radv_bo_create(device, align64(buffer->vk.size, 4096), 4096, 0, flags, RADV_BO_PRIORITY_VIRTUAL,
|
||||
replay_address, is_internal, &buffer->bo);
|
||||
VkResult result = radv_bo_create(device, &buffer->vk.base, align64(buffer->vk.size, 4096), 4096, 0, flags,
|
||||
RADV_BO_PRIORITY_VIRTUAL, replay_address, is_internal, &buffer->bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_buffer(device, pAllocator, buffer);
|
||||
return vk_error(device, result);
|
||||
@@ -138,6 +139,8 @@ VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_BindBufferMemory2(VkDevice _device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
|
||||
for (uint32_t i = 0; i < bindInfoCount; ++i) {
|
||||
RADV_FROM_HANDLE(radv_device_memory, mem, pBindInfos[i].memory);
|
||||
@@ -168,6 +171,9 @@ radv_BindBufferMemory2(VkDevice _device, uint32_t bindInfoCount, const VkBindBuf
|
||||
buffer->bo = mem->bo;
|
||||
buffer->offset = pBindInfos[i].memoryOffset;
|
||||
radv_rmv_log_buffer_bind(device, pBindInfos[i].buffer);
|
||||
|
||||
vk_address_binding_report(&instance->vk, &buffer->vk.base, radv_buffer_get_va(buffer->bo) + buffer->offset,
|
||||
buffer->bo->size, VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT);
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -262,10 +268,12 @@ radv_GetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressI
|
||||
}
|
||||
|
||||
VkResult
|
||||
radv_bo_create(struct radv_device *device, uint64_t size, unsigned alignment, enum radeon_bo_domain domain,
|
||||
enum radeon_bo_flag flags, unsigned priority, uint64_t address, bool is_internal,
|
||||
struct radeon_winsys_bo **out_bo)
|
||||
radv_bo_create(struct radv_device *device, struct vk_object_base *object, uint64_t size, unsigned alignment,
|
||||
enum radeon_bo_domain domain, enum radeon_bo_flag flags, unsigned priority, uint64_t address,
|
||||
bool is_internal, struct radeon_winsys_bo **out_bo)
|
||||
{
|
||||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
struct radeon_winsys *ws = device->ws;
|
||||
VkResult result;
|
||||
|
||||
@@ -275,23 +283,32 @@ radv_bo_create(struct radv_device *device, uint64_t size, unsigned alignment, en
|
||||
|
||||
radv_rmv_log_bo_allocate(device, *out_bo, is_internal);
|
||||
|
||||
vk_address_binding_report(&instance->vk, object ? object : &device->vk.base, radv_buffer_get_va(*out_bo),
|
||||
(*out_bo)->size, VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
radv_bo_destroy(struct radv_device *device, struct radeon_winsys_bo *bo)
|
||||
radv_bo_destroy(struct radv_device *device, struct vk_object_base *object, struct radeon_winsys_bo *bo)
|
||||
{
|
||||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
struct radeon_winsys *ws = device->ws;
|
||||
|
||||
radv_rmv_log_bo_destroy(device, bo);
|
||||
|
||||
vk_address_binding_report(&instance->vk, object ? object : &device->vk.base, radv_buffer_get_va(bo), bo->size,
|
||||
VK_DEVICE_ADDRESS_BINDING_TYPE_UNBIND_EXT);
|
||||
|
||||
ws->buffer_destroy(ws, bo);
|
||||
}
|
||||
|
||||
VkResult
|
||||
radv_bo_virtual_bind(struct radv_device *device, struct radeon_winsys_bo *parent, uint64_t offset, uint64_t size,
|
||||
struct radeon_winsys_bo *bo, uint64_t bo_offset)
|
||||
radv_bo_virtual_bind(struct radv_device *device, struct vk_object_base *object, struct radeon_winsys_bo *parent,
|
||||
uint64_t offset, uint64_t size, struct radeon_winsys_bo *bo, uint64_t bo_offset)
|
||||
{
|
||||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
struct radeon_winsys *ws = device->ws;
|
||||
VkResult result;
|
||||
|
||||
@@ -304,5 +321,8 @@ radv_bo_virtual_bind(struct radv_device *device, struct radeon_winsys_bo *parent
|
||||
else
|
||||
radv_rmv_log_sparse_remove_residency(device, parent, offset);
|
||||
|
||||
vk_address_binding_report(&instance->vk, object, radv_buffer_get_va(parent) + offset, size,
|
||||
bo ? VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT : VK_DEVICE_ADDRESS_BINDING_TYPE_UNBIND_EXT);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -51,13 +51,14 @@ void radv_buffer_finish(struct radv_buffer *buffer);
|
||||
VkResult radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer, bool is_internal);
|
||||
|
||||
VkResult radv_bo_create(struct radv_device *device, uint64_t size, unsigned alignment, enum radeon_bo_domain domain,
|
||||
enum radeon_bo_flag flags, unsigned priority, uint64_t address, bool is_internal,
|
||||
struct radeon_winsys_bo **out_bo);
|
||||
VkResult radv_bo_create(struct radv_device *device, struct vk_object_base *object, uint64_t size, unsigned alignment,
|
||||
enum radeon_bo_domain domain, enum radeon_bo_flag flags, unsigned priority, uint64_t address,
|
||||
bool is_internal, struct radeon_winsys_bo **out_bo);
|
||||
|
||||
VkResult radv_bo_virtual_bind(struct radv_device *device, struct radeon_winsys_bo *parent, uint64_t offset,
|
||||
uint64_t size, struct radeon_winsys_bo *bo, uint64_t bo_offset);
|
||||
VkResult radv_bo_virtual_bind(struct radv_device *device, struct vk_object_base *object,
|
||||
struct radeon_winsys_bo *parent, uint64_t offset, uint64_t size,
|
||||
struct radeon_winsys_bo *bo, uint64_t bo_offset);
|
||||
|
||||
void radv_bo_destroy(struct radv_device *device, struct radeon_winsys_bo *bo);
|
||||
void radv_bo_destroy(struct radv_device *device, struct vk_object_base *object, struct radeon_winsys_bo *bo);
|
||||
|
||||
#endif /* RADV_BUFFER_H */
|
||||
|
||||
@@ -334,14 +334,14 @@ radv_destroy_cmd_buffer(struct vk_command_buffer *vk_cmd_buffer)
|
||||
|
||||
list_for_each_entry_safe (struct radv_cmd_buffer_upload, up, &cmd_buffer->upload.list, list) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, up->upload_bo);
|
||||
radv_bo_destroy(device, up->upload_bo);
|
||||
radv_bo_destroy(device, &cmd_buffer->vk.base, up->upload_bo);
|
||||
list_del(&up->list);
|
||||
free(up);
|
||||
}
|
||||
|
||||
if (cmd_buffer->upload.upload_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, cmd_buffer->upload.upload_bo);
|
||||
radv_bo_destroy(device, cmd_buffer->upload.upload_bo);
|
||||
radv_bo_destroy(device, &cmd_buffer->vk.base, cmd_buffer->upload.upload_bo);
|
||||
}
|
||||
|
||||
if (cmd_buffer->cs)
|
||||
@@ -349,7 +349,7 @@ radv_destroy_cmd_buffer(struct vk_command_buffer *vk_cmd_buffer)
|
||||
if (cmd_buffer->gang.cs)
|
||||
device->ws->cs_destroy(cmd_buffer->gang.cs);
|
||||
if (cmd_buffer->transfer.copy_temp)
|
||||
radv_bo_destroy(device, cmd_buffer->transfer.copy_temp);
|
||||
radv_bo_destroy(device, &cmd_buffer->vk.base, cmd_buffer->transfer.copy_temp);
|
||||
|
||||
radv_cmd_buffer_finish_shader_part_cache(cmd_buffer);
|
||||
|
||||
@@ -440,7 +440,7 @@ radv_reset_cmd_buffer(struct vk_command_buffer *vk_cmd_buffer, UNUSED VkCommandB
|
||||
|
||||
list_for_each_entry_safe (struct radv_cmd_buffer_upload, up, &cmd_buffer->upload.list, list) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, up->upload_bo);
|
||||
radv_bo_destroy(device, up->upload_bo);
|
||||
radv_bo_destroy(device, &cmd_buffer->vk.base, up->upload_bo);
|
||||
list_del(&up->list);
|
||||
free(up);
|
||||
}
|
||||
@@ -499,7 +499,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer *cmd_buffer, uint64_t m
|
||||
new_size = MAX2(new_size, 2 * cmd_buffer->upload.size);
|
||||
|
||||
VkResult result = radv_bo_create(
|
||||
device, new_size, 4096, device->ws->cs_domain(device->ws),
|
||||
device, &cmd_buffer->vk.base, new_size, 4096, device->ws->cs_domain(device->ws),
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_32BIT | RADEON_FLAG_GTT_WC,
|
||||
RADV_BO_PRIORITY_UPLOAD_BUFFER, 0, true, &bo);
|
||||
|
||||
@@ -514,7 +514,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer *cmd_buffer, uint64_t m
|
||||
|
||||
if (!upload) {
|
||||
vk_command_buffer_set_error(&cmd_buffer->vk, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
radv_bo_destroy(device, bo);
|
||||
radv_bo_destroy(device, &cmd_buffer->vk.base, bo);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -531,6 +531,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer *cmd_buffer, uint64_t m
|
||||
vk_command_buffer_set_error(&cmd_buffer->vk, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
return false;
|
||||
}
|
||||
|
||||
radv_rmv_log_command_buffer_bo_create(device, cmd_buffer->upload.upload_bo, 0, cmd_buffer->upload.size, 0);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -51,9 +51,9 @@ radv_create_shadow_regs_preamble(struct radv_device *device, struct radv_queue_s
|
||||
radeon_check_space(ws, cs, 256);
|
||||
|
||||
/* allocate memory for queue_state->shadowed_regs where register states are saved */
|
||||
result = radv_bo_create(device, SI_SHADOWED_REG_BUFFER_SIZE, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_ZERO_VRAM | RADEON_FLAG_NO_INTERPROCESS_SHARING, RADV_BO_PRIORITY_SCRATCH, 0,
|
||||
true, &queue_state->shadowed_regs);
|
||||
result = radv_bo_create(device, NULL, SI_SHADOWED_REG_BUFFER_SIZE, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_ZERO_VRAM | RADEON_FLAG_NO_INTERPROCESS_SHARING, RADV_BO_PRIORITY_SCRATCH, 0,
|
||||
true, &queue_state->shadowed_regs);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
@@ -69,7 +69,7 @@ radv_create_shadow_regs_preamble(struct radv_device *device, struct radv_queue_s
|
||||
}
|
||||
|
||||
result = radv_bo_create(
|
||||
device, cs->cdw * 4, 4096, ws->cs_domain(ws),
|
||||
device, NULL, cs->cdw * 4, 4096, ws->cs_domain(ws),
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_READ_ONLY | RADEON_FLAG_GTT_WC,
|
||||
RADV_BO_PRIORITY_CS, 0, true, &queue_state->shadow_regs_ib);
|
||||
if (result != VK_SUCCESS)
|
||||
@@ -90,10 +90,10 @@ radv_create_shadow_regs_preamble(struct radv_device *device, struct radv_queue_s
|
||||
ws->cs_destroy(cs);
|
||||
return VK_SUCCESS;
|
||||
fail_map:
|
||||
radv_bo_destroy(device, queue_state->shadow_regs_ib);
|
||||
radv_bo_destroy(device, NULL, queue_state->shadow_regs_ib);
|
||||
queue_state->shadow_regs_ib = NULL;
|
||||
fail_ib_buffer:
|
||||
radv_bo_destroy(device, queue_state->shadowed_regs);
|
||||
radv_bo_destroy(device, NULL, queue_state->shadowed_regs);
|
||||
queue_state->shadowed_regs = NULL;
|
||||
fail:
|
||||
ws->cs_destroy(cs);
|
||||
@@ -105,9 +105,9 @@ radv_destroy_shadow_regs_preamble(struct radv_device *device, struct radv_queue_
|
||||
struct radeon_winsys *ws)
|
||||
{
|
||||
if (queue_state->shadow_regs_ib)
|
||||
radv_bo_destroy(device, queue_state->shadow_regs_ib);
|
||||
radv_bo_destroy(device, NULL, queue_state->shadow_regs_ib);
|
||||
if (queue_state->shadowed_regs)
|
||||
radv_bo_destroy(device, queue_state->shadowed_regs);
|
||||
radv_bo_destroy(device, NULL, queue_state->shadowed_regs);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -71,7 +71,7 @@ radv_init_trace(struct radv_device *device)
|
||||
VkResult result;
|
||||
|
||||
result = radv_bo_create(
|
||||
device, TRACE_BO_SIZE, 8, RADEON_DOMAIN_VRAM,
|
||||
device, NULL, TRACE_BO_SIZE, 8, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM | RADEON_FLAG_VA_UNCACHED,
|
||||
RADV_BO_PRIORITY_UPLOAD_BUFFER, 0, true, &device->trace_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
@@ -95,7 +95,7 @@ radv_finish_trace(struct radv_device *device)
|
||||
|
||||
if (unlikely(device->trace_bo)) {
|
||||
ws->buffer_make_resident(ws, device->trace_bo, false);
|
||||
radv_bo_destroy(device, device->trace_bo);
|
||||
radv_bo_destroy(device, NULL, device->trace_bo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ radv_trap_handler_init(struct radv_device *device)
|
||||
return false;
|
||||
|
||||
result = radv_bo_create(
|
||||
device, TMA_BO_SIZE, 256, RADEON_DOMAIN_VRAM,
|
||||
device, NULL, TMA_BO_SIZE, 256, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM | RADEON_FLAG_32BIT,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &device->tma_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
@@ -967,7 +967,7 @@ radv_trap_handler_finish(struct radv_device *device)
|
||||
|
||||
if (unlikely(device->tma_bo)) {
|
||||
ws->buffer_make_resident(ws, device->tma_bo, false);
|
||||
radv_bo_destroy(device, device->tma_bo);
|
||||
radv_bo_destroy(device, NULL, device->tma_bo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -786,7 +786,7 @@ radv_destroy_descriptor_pool(struct radv_device *device, const VkAllocationCallb
|
||||
}
|
||||
|
||||
if (pool->bo)
|
||||
radv_bo_destroy(device, pool->bo);
|
||||
radv_bo_destroy(device, &pool->base, pool->bo);
|
||||
if (pool->host_bo)
|
||||
vk_free2(&device->vk.alloc, pAllocator, pool->host_bo);
|
||||
|
||||
@@ -921,8 +921,8 @@ radv_create_descriptor_pool(struct radv_device *device, const VkDescriptorPoolCr
|
||||
if (instance->drirc.zero_vram)
|
||||
flags |= RADEON_FLAG_ZERO_VRAM;
|
||||
|
||||
VkResult result = radv_bo_create(device, bo_size, 32, RADEON_DOMAIN_VRAM, flags, RADV_BO_PRIORITY_DESCRIPTOR,
|
||||
0, false, &pool->bo);
|
||||
VkResult result = radv_bo_create(device, &pool->base, bo_size, 32, RADEON_DOMAIN_VRAM, flags,
|
||||
RADV_BO_PRIORITY_DESCRIPTOR, 0, false, &pool->bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_descriptor_pool(device, pAllocator, pool);
|
||||
return vk_error(device, result);
|
||||
|
||||
@@ -121,7 +121,7 @@ radv_device_init_border_color(struct radv_device *device)
|
||||
{
|
||||
VkResult result;
|
||||
|
||||
result = radv_bo_create(device, RADV_BORDER_COLOR_BUFFER_SIZE, 4096, RADEON_DOMAIN_VRAM,
|
||||
result = radv_bo_create(device, NULL, RADV_BORDER_COLOR_BUFFER_SIZE, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_READ_ONLY | RADEON_FLAG_NO_INTERPROCESS_SHARING,
|
||||
RADV_BO_PRIORITY_SHADER, 0, true, &device->border_color_data.bo);
|
||||
|
||||
@@ -148,7 +148,7 @@ radv_device_finish_border_color(struct radv_device *device)
|
||||
if (device->border_color_data.bo) {
|
||||
radv_rmv_log_border_color_palette_destroy(device, device->border_color_data.bo);
|
||||
device->ws->buffer_make_resident(device->ws, device->border_color_data.bo, false);
|
||||
radv_bo_destroy(device, device->border_color_data.bo);
|
||||
radv_bo_destroy(device, NULL, device->border_color_data.bo);
|
||||
|
||||
mtx_destroy(&device->border_color_data.mutex);
|
||||
}
|
||||
@@ -1001,9 +1001,9 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
||||
|
||||
if (device->vk.enabled_features.performanceCounterQueryPools) {
|
||||
size_t bo_size = PERF_CTR_BO_PASS_OFFSET + sizeof(uint64_t) * PERF_CTR_MAX_PASSES;
|
||||
result = radv_bo_create(device, bo_size, 4096, RADEON_DOMAIN_GTT,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
|
||||
RADV_BO_PRIORITY_UPLOAD_BUFFER, 0, true, &device->perf_counter_bo);
|
||||
result = radv_bo_create(device, NULL, bo_size, 4096, RADEON_DOMAIN_GTT,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
|
||||
RADV_BO_PRIORITY_UPLOAD_BUFFER, 0, true, &device->perf_counter_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_cache;
|
||||
|
||||
@@ -1059,9 +1059,9 @@ fail:
|
||||
|
||||
radv_device_finish_perf_counter_lock_cs(device);
|
||||
if (device->perf_counter_bo)
|
||||
radv_bo_destroy(device, device->perf_counter_bo);
|
||||
radv_bo_destroy(device, NULL, device->perf_counter_bo);
|
||||
if (device->gfx_init)
|
||||
radv_bo_destroy(device, device->gfx_init);
|
||||
radv_bo_destroy(device, NULL, device->gfx_init);
|
||||
|
||||
radv_device_finish_notifier(device);
|
||||
radv_device_finish_vs_prologs(device);
|
||||
@@ -1113,10 +1113,10 @@ radv_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
|
||||
|
||||
radv_device_finish_perf_counter_lock_cs(device);
|
||||
if (device->perf_counter_bo)
|
||||
radv_bo_destroy(device, device->perf_counter_bo);
|
||||
radv_bo_destroy(device, NULL, device->perf_counter_bo);
|
||||
|
||||
if (device->gfx_init)
|
||||
radv_bo_destroy(device, device->gfx_init);
|
||||
radv_bo_destroy(device, NULL, device->gfx_init);
|
||||
|
||||
radv_device_finish_notifier(device);
|
||||
radv_device_finish_vs_prologs(device);
|
||||
|
||||
@@ -64,7 +64,7 @@ radv_free_memory(struct radv_device *device, const VkAllocationCallbacks *pAlloc
|
||||
|
||||
if (device->use_global_bo_list)
|
||||
device->ws->buffer_make_resident(device->ws, mem->bo, false);
|
||||
radv_bo_destroy(device, mem->bo);
|
||||
radv_bo_destroy(device, &mem->base, mem->bo);
|
||||
mem->bo = NULL;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
||||
* spec and can be removed after we support modifiers. */
|
||||
result = radv_image_create_layout(device, create_info, NULL, NULL, mem->image);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_bo_destroy(device, mem->bo);
|
||||
radv_bo_destroy(device, &mem->base, mem->bo);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@@ -242,8 +242,8 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
||||
mtx_unlock(&device->overallocation_mutex);
|
||||
}
|
||||
|
||||
result = radv_bo_create(device, alloc_size, pdev->info.max_alignment, domain, flags, priority, replay_address,
|
||||
is_internal, &mem->bo);
|
||||
result = radv_bo_create(device, &mem->base, alloc_size, pdev->info.max_alignment, domain, flags, priority,
|
||||
replay_address, is_internal, &mem->bo);
|
||||
|
||||
if (result != VK_SUCCESS) {
|
||||
if (device->overallocation_disallowed) {
|
||||
@@ -268,6 +268,7 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
||||
|
||||
*pMem = radv_device_memory_to_handle(mem);
|
||||
radv_rmv_log_heap_create(device, *pMem, is_internal, flags_info ? flags_info->flags : 0);
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail:
|
||||
|
||||
@@ -33,7 +33,7 @@ static void
|
||||
radv_destroy_event(struct radv_device *device, const VkAllocationCallbacks *pAllocator, struct radv_event *event)
|
||||
{
|
||||
if (event->bo)
|
||||
radv_bo_destroy(device, event->bo);
|
||||
radv_bo_destroy(device, &event->base, event->bo);
|
||||
|
||||
radv_rmv_log_resource_destroy(device, (uint64_t)radv_event_to_handle(event));
|
||||
vk_object_base_finish(&event->base);
|
||||
@@ -63,9 +63,9 @@ radv_create_event(struct radv_device *device, const VkEventCreateInfo *pCreateIn
|
||||
bo_flags = RADEON_FLAG_CPU_ACCESS;
|
||||
}
|
||||
|
||||
result =
|
||||
radv_bo_create(device, 8, 8, bo_domain, RADEON_FLAG_VA_UNCACHED | RADEON_FLAG_NO_INTERPROCESS_SHARING | bo_flags,
|
||||
RADV_BO_PRIORITY_FENCE, 0, is_internal, &event->bo);
|
||||
result = radv_bo_create(device, &event->base, 8, 8, bo_domain,
|
||||
RADEON_FLAG_VA_UNCACHED | RADEON_FLAG_NO_INTERPROCESS_SHARING | bo_flags,
|
||||
RADV_BO_PRIORITY_FENCE, 0, is_internal, &event->bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_event(device, pAllocator, event);
|
||||
return vk_error(device, result);
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "radv_radeon_winsys.h"
|
||||
#include "radv_video.h"
|
||||
#include "sid.h"
|
||||
#include "vk_debug_utils.h"
|
||||
#include "vk_format.h"
|
||||
#include "vk_render_pass.h"
|
||||
#include "vk_util.h"
|
||||
@@ -1213,7 +1214,7 @@ static void
|
||||
radv_destroy_image(struct radv_device *device, const VkAllocationCallbacks *pAllocator, struct radv_image *image)
|
||||
{
|
||||
if ((image->vk.create_flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && image->bindings[0].bo)
|
||||
radv_bo_destroy(device, image->bindings[0].bo);
|
||||
radv_bo_destroy(device, &image->vk.base, image->bindings[0].bo);
|
||||
|
||||
if (image->owned_memory != VK_NULL_HANDLE) {
|
||||
RADV_FROM_HANDLE(radv_device_memory, mem, image->owned_memory);
|
||||
@@ -1367,8 +1368,8 @@ radv_image_create(VkDevice _device, const struct radv_image_create_info *create_
|
||||
image->size = align64(image->size, image->alignment);
|
||||
image->bindings[0].offset = 0;
|
||||
|
||||
result = radv_bo_create(device, image->size, image->alignment, 0, RADEON_FLAG_VIRTUAL, RADV_BO_PRIORITY_VIRTUAL,
|
||||
0, true, &image->bindings[0].bo);
|
||||
result = radv_bo_create(device, &image->vk.base, image->size, image->alignment, 0, RADEON_FLAG_VIRTUAL,
|
||||
RADV_BO_PRIORITY_VIRTUAL, 0, true, &image->bindings[0].bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_image(device, alloc, image);
|
||||
return vk_error(device, result);
|
||||
@@ -1670,6 +1671,8 @@ VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_BindImageMemory2(VkDevice _device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos)
|
||||
{
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
|
||||
for (uint32_t i = 0; i < bindInfoCount; ++i) {
|
||||
RADV_FROM_HANDLE(radv_device_memory, mem, pBindInfos[i].memory);
|
||||
@@ -1737,6 +1740,10 @@ radv_BindImageMemory2(VkDevice _device, uint32_t bindInfoCount, const VkBindImag
|
||||
image->bindings[0].offset = pBindInfos[i].memoryOffset;
|
||||
}
|
||||
radv_rmv_log_image_bind(device, pBindInfos[i].image);
|
||||
|
||||
vk_address_binding_report(&instance->vk, &image->vk.base,
|
||||
radv_buffer_get_va(image->bindings[0].bo) + image->bindings[0].offset,
|
||||
image->bindings[0].bo->size, VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT);
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1304,7 +1304,6 @@ struct radv_device_memory {
|
||||
void radv_device_memory_init(struct radv_device_memory *mem, struct radv_device *device, struct radeon_winsys_bo *bo);
|
||||
void radv_device_memory_finish(struct radv_device_memory *mem);
|
||||
|
||||
|
||||
enum radv_dynamic_state_bits {
|
||||
RADV_DYNAMIC_VIEWPORT = 1ull << 0,
|
||||
RADV_DYNAMIC_SCISSOR = 1ull << 1,
|
||||
|
||||
@@ -1206,7 +1206,7 @@ radv_destroy_query_pool(struct radv_device *device, const VkAllocationCallbacks
|
||||
radv_pc_deinit_query_pool((struct radv_pc_query_pool *)pool);
|
||||
|
||||
if (pool->bo)
|
||||
radv_bo_destroy(device, pool->bo);
|
||||
radv_bo_destroy(device, &pool->vk.base, pool->bo);
|
||||
|
||||
radv_rmv_log_resource_destroy(device, (uint64_t)radv_query_pool_to_handle(pool));
|
||||
vk_query_pool_finish(&pool->vk);
|
||||
@@ -1305,8 +1305,8 @@ radv_create_query_pool(struct radv_device *device, const VkQueryPoolCreateInfo *
|
||||
(pCreateInfo->queryType == VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT && pdev->info.gfx_level >= GFX11))
|
||||
pool->size += 4 * pCreateInfo->queryCount;
|
||||
|
||||
result = radv_bo_create(device, pool->size, 64, RADEON_DOMAIN_GTT, RADEON_FLAG_NO_INTERPROCESS_SHARING,
|
||||
RADV_BO_PRIORITY_QUERY_POOL, 0, false, &pool->bo);
|
||||
result = radv_bo_create(device, &pool->vk.base, pool->size, 64, RADEON_DOMAIN_GTT,
|
||||
RADEON_FLAG_NO_INTERPROCESS_SHARING, RADV_BO_PRIORITY_QUERY_POOL, 0, false, &pool->bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_query_pool(device, pAllocator, pool);
|
||||
return vk_error(device, result);
|
||||
|
||||
+65
-60
@@ -87,7 +87,8 @@ radv_sparse_buffer_bind_memory(struct radv_device *device, const VkSparseBufferM
|
||||
}
|
||||
}
|
||||
if (size) {
|
||||
result = radv_bo_virtual_bind(device, buffer->bo, resourceOffset, size, mem ? mem->bo : NULL, memoryOffset);
|
||||
result = radv_bo_virtual_bind(device, &buffer->vk.base, buffer->bo, resourceOffset, size, mem ? mem->bo : NULL,
|
||||
memoryOffset);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
@@ -97,7 +98,8 @@ radv_sparse_buffer_bind_memory(struct radv_device *device, const VkSparseBufferM
|
||||
memoryOffset = bind->pBinds[i].memoryOffset;
|
||||
}
|
||||
if (size) {
|
||||
result = radv_bo_virtual_bind(device, buffer->bo, resourceOffset, size, mem ? mem->bo : NULL, memoryOffset);
|
||||
result = radv_bo_virtual_bind(device, &buffer->vk.base, buffer->bo, resourceOffset, size, mem ? mem->bo : NULL,
|
||||
memoryOffset);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -115,8 +117,8 @@ radv_sparse_image_opaque_bind_memory(struct radv_device *device, const VkSparseI
|
||||
if (bind->pBinds[i].memory != VK_NULL_HANDLE)
|
||||
mem = radv_device_memory_from_handle(bind->pBinds[i].memory);
|
||||
|
||||
result = radv_bo_virtual_bind(device, image->bindings[0].bo, bind->pBinds[i].resourceOffset, bind->pBinds[i].size,
|
||||
mem ? mem->bo : NULL, bind->pBinds[i].memoryOffset);
|
||||
result = radv_bo_virtual_bind(device, &image->vk.base, image->bindings[0].bo, bind->pBinds[i].resourceOffset,
|
||||
bind->pBinds[i].size, mem ? mem->bo : NULL, bind->pBinds[i].memoryOffset);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
@@ -177,7 +179,8 @@ radv_sparse_image_bind_memory(struct radv_device *device, const VkSparseImageMem
|
||||
|
||||
if (whole_subres) {
|
||||
uint64_t size = (uint64_t)aligned_extent_width * aligned_extent_height * aligned_extent_depth * bs;
|
||||
result = radv_bo_virtual_bind(device, image->bindings[0].bo, offset, size, mem ? mem->bo : NULL, mem_offset);
|
||||
result = radv_bo_virtual_bind(device, &image->vk.base, image->bindings[0].bo, offset, size,
|
||||
mem ? mem->bo : NULL, mem_offset);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
} else {
|
||||
@@ -190,7 +193,8 @@ radv_sparse_image_bind_memory(struct radv_device *device, const VkSparseImageMem
|
||||
for (unsigned y = 0; y < bind_extent.height; y += surface->prt_tile_height) {
|
||||
uint64_t bo_offset = offset + (uint64_t)img_y_increment * y;
|
||||
|
||||
result = radv_bo_virtual_bind(device, image->bindings[0].bo, bo_offset, size, mem ? mem->bo : NULL,
|
||||
result = radv_bo_virtual_bind(device, &image->vk.base, image->bindings[0].bo, bo_offset, size,
|
||||
mem ? mem->bo : NULL,
|
||||
mem_offset + (uint64_t)mem_y_increment * y + mem_z_increment * z);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
@@ -827,8 +831,8 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
const uint32_t queue_scratch_size = queue->ring_info.scratch_size_per_wave * queue->ring_info.scratch_waves;
|
||||
|
||||
if (scratch_size > queue_scratch_size) {
|
||||
result = radv_bo_create(device, scratch_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH,
|
||||
0, true, &scratch_bo);
|
||||
result = radv_bo_create(device, NULL, scratch_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &scratch_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, scratch_bo, 0, 0, scratch_size);
|
||||
@@ -838,24 +842,24 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
const uint32_t compute_queue_scratch_size =
|
||||
queue->ring_info.compute_scratch_size_per_wave * queue->ring_info.compute_scratch_waves;
|
||||
if (compute_scratch_size > compute_queue_scratch_size) {
|
||||
result = radv_bo_create(device, compute_scratch_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &compute_scratch_bo);
|
||||
result = radv_bo_create(device, NULL, compute_scratch_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &compute_scratch_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, compute_scratch_bo, 0, 0, compute_scratch_size);
|
||||
}
|
||||
|
||||
if (needs->esgs_ring_size > queue->ring_info.esgs_ring_size) {
|
||||
result = radv_bo_create(device, needs->esgs_ring_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &esgs_ring_bo);
|
||||
result = radv_bo_create(device, NULL, needs->esgs_ring_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &esgs_ring_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, esgs_ring_bo, 0, 0, needs->esgs_ring_size);
|
||||
}
|
||||
|
||||
if (needs->gsvs_ring_size > queue->ring_info.gsvs_ring_size) {
|
||||
result = radv_bo_create(device, needs->gsvs_ring_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &gsvs_ring_bo);
|
||||
result = radv_bo_create(device, NULL, needs->gsvs_ring_size, 4096, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &gsvs_ring_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, gsvs_ring_bo, 0, 0, needs->gsvs_ring_size);
|
||||
@@ -863,8 +867,8 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
|
||||
if (!queue->ring_info.tess_rings && needs->tess_rings) {
|
||||
uint64_t tess_rings_size = pdev->hs.tess_offchip_ring_offset + pdev->hs.tess_offchip_ring_size;
|
||||
result = radv_bo_create(device, tess_rings_size, 256, RADEON_DOMAIN_VRAM, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH,
|
||||
0, true, &tess_rings_bo);
|
||||
result = radv_bo_create(device, NULL, tess_rings_size, 256, RADEON_DOMAIN_VRAM, ring_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &tess_rings_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, tess_rings_bo, 0, 0, tess_rings_size);
|
||||
@@ -879,7 +883,7 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
uint32_t task_rings_bo_flags =
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM;
|
||||
|
||||
result = radv_bo_create(device, pdev->task_info.bo_size_bytes, 256, RADEON_DOMAIN_VRAM, task_rings_bo_flags,
|
||||
result = radv_bo_create(device, NULL, pdev->task_info.bo_size_bytes, 256, RADEON_DOMAIN_VRAM, task_rings_bo_flags,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &task_rings_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
@@ -892,9 +896,9 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
|
||||
if (!queue->ring_info.mesh_scratch_ring && needs->mesh_scratch_ring) {
|
||||
assert(pdev->info.gfx_level >= GFX10_3);
|
||||
result = radv_bo_create(device, RADV_MESH_SCRATCH_NUM_ENTRIES * RADV_MESH_SCRATCH_ENTRY_BYTES, 256,
|
||||
RADEON_DOMAIN_VRAM, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true,
|
||||
&mesh_scratch_ring_bo);
|
||||
result =
|
||||
radv_bo_create(device, NULL, RADV_MESH_SCRATCH_NUM_ENTRIES * RADV_MESH_SCRATCH_ENTRY_BYTES, 256,
|
||||
RADEON_DOMAIN_VRAM, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true, &mesh_scratch_ring_bo);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
@@ -904,9 +908,9 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
|
||||
if (needs->attr_ring_size > queue->ring_info.attr_ring_size) {
|
||||
assert(pdev->info.gfx_level >= GFX11);
|
||||
result = radv_bo_create(device, needs->attr_ring_size, 2 * 1024 * 1024 /* 2MiB */, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_32BIT | RADEON_FLAG_DISCARDABLE | ring_bo_flags, RADV_BO_PRIORITY_SCRATCH,
|
||||
0, true, &attr_ring_bo);
|
||||
result = radv_bo_create(device, NULL, needs->attr_ring_size, 2 * 1024 * 1024 /* 2MiB */, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_32BIT | RADEON_FLAG_DISCARDABLE | ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0,
|
||||
true, &attr_ring_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
radv_rmv_log_command_buffer_bo_create(device, attr_ring_bo, 0, 0, needs->attr_ring_size);
|
||||
@@ -918,8 +922,8 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
/* 4 streamout GDS counters.
|
||||
* We need 256B (64 dw) of GDS, otherwise streamout hangs.
|
||||
*/
|
||||
result =
|
||||
radv_bo_create(device, 256, 4, RADEON_DOMAIN_GDS, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true, &gds_bo);
|
||||
result = radv_bo_create(device, NULL, 256, 4, RADEON_DOMAIN_GDS, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true,
|
||||
&gds_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
@@ -934,8 +938,8 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (!queue->ring_info.gds_oa && needs->gds_oa) {
|
||||
assert(pdev->info.gfx_level >= GFX10);
|
||||
|
||||
result =
|
||||
radv_bo_create(device, 1, 1, RADEON_DOMAIN_OA, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true, &gds_oa_bo);
|
||||
result = radv_bo_create(device, NULL, 1, 1, RADEON_DOMAIN_OA, ring_bo_flags, RADV_BO_PRIORITY_SCRATCH, 0, true,
|
||||
&gds_oa_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
@@ -960,9 +964,9 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
add_sample_positions) {
|
||||
const uint32_t size = 304;
|
||||
|
||||
result = radv_bo_create(device, size, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_READ_ONLY,
|
||||
RADV_BO_PRIORITY_DESCRIPTOR, 0, true, &descriptor_bo);
|
||||
result = radv_bo_create(device, NULL, size, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_READ_ONLY,
|
||||
RADV_BO_PRIORITY_DESCRIPTOR, 0, true, &descriptor_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
}
|
||||
@@ -1075,7 +1079,7 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (scratch_bo != queue->scratch_bo) {
|
||||
if (queue->scratch_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->scratch_bo);
|
||||
radv_bo_destroy(device, queue->scratch_bo);
|
||||
radv_bo_destroy(device, NULL, queue->scratch_bo);
|
||||
}
|
||||
queue->scratch_bo = scratch_bo;
|
||||
}
|
||||
@@ -1083,7 +1087,7 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (compute_scratch_bo != queue->compute_scratch_bo) {
|
||||
if (queue->compute_scratch_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->compute_scratch_bo);
|
||||
radv_bo_destroy(device, queue->compute_scratch_bo);
|
||||
radv_bo_destroy(device, NULL, queue->compute_scratch_bo);
|
||||
}
|
||||
queue->compute_scratch_bo = compute_scratch_bo;
|
||||
}
|
||||
@@ -1091,7 +1095,7 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (esgs_ring_bo != queue->esgs_ring_bo) {
|
||||
if (queue->esgs_ring_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->esgs_ring_bo);
|
||||
radv_bo_destroy(device, queue->esgs_ring_bo);
|
||||
radv_bo_destroy(device, NULL, queue->esgs_ring_bo);
|
||||
}
|
||||
queue->esgs_ring_bo = esgs_ring_bo;
|
||||
}
|
||||
@@ -1099,14 +1103,14 @@ radv_update_preamble_cs(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (gsvs_ring_bo != queue->gsvs_ring_bo) {
|
||||
if (queue->gsvs_ring_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->gsvs_ring_bo);
|
||||
radv_bo_destroy(device, queue->gsvs_ring_bo);
|
||||
radv_bo_destroy(device, NULL, queue->gsvs_ring_bo);
|
||||
}
|
||||
queue->gsvs_ring_bo = gsvs_ring_bo;
|
||||
}
|
||||
|
||||
if (descriptor_bo != queue->descriptor_bo) {
|
||||
if (queue->descriptor_bo)
|
||||
radv_bo_destroy(device, queue->descriptor_bo);
|
||||
radv_bo_destroy(device, NULL, queue->descriptor_bo);
|
||||
queue->descriptor_bo = descriptor_bo;
|
||||
}
|
||||
|
||||
@@ -1123,28 +1127,28 @@ fail:
|
||||
if (dest_cs[i])
|
||||
ws->cs_destroy(dest_cs[i]);
|
||||
if (descriptor_bo && descriptor_bo != queue->descriptor_bo)
|
||||
radv_bo_destroy(device, descriptor_bo);
|
||||
radv_bo_destroy(device, NULL, descriptor_bo);
|
||||
if (scratch_bo && scratch_bo != queue->scratch_bo)
|
||||
radv_bo_destroy(device, scratch_bo);
|
||||
radv_bo_destroy(device, NULL, scratch_bo);
|
||||
if (compute_scratch_bo && compute_scratch_bo != queue->compute_scratch_bo)
|
||||
radv_bo_destroy(device, compute_scratch_bo);
|
||||
radv_bo_destroy(device, NULL, compute_scratch_bo);
|
||||
if (esgs_ring_bo && esgs_ring_bo != queue->esgs_ring_bo)
|
||||
radv_bo_destroy(device, esgs_ring_bo);
|
||||
radv_bo_destroy(device, NULL, esgs_ring_bo);
|
||||
if (gsvs_ring_bo && gsvs_ring_bo != queue->gsvs_ring_bo)
|
||||
radv_bo_destroy(device, gsvs_ring_bo);
|
||||
radv_bo_destroy(device, NULL, gsvs_ring_bo);
|
||||
if (tess_rings_bo && tess_rings_bo != queue->tess_rings_bo)
|
||||
radv_bo_destroy(device, tess_rings_bo);
|
||||
radv_bo_destroy(device, NULL, tess_rings_bo);
|
||||
if (task_rings_bo && task_rings_bo != queue->task_rings_bo)
|
||||
radv_bo_destroy(device, task_rings_bo);
|
||||
radv_bo_destroy(device, NULL, task_rings_bo);
|
||||
if (attr_ring_bo && attr_ring_bo != queue->attr_ring_bo)
|
||||
radv_bo_destroy(device, attr_ring_bo);
|
||||
radv_bo_destroy(device, NULL, attr_ring_bo);
|
||||
if (gds_bo && gds_bo != queue->gds_bo) {
|
||||
ws->buffer_make_resident(ws, queue->gds_bo, false);
|
||||
radv_bo_destroy(device, gds_bo);
|
||||
radv_bo_destroy(device, NULL, gds_bo);
|
||||
}
|
||||
if (gds_oa_bo && gds_oa_bo != queue->gds_oa_bo) {
|
||||
ws->buffer_make_resident(ws, queue->gds_oa_bo, false);
|
||||
radv_bo_destroy(device, gds_oa_bo);
|
||||
radv_bo_destroy(device, NULL, gds_oa_bo);
|
||||
}
|
||||
|
||||
return vk_error(queue, result);
|
||||
@@ -1257,8 +1261,9 @@ radv_create_gang_wait_preambles_postambles(struct radv_queue *queue)
|
||||
* DWORD 0: used in preambles, gang leader writes, gang members wait.
|
||||
* DWORD 1: used in postambles, gang leader waits, gang members write.
|
||||
*/
|
||||
r = radv_bo_create(device, 8, 4, RADEON_DOMAIN_VRAM, RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &gang_sem_bo);
|
||||
r = radv_bo_create(device, NULL, 8, 4, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM, RADV_BO_PRIORITY_SCRATCH, 0, true,
|
||||
&gang_sem_bo);
|
||||
if (r != VK_SUCCESS)
|
||||
return r;
|
||||
|
||||
@@ -1339,7 +1344,7 @@ fail:
|
||||
if (ace_post_cs)
|
||||
ws->cs_destroy(ace_post_cs);
|
||||
if (gang_sem_bo)
|
||||
radv_bo_destroy(device, gang_sem_bo);
|
||||
radv_bo_destroy(device, &queue->vk.base, gang_sem_bo);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -1860,46 +1865,46 @@ radv_queue_state_finish(struct radv_queue_state *queue, struct radv_device *devi
|
||||
if (queue->gang_wait_postamble_cs)
|
||||
device->ws->cs_destroy(queue->gang_wait_postamble_cs);
|
||||
if (queue->descriptor_bo)
|
||||
radv_bo_destroy(device, queue->descriptor_bo);
|
||||
radv_bo_destroy(device, NULL, queue->descriptor_bo);
|
||||
if (queue->scratch_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->scratch_bo);
|
||||
radv_bo_destroy(device, queue->scratch_bo);
|
||||
radv_bo_destroy(device, NULL, queue->scratch_bo);
|
||||
}
|
||||
if (queue->esgs_ring_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->esgs_ring_bo);
|
||||
radv_bo_destroy(device, queue->esgs_ring_bo);
|
||||
radv_bo_destroy(device, NULL, queue->esgs_ring_bo);
|
||||
}
|
||||
if (queue->gsvs_ring_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->gsvs_ring_bo);
|
||||
radv_bo_destroy(device, queue->gsvs_ring_bo);
|
||||
radv_bo_destroy(device, NULL, queue->gsvs_ring_bo);
|
||||
}
|
||||
if (queue->tess_rings_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->tess_rings_bo);
|
||||
radv_bo_destroy(device, queue->tess_rings_bo);
|
||||
radv_bo_destroy(device, NULL, queue->tess_rings_bo);
|
||||
}
|
||||
if (queue->task_rings_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->task_rings_bo);
|
||||
radv_bo_destroy(device, queue->task_rings_bo);
|
||||
radv_bo_destroy(device, NULL, queue->task_rings_bo);
|
||||
}
|
||||
if (queue->mesh_scratch_ring_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->mesh_scratch_ring_bo);
|
||||
radv_bo_destroy(device, queue->mesh_scratch_ring_bo);
|
||||
radv_bo_destroy(device, NULL, queue->mesh_scratch_ring_bo);
|
||||
}
|
||||
if (queue->attr_ring_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->attr_ring_bo);
|
||||
radv_bo_destroy(device, queue->attr_ring_bo);
|
||||
radv_bo_destroy(device, NULL, queue->attr_ring_bo);
|
||||
}
|
||||
if (queue->gds_bo) {
|
||||
device->ws->buffer_make_resident(device->ws, queue->gds_bo, false);
|
||||
radv_bo_destroy(device, queue->gds_bo);
|
||||
radv_bo_destroy(device, NULL, queue->gds_bo);
|
||||
}
|
||||
if (queue->gds_oa_bo) {
|
||||
device->ws->buffer_make_resident(device->ws, queue->gds_oa_bo, false);
|
||||
radv_bo_destroy(device, queue->gds_oa_bo);
|
||||
radv_bo_destroy(device, NULL, queue->gds_oa_bo);
|
||||
}
|
||||
if (queue->compute_scratch_bo) {
|
||||
radv_rmv_log_command_buffer_bo_destroy(device, queue->compute_scratch_bo);
|
||||
radv_bo_destroy(device, queue->compute_scratch_bo);
|
||||
radv_bo_destroy(device, NULL, queue->compute_scratch_bo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1918,7 +1923,7 @@ radv_queue_finish(struct radv_queue *queue)
|
||||
}
|
||||
|
||||
if (queue->gang_sem_bo)
|
||||
radv_bo_destroy(device, queue->gang_sem_bo);
|
||||
radv_bo_destroy(device, &queue->vk.base, queue->gang_sem_bo);
|
||||
|
||||
radv_queue_state_finish(&queue->state, device);
|
||||
vk_queue_finish(&queue->vk);
|
||||
|
||||
@@ -973,7 +973,7 @@ radv_create_shader_arena(struct radv_device *device, struct radv_shader_free_lis
|
||||
flags |= RADEON_FLAG_PREFER_LOCAL_BO;
|
||||
|
||||
VkResult result;
|
||||
result = radv_bo_create(device, arena_size, RADV_SHADER_ALLOC_ALIGNMENT, RADEON_DOMAIN_VRAM, flags,
|
||||
result = radv_bo_create(device, NULL, arena_size, RADV_SHADER_ALLOC_ALIGNMENT, RADEON_DOMAIN_VRAM, flags,
|
||||
RADV_BO_PRIORITY_SHADER, replay_va, true, &arena->bo);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
@@ -1010,7 +1010,7 @@ fail:
|
||||
if (alloc)
|
||||
free_block_obj(device, alloc);
|
||||
if (arena && arena->bo)
|
||||
radv_bo_destroy(device, arena->bo);
|
||||
radv_bo_destroy(device, NULL, arena->bo);
|
||||
free(arena);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ fail:
|
||||
free(alloc);
|
||||
if (arena) {
|
||||
free(arena->list.next);
|
||||
radv_bo_destroy(device, arena->bo);
|
||||
radv_bo_destroy(device, NULL, arena->bo);
|
||||
}
|
||||
free(arena);
|
||||
return NULL;
|
||||
@@ -1235,7 +1235,7 @@ radv_free_shader_memory(struct radv_device *device, union radv_shader_arena_bloc
|
||||
struct radv_shader_arena *arena = hole->arena;
|
||||
free_block_obj(device, hole);
|
||||
|
||||
radv_bo_destroy(device, arena->bo);
|
||||
radv_bo_destroy(device, NULL, arena->bo);
|
||||
list_del(&arena->list);
|
||||
free(arena);
|
||||
} else if (free_list) {
|
||||
@@ -1331,7 +1331,7 @@ radv_destroy_shader_arenas(struct radv_device *device)
|
||||
free(block);
|
||||
|
||||
list_for_each_entry_safe (struct radv_shader_arena, arena, &device->shader_arenas, list) {
|
||||
radv_bo_destroy(device, arena->bo);
|
||||
radv_bo_destroy(device, NULL, arena->bo);
|
||||
free(arena);
|
||||
}
|
||||
mtx_destroy(&device->shader_arena_mutex);
|
||||
@@ -1399,7 +1399,7 @@ radv_destroy_shader_upload_queue(struct radv_device *device)
|
||||
if (submission->cs)
|
||||
ws->cs_destroy(submission->cs);
|
||||
if (submission->bo)
|
||||
radv_bo_destroy(device, submission->bo);
|
||||
radv_bo_destroy(device, NULL, submission->bo);
|
||||
list_del(&submission->list);
|
||||
free(submission);
|
||||
}
|
||||
@@ -1914,10 +1914,10 @@ radv_shader_dma_resize_upload_buf(struct radv_device *device, struct radv_shader
|
||||
uint64_t size)
|
||||
{
|
||||
if (submission->bo)
|
||||
radv_bo_destroy(device, submission->bo);
|
||||
radv_bo_destroy(device, NULL, submission->bo);
|
||||
|
||||
VkResult result = radv_bo_create(
|
||||
device, size, RADV_SHADER_ALLOC_ALIGNMENT, RADEON_DOMAIN_GTT,
|
||||
device, NULL, size, RADV_SHADER_ALLOC_ALIGNMENT, RADEON_DOMAIN_GTT,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_32BIT | RADEON_FLAG_GTT_WC,
|
||||
RADV_BO_PRIORITY_UPLOAD_BUFFER, 0, true, &submission->bo);
|
||||
if (result != VK_SUCCESS)
|
||||
|
||||
@@ -42,9 +42,9 @@ radv_spm_init_bo(struct radv_device *device)
|
||||
device->spm.sample_interval = sample_interval;
|
||||
|
||||
struct radeon_winsys_bo *bo = NULL;
|
||||
result = radv_bo_create(device, size, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &bo);
|
||||
result = radv_bo_create(device, NULL, size, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &bo);
|
||||
device->spm.bo = bo;
|
||||
if (result != VK_SUCCESS)
|
||||
return false;
|
||||
@@ -265,7 +265,7 @@ radv_spm_finish(struct radv_device *device)
|
||||
|
||||
if (device->spm.bo) {
|
||||
ws->buffer_make_resident(ws, device->spm.bo, false);
|
||||
radv_bo_destroy(device, device->spm.bo);
|
||||
radv_bo_destroy(device, NULL, device->spm.bo);
|
||||
}
|
||||
|
||||
ac_destroy_spm(&device->spm);
|
||||
|
||||
@@ -513,7 +513,7 @@ radv_sqtt_acquire_gpu_timestamp(struct radv_device *device, struct radeon_winsys
|
||||
|
||||
new_size = MAX2(4096, 2 * device->sqtt_timestamp.size);
|
||||
|
||||
result = radv_bo_create(device, new_size, 8, RADEON_DOMAIN_GTT,
|
||||
result = radv_bo_create(device, NULL, new_size, 8, RADEON_DOMAIN_GTT,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING, RADV_BO_PRIORITY_SCRATCH, 0,
|
||||
true, &bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
@@ -523,7 +523,7 @@ radv_sqtt_acquire_gpu_timestamp(struct radv_device *device, struct radeon_winsys
|
||||
|
||||
map = radv_buffer_map(device->ws, bo);
|
||||
if (!map) {
|
||||
radv_bo_destroy(device, bo);
|
||||
radv_bo_destroy(device, NULL, bo);
|
||||
simple_mtx_unlock(&device->sqtt_timestamp_mtx);
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ radv_sqtt_acquire_gpu_timestamp(struct radv_device *device, struct radeon_winsys
|
||||
|
||||
new_timestamp = malloc(sizeof(*new_timestamp));
|
||||
if (!new_timestamp) {
|
||||
radv_bo_destroy(device, bo);
|
||||
radv_bo_destroy(device, NULL, bo);
|
||||
simple_mtx_unlock(&device->sqtt_timestamp_mtx);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
@@ -565,7 +565,7 @@ radv_sqtt_reset_timestamp(struct radv_device *device)
|
||||
simple_mtx_lock(&device->sqtt_timestamp_mtx);
|
||||
|
||||
list_for_each_entry_safe (struct radv_sqtt_timestamp, ts, &device->sqtt_timestamp.list, list) {
|
||||
radv_bo_destroy(device, ts->bo);
|
||||
radv_bo_destroy(device, NULL, ts->bo);
|
||||
list_del(&ts->list);
|
||||
free(ts);
|
||||
}
|
||||
@@ -619,7 +619,7 @@ static void
|
||||
radv_sqtt_finish_queue_event(struct radv_device *device)
|
||||
{
|
||||
if (device->sqtt_timestamp.bo)
|
||||
radv_bo_destroy(device, device->sqtt_timestamp.bo);
|
||||
radv_bo_destroy(device, NULL, device->sqtt_timestamp.bo);
|
||||
|
||||
simple_mtx_destroy(&device->sqtt_timestamp_mtx);
|
||||
|
||||
@@ -649,9 +649,9 @@ radv_sqtt_init_bo(struct radv_device *device)
|
||||
size += device->sqtt.buffer_size * (uint64_t)max_se;
|
||||
|
||||
struct radeon_winsys_bo *bo = NULL;
|
||||
result = radv_bo_create(device, size, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &bo);
|
||||
result = radv_bo_create(device, NULL, size, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, true, &bo);
|
||||
device->sqtt.bo = bo;
|
||||
if (result != VK_SUCCESS)
|
||||
return false;
|
||||
@@ -674,7 +674,7 @@ radv_sqtt_finish_bo(struct radv_device *device)
|
||||
|
||||
if (unlikely(device->sqtt.bo)) {
|
||||
ws->buffer_make_resident(ws, device->sqtt.bo, false);
|
||||
radv_bo_destroy(device, device->sqtt.bo);
|
||||
radv_bo_destroy(device, NULL, device->sqtt.bo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -640,7 +640,7 @@ radv_create_gfx_config(struct radv_device *device)
|
||||
}
|
||||
|
||||
VkResult result = radv_bo_create(
|
||||
device, cs->cdw * 4, 4096, device->ws->cs_domain(device->ws),
|
||||
device, NULL, cs->cdw * 4, 4096, device->ws->cs_domain(device->ws),
|
||||
RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_READ_ONLY | RADEON_FLAG_GTT_WC,
|
||||
RADV_BO_PRIORITY_CS, 0, true, &device->gfx_init);
|
||||
if (result != VK_SUCCESS)
|
||||
@@ -648,7 +648,7 @@ radv_create_gfx_config(struct radv_device *device)
|
||||
|
||||
void *map = radv_buffer_map(device->ws, device->gfx_init);
|
||||
if (!map) {
|
||||
radv_bo_destroy(device, device->gfx_init);
|
||||
radv_bo_destroy(device, NULL, device->gfx_init);
|
||||
device->gfx_init = NULL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user