summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2021-02-10 14:18:11 +0100
committerMarge Bot <eric+marge@anholt.net>2021-02-11 09:29:31 +0000
commita1185d09f0691365d56ff1e509ed711167d1f164 (patch)
tree59c9a1c893586d41d2fb1d62e0fe747668799904
parent9d79bb24b4a8911201ae86bebcb2619a23e8461e (diff)
radv: add support for resizing the SQTT buffer automatically
The buffer is resized when too small, the 150% limit is arbitrary and works in most cases. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8960>
-rw-r--r--src/amd/vulkan/radv_sqtt.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c
index 0947f27e31d..0099688c6d6 100644
--- a/src/amd/vulkan/radv_sqtt.c
+++ b/src/amd/vulkan/radv_sqtt.c
@@ -550,6 +550,25 @@ radv_thread_trace_finish(struct radv_device *device)
}
}
+static bool
+radv_thread_trace_resize_bo(struct radv_device *device, uint32_t expected_size)
+{
+ /* Resize the trace buffer BO by 150% of the expected size to be sure
+ * it will be enough.
+ */
+ device->thread_trace.buffer_size = expected_size * 1.50;
+
+ /* Cleanup and re-initialize thread trace. */
+ radv_thread_trace_finish(device);
+ if (!radv_thread_trace_init(device))
+ return false;
+
+ fprintf(stderr, "The thread trace buffer has been resized to %d KB "
+ "per SE ! Please try again.\n",
+ device->thread_trace.buffer_size / 1024);
+ return true;
+}
+
bool
radv_begin_thread_trace(struct radv_queue *queue)
{
@@ -597,8 +616,11 @@ radv_get_thread_trace(struct radv_queue *queue,
"hardware needs %d KB per SE but the "
"buffer size is %d KB.\n",
expected_size, available_size);
- fprintf(stderr, "Please update the buffer size with "
- "RADV_THREAD_TRACE_BUFFER_SIZE=<size_in_bytes>\n");
+ if (!radv_thread_trace_resize_bo(device, expected_size * 1024)) {
+ fprintf(stderr, "Failed to resize the thread "
+ "trace buffer.\n");
+ abort();
+ }
return false;
}