radeonsi/vcn: adjust subsample size alignment

The total subsample size has to be equal to the aligned bitstream size.
Remove the previous subsample size alignment and make it always equal
to aligned bitstream size.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Acked-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36230>
This commit is contained in:
Boyuan Zhang
2025-07-18 13:51:00 -04:00
committed by Marge Bot
parent 13e6fa4ba8
commit 2525fe07c2

View File

@@ -1793,15 +1793,22 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
return NULL;
}
int ss_length = MIN2(secure_buf->desc.subsamples_length, MAX_SUBSAMPLES);
int total_ss_size = 0;
uint32_t *ss_ptr = dec->ws->buffer_map(dec->ws, dec->subsample.res->buf, &dec->cs,
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
if (!ss_ptr) {
RADEON_DEC_ERR("Failed to map subsample buffer memory.\n");
return NULL;
}
for (int i = 0; i < ss_length; i++)
for (int i = 0; i < ss_length; i++) {
memcpy(&ss_ptr[i * 2], &secure_buf->desc.subsamples[i].num_bytes_clear, 8);
ss_ptr[ss_length * 2 - 1] = align(ss_ptr[ss_length * 2 - 1], 256);
total_ss_size += ss_ptr[i * 2] + ss_ptr[i * 2 + 1];
}
assert(total_ss_size <= decode->bsd_size);
if (ss_ptr[ss_length * 2 - 1] != 0)
ss_ptr[ss_length * 2 - 1] += (decode->bsd_size - total_ss_size);
else
ss_ptr[ss_length * 2 - 2] += (decode->bsd_size - total_ss_size);
dec->ws->buffer_unmap(dec->ws, dec->subsample.res->buf);
}