From: Samuel Pitoiset Date: Wed, 3 Mar 2021 08:32:55 +0000 (+0100) Subject: radv: make the SQTT BO a resident buffer X-Git-Tag: upstream/22.3.5~17703 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8846f65c4f2c33e0a927e44934e267bce8acb1a1;p=platform%2Fupstream%2Fmesa.git radv: make the SQTT BO a resident buffer Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhhuizen Part-of: --- diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c index b4e3757..04a67af 100644 --- a/src/amd/vulkan/radv_sqtt.c +++ b/src/amd/vulkan/radv_sqtt.c @@ -391,6 +391,7 @@ radv_thread_trace_init_bo(struct radv_device *device) { unsigned max_se = device->physical_device->rad_info.max_se; struct radeon_winsys *ws = device->ws; + VkResult result; uint64_t size; /* The buffer size and address need to be aligned in HW regs. Align the @@ -404,7 +405,7 @@ radv_thread_trace_init_bo(struct radv_device *device) size += device->thread_trace.buffer_size * (uint64_t)max_se; struct radeon_winsys_bo *bo = NULL; - VkResult result = ws->buffer_create( + result = ws->buffer_create( ws, size, 4096, RADEON_DOMAIN_VRAM, RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_ZERO_VRAM, RADV_BO_PRIORITY_SCRATCH, 0, &bo); @@ -412,6 +413,10 @@ radv_thread_trace_init_bo(struct radv_device *device) if (result != VK_SUCCESS) return false; + result = ws->buffer_make_resident(ws, device->thread_trace.bo, true); + if (result != VK_SUCCESS) + return false; + device->thread_trace.ptr = ws->buffer_map(device->thread_trace.bo); if (!device->thread_trace.ptr) return false; @@ -419,6 +424,17 @@ radv_thread_trace_init_bo(struct radv_device *device) return true; } +static void +radv_thread_trace_finish_bo(struct radv_device *device) +{ + struct radeon_winsys *ws = device->ws; + + if (unlikely(device->thread_trace.bo)) { + ws->buffer_make_resident(ws, device->thread_trace.bo, false); + ws->buffer_destroy(ws, device->thread_trace.bo); + } +} + bool radv_thread_trace_init(struct radv_device *device) { @@ -454,8 +470,7 @@ radv_thread_trace_finish(struct radv_device *device) struct ac_thread_trace_data *thread_trace_data = &device->thread_trace; struct radeon_winsys *ws = device->ws; - if (unlikely(device->thread_trace.bo)) - ws->buffer_destroy(ws, device->thread_trace.bo); + radv_thread_trace_finish_bo(device); for (unsigned i = 0; i < 2; i++) { if (device->thread_trace.start_cs[i]) @@ -477,10 +492,8 @@ radv_thread_trace_finish(struct radv_device *device) static bool radv_thread_trace_resize_bo(struct radv_device *device) { - struct radeon_winsys *ws = device->ws; - /* Destroy the previous thread trace BO. */ - ws->buffer_destroy(ws, device->thread_trace.bo); + radv_thread_trace_finish_bo(device); /* Double the size of the thread trace buffer per SE. */ device->thread_trace.buffer_size *= 2;