mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-19 01:30:36 +02:00
ac/spm: do not abort when the SPM BO is too small
It needs to be resized instead, like the SQTT BO. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31883>
This commit is contained in:
parent
cc1c663152
commit
e14511f77d
2 changed files with 9 additions and 9 deletions
|
|
@ -623,12 +623,11 @@ static uint32_t ac_spm_get_sample_size(const struct ac_spm *spm)
|
|||
return sample_size;
|
||||
}
|
||||
|
||||
static uint32_t ac_spm_get_num_samples(const struct ac_spm *spm)
|
||||
static bool ac_spm_get_num_samples(const struct ac_spm *spm, uint32_t *num_samples)
|
||||
{
|
||||
uint32_t sample_size = ac_spm_get_sample_size(spm);
|
||||
uint32_t *ptr = (uint32_t *)spm->ptr;
|
||||
uint32_t data_size, num_lines_written;
|
||||
uint32_t num_samples = 0;
|
||||
|
||||
/* Get the data size (in bytes) written by the hw to the ring buffer. */
|
||||
data_size = ptr[0] * spm->ptr_granularity;
|
||||
|
|
@ -638,15 +637,15 @@ static uint32_t ac_spm_get_num_samples(const struct ac_spm *spm)
|
|||
|
||||
/* Check for overflow. */
|
||||
if (num_lines_written % (sample_size / 32)) {
|
||||
abort();
|
||||
} else {
|
||||
num_samples = num_lines_written / (sample_size / 32);
|
||||
/* Buffer is too small and it needs to be resized. */
|
||||
return false;
|
||||
}
|
||||
|
||||
return num_samples;
|
||||
*num_samples = num_lines_written / (sample_size / 32);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ac_spm_get_trace(const struct ac_spm *spm, struct ac_spm_trace *trace)
|
||||
bool ac_spm_get_trace(const struct ac_spm *spm, struct ac_spm_trace *trace)
|
||||
{
|
||||
memset(trace, 0, sizeof(*trace));
|
||||
|
||||
|
|
@ -655,5 +654,6 @@ void ac_spm_get_trace(const struct ac_spm *spm, struct ac_spm_trace *trace)
|
|||
trace->num_counters = spm->num_counters;
|
||||
trace->counters = spm->counters;
|
||||
trace->sample_size_in_bytes = ac_spm_get_sample_size(spm);
|
||||
trace->num_samples = ac_spm_get_num_samples(spm);
|
||||
|
||||
return ac_spm_get_num_samples(spm, &trace->num_samples);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,6 +195,6 @@ bool ac_init_spm(const struct radeon_info *info,
|
|||
struct ac_spm *spm);
|
||||
void ac_destroy_spm(struct ac_spm *spm);
|
||||
|
||||
void ac_spm_get_trace(const struct ac_spm *spm, struct ac_spm_trace *trace);
|
||||
bool ac_spm_get_trace(const struct ac_spm *spm, struct ac_spm_trace *trace);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue