Mesa (master): radv: add support for resizing the SQTT buffer automatically

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 11 09:51:28 UTC 2021


Module: Mesa
Branch: master
Commit: a1185d09f0691365d56ff1e509ed711167d1f164
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1185d09f0691365d56ff1e509ed711167d1f164

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Feb 10 14:18:11 2021 +0100

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 at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8960>

---

 src/amd/vulkan/radv_sqtt.c | 26 ++++++++++++++++++++++++--
 1 file 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;
 		}
 



More information about the mesa-commit mailing list