gallium/drivers: copy only the actual number of slice parameters
authorSajeesh Sidharthan <sajeesh.sidharthan@amd.com>
Sun, 20 Nov 2022 06:47:50 +0000 (22:47 -0800)
committerMarge Bot <emma+marge@anholt.net>
Mon, 21 Nov 2022 20:14:21 +0000 (20:14 +0000)
currently max number of slice(tile) parameters are copied for av1.
copy only actual number of slice parameters

Signed-off-by: Sajeesh Sidharthan <sajeesh.sidharthan@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19878>

src/gallium/drivers/radeonsi/radeon_vcn_dec.c

index f297861..e7e0f52 100644 (file)
@@ -954,6 +954,7 @@ static rvcn_dec_message_av1_t get_av1_msg(struct radeon_decoder *dec,
 {
    rvcn_dec_message_av1_t result;
    unsigned i, j;
+   uint16_t tile_count = pic->picture_parameter.tile_cols * pic->picture_parameter.tile_rows;
 
    memset(&result, 0, sizeof(result));
 
@@ -1294,7 +1295,7 @@ static rvcn_dec_message_av1_t get_av1_msg(struct radeon_decoder *dec,
       for (j = 0; j < 6; ++j)
          result.global_motion[i + 1].wmmat[j] = pic->picture_parameter.wm[i].wmmat[j];
    }
-   for (i = 0; i < 256; ++i) {
+   for (i = 0; i < tile_count && i < 256; ++i) {
       result.tile_info[i].offset = pic->slice_parameter.slice_data_offset[i];
       result.tile_info[i].size = pic->slice_parameter.slice_data_size[i];
    }