diff --git a/src/amd/common/ac_sqtt.c b/src/amd/common/ac_sqtt.c index bdf4b87da21..7edf2d4d9e6 100644 --- a/src/amd/common/ac_sqtt.c +++ b/src/amd/common/ac_sqtt.c @@ -25,6 +25,7 @@ #include "ac_sqtt.h" +#include "ac_gpu_info.h" #include "util/u_math.h" uint64_t @@ -56,3 +57,21 @@ ac_thread_trace_get_data_va(struct ac_thread_trace_data *data, uint64_t va, unsi { return va + ac_thread_trace_get_data_offset(data, se); } + +bool +ac_is_thread_trace_complete(struct radeon_info *rad_info, + const struct ac_thread_trace_info *info) +{ + if (rad_info->chip_class == GFX10) { + /* GFX10 doesn't have THREAD_TRACE_CNTR but it reports the + * number of dropped bytes for all SEs via + * THREAD_TRACE_DROPPED_CNTR. + */ + return info->gfx10_dropped_cntr == 0; + } + + /* Otherwise, compare the current thread trace offset with the number + * of written bytes. + */ + return info->cur_offset == info->gfx9_write_counter; +} diff --git a/src/amd/common/ac_sqtt.h b/src/amd/common/ac_sqtt.h index 7fe875870cf..19c82383951 100644 --- a/src/amd/common/ac_sqtt.h +++ b/src/amd/common/ac_sqtt.h @@ -27,9 +27,13 @@ #define AC_SQTT_H #include +#include #include "c11_compat.h" +struct radeon_cmdbuf; +struct radeon_info; + struct ac_thread_trace_data { struct radeon_cmdbuf *start_cs[2]; struct radeon_cmdbuf *stop_cs[2]; @@ -75,6 +79,10 @@ ac_thread_trace_get_info_va(uint64_t va, unsigned se); uint64_t ac_thread_trace_get_data_va(struct ac_thread_trace_data *data, uint64_t va, unsigned se); +bool +ac_is_thread_trace_complete(struct radeon_info *rad_info, const struct ac_thread_trace_info *info); + + /** * Identifiers for RGP SQ thread-tracing markers (Table 1) */ diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c index 5f176d9632a..91589a3709d 100644 --- a/src/amd/vulkan/radv_sqtt.c +++ b/src/amd/vulkan/radv_sqtt.c @@ -537,24 +537,6 @@ radv_end_thread_trace(struct radv_queue *queue) return radv_queue_internal_submit(queue, cs); } -static bool -radv_is_thread_trace_complete(struct radv_device *device, - const struct ac_thread_trace_info *info) -{ - if (device->physical_device->rad_info.chip_class == GFX10) { - /* GFX10 doesn't have THREAD_TRACE_CNTR but it reports the - * number of dropped bytes for all SEs via - * THREAD_TRACE_DROPPED_CNTR. - */ - return info->gfx10_dropped_cntr == 0; - } - - /* Otherwise, compare the current thread trace offset with the number - * of written bytes. - */ - return info->cur_offset == info->gfx9_write_counter; -} - static uint32_t radv_get_expected_buffer_size(struct radv_device *device, const struct ac_thread_trace_info *info) @@ -587,7 +569,7 @@ radv_get_thread_trace(struct radv_queue *queue, (struct ac_thread_trace_info *)info_ptr; struct ac_thread_trace_se thread_trace_se = {0}; - if (!radv_is_thread_trace_complete(device, info)) { + if (!ac_is_thread_trace_complete(&device->physical_device->rad_info, info)) { uint32_t expected_size = radv_get_expected_buffer_size(device, info); uint32_t available_size =