aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/layers/radv_sqtt_layer.c100
-rw-r--r--src/amd/vulkan/radv_cmd_buffer.c4
-rw-r--r--src/amd/vulkan/radv_private.h4
3 files changed, 108 insertions, 0 deletions
diff --git a/src/amd/vulkan/layers/radv_sqtt_layer.c b/src/amd/vulkan/layers/radv_sqtt_layer.c
index 18131cc0efb..a55a2396eac 100644
--- a/src/amd/vulkan/layers/radv_sqtt_layer.c
+++ b/src/amd/vulkan/layers/radv_sqtt_layer.c
@@ -46,6 +46,63 @@ enum rgp_sqtt_marker_identifier {
};
/**
+ * RGP SQ thread-tracing marker for the start of a command buffer. (Table 2)
+ */
+struct rgp_sqtt_marker_cb_start {
+ union {
+ struct {
+ uint32_t identifier : 4;
+ uint32_t ext_dwords : 3;
+ uint32_t cb_id : 20;
+ uint32_t queue : 5;
+ };
+ uint32_t dword01;
+ };
+ union {
+ uint32_t device_id_low;
+ uint32_t dword02;
+ };
+ union {
+ uint32_t device_id_high;
+ uint32_t dword03;
+ };
+ union {
+ uint32_t queue_flags;
+ uint32_t dword04;
+ };
+};
+
+static_assert(sizeof(struct rgp_sqtt_marker_cb_start) == 16,
+ "rgp_sqtt_marker_cb_start doesn't match RGP spec");
+
+/**
+ *
+ * RGP SQ thread-tracing marker for the end of a command buffer. (Table 3)
+ */
+struct rgp_sqtt_marker_cb_end {
+ union {
+ struct {
+ uint32_t identifier : 4;
+ uint32_t ext_dwords : 3;
+ uint32_t cb_id : 20;
+ uint32_t reserved : 5;
+ };
+ uint32_t dword01;
+ };
+ union {
+ uint32_t device_id_low;
+ uint32_t dword02;
+ };
+ union {
+ uint32_t device_id_high;
+ uint32_t dword03;
+ };
+};
+
+static_assert(sizeof(struct rgp_sqtt_marker_cb_end) == 12,
+ "rgp_sqtt_marker_cb_end doesn't match RGP spec");
+
+/**
* API types used in RGP SQ thread-tracing markers for the "General API"
* packet.
*/
@@ -145,6 +202,49 @@ radv_write_end_general_api_marker(struct radv_cmd_buffer *cmd_buffer,
radv_emit_thread_trace_userdata(cs, &marker, sizeof(marker) / 4);
}
+void
+radv_describe_begin_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
+{
+ uint64_t device_id = (uint64_t)cmd_buffer->device;
+ struct rgp_sqtt_marker_cb_start marker = {};
+ struct radeon_cmdbuf *cs = cmd_buffer->cs;
+
+ if (likely(!cmd_buffer->device->thread_trace_bo))
+ return;
+
+ marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_CB_START;
+ marker.cb_id = 0;
+ marker.device_id_low = device_id;
+ marker.device_id_high = device_id >> 32;
+ marker.queue = cmd_buffer->queue_family_index;
+ marker.queue_flags = VK_QUEUE_COMPUTE_BIT |
+ VK_QUEUE_TRANSFER_BIT |
+ VK_QUEUE_SPARSE_BINDING_BIT;
+
+ if (cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL)
+ marker.queue_flags |= VK_QUEUE_GRAPHICS_BIT;
+
+ radv_emit_thread_trace_userdata(cs, &marker, sizeof(marker) / 4);
+}
+
+void
+radv_describe_end_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
+{
+ uint64_t device_id = (uint64_t)cmd_buffer->device;
+ struct rgp_sqtt_marker_cb_end marker = {};
+ struct radeon_cmdbuf *cs = cmd_buffer->cs;
+
+ if (likely(!cmd_buffer->device->thread_trace_bo))
+ return;
+
+ marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_CB_END;
+ marker.cb_id = 0;
+ marker.device_id_low = device_id;
+ marker.device_id_high = device_id >> 32;
+
+ radv_emit_thread_trace_userdata(cs, &marker, sizeof(marker) / 4);
+}
+
#define API_MARKER(cmd_name, args...) \
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer); \
radv_write_begin_general_api_marker(cmd_buffer, ApiCmd##cmd_name); \
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 08c7400e820..096c06d3ed0 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -3441,6 +3441,8 @@ VkResult radv_BeginCommandBuffer(
if (unlikely(cmd_buffer->device->trace_bo))
radv_cmd_buffer_trace_emit(cmd_buffer);
+ radv_describe_begin_cmd_buffer(cmd_buffer);
+
cmd_buffer->status = RADV_CMD_BUFFER_STATUS_RECORDING;
return result;
@@ -3794,6 +3796,8 @@ VkResult radv_EndCommandBuffer(
*/
si_cp_dma_wait_for_idle(cmd_buffer);
+ radv_describe_end_cmd_buffer(cmd_buffer);
+
vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.subpass_sample_locs);
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index ab056b49821..6eedf910bf4 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -2419,6 +2419,10 @@ void radv_emit_thread_trace_userdata(struct radeon_cmdbuf *cs,
int radv_dump_thread_trace(struct radv_device *device,
const struct radv_thread_trace *trace);
+/* radv_sqtt_layer_.c */
+void radv_describe_begin_cmd_buffer(struct radv_cmd_buffer *cmd_buffer);
+void radv_describe_end_cmd_buffer(struct radv_cmd_buffer *cmd_buffer);
+
struct radeon_winsys_sem;
uint64_t radv_get_current_time(void);