radv/sqtt: add a helper that emits thread trace userdata markers
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 26 Feb 2020 13:12:01 +0000 (14:12 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 10 Mar 2020 08:57:56 +0000 (09:57 +0100)
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/4031>

src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_sqtt.c

index a9e711a0b51be4996962810b4e28986c7add2160..ab056b49821827c1c29cb8b9c76441c3521be8bc 100644 (file)
@@ -2412,6 +2412,8 @@ bool radv_begin_thread_trace(struct radv_queue *queue);
 bool radv_end_thread_trace(struct radv_queue *queue);
 bool radv_get_thread_trace(struct radv_queue *queue,
                           struct radv_thread_trace *thread_trace);
+void radv_emit_thread_trace_userdata(struct radeon_cmdbuf *cs,
+                                    const void *data, uint32_t num_dwords);
 
 /* radv_rgp.c */
 int radv_dump_thread_trace(struct radv_device *device,
index ba0f2f712e9a10935227a0cba6e86707faa41ea6..1935c990255354e61992a78e01fb06f18866cad1 100644 (file)
@@ -341,6 +341,23 @@ radv_emit_thread_trace_stop(struct radv_device *device,
                               S_030800_INSTANCE_BROADCAST_WRITES(1));
 }
 
+void
+radv_emit_thread_trace_userdata(struct radeon_cmdbuf *cs,
+                               const void *data, uint32_t num_dwords)
+{
+       const uint32_t *dwords = (uint32_t *)data;
+
+       while (num_dwords > 0) {
+               uint32_t count = MIN2(num_dwords, 2);
+
+               radeon_set_uconfig_reg_seq(cs, R_030D08_SQ_THREAD_TRACE_USERDATA_2, count);
+               radeon_emit_array(cs, dwords, count);
+
+               dwords += count;
+               num_dwords -= count;
+       }
+}
+
 static void
 radv_emit_spi_config_cntl(struct radv_device *device,
                          struct radeon_cmdbuf *cs, bool enable)