ac/sqtt: move ac_is_thread_trace_complete to ac

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8002>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2020-12-08 12:03:52 +01:00
parent ffdfe136e6
commit ea6176e63e
3 changed files with 28 additions and 19 deletions

View File

@ -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;
}

View File

@ -27,9 +27,13 @@
#define AC_SQTT_H
#include <stdint.h>
#include <stdbool.h>
#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)
*/

View File

@ -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 =