radeon/vcn: increase render_pic_list size
authorThong Thai <thong.thai@amd.com>
Tue, 21 Jul 2020 21:04:47 +0000 (17:04 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jul 2020 17:17:50 +0000 (17:17 +0000)
Increase the maximum number of possible decoder reference picture
frames from 16 to 32.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6016>

src/gallium/drivers/radeon/radeon_vcn_dec.c
src/gallium/drivers/radeon/radeon_vcn_dec.h

index 6bc60061aab742b7fe8f88ae0c8f6019916914cb..3854fad8b4d0e3c359492e0521e7c91c1e6de152 100644 (file)
@@ -256,17 +256,19 @@ static rvcn_dec_message_hevc_t get_h265_msg(struct radeon_decoder *dec,
    result.num_delta_pocs_ref_rps_idx = pic->NumDeltaPocsOfRefRpsIdx;
    result.curr_poc = pic->CurrPicOrderCntVal;
 
-   for (i = 0; i < 16; i++) {
-      for (j = 0; (pic->ref[j] != NULL) && (j < 16); j++) {
+   for (i = 0; i < ARRAY_SIZE(dec->render_pic_list); i++) {
+      for (j = 0; 
+           (pic->ref[j] != NULL) && (j < ARRAY_SIZE(dec->render_pic_list));
+           j++) {
          if (dec->render_pic_list[i] == pic->ref[j])
             break;
-         if (j == 15)
+         if (j == ARRAY_SIZE(dec->render_pic_list) - 1)
             dec->render_pic_list[i] = NULL;
          else if (pic->ref[j + 1] == NULL)
             dec->render_pic_list[i] = NULL;
       }
    }
-   for (i = 0; i < 16; i++) {
+   for (i = 0; i < ARRAY_SIZE(dec->render_pic_list); i++) {
       if (dec->render_pic_list[i] == NULL) {
          dec->render_pic_list[i] = target;
          result.curr_idx = i;
@@ -482,9 +484,9 @@ static rvcn_dec_message_vp9_t get_vp9_msg(struct radeon_decoder *dec,
    result.uncompressed_header_size = pic->picture_parameter.frame_header_length_in_bytes;
    result.compressed_header_size = pic->picture_parameter.first_partition_size;
 
-   assert(dec->base.max_references + 1 <= 16);
+   assert(dec->base.max_references + 1 <= ARRAY_SIZE(dec->render_pic_list));
 
-   for (i = 0; i < 16; ++i) {
+   for (i = 0; i < ARRAY_SIZE(dec->render_pic_list); ++i) {
       if (dec->render_pic_list[i] && dec->render_pic_list[i] == target) {
          result.curr_pic_idx = (uintptr_t)vl_video_buffer_get_associated_data(target, &dec->base);
          break;
@@ -1504,7 +1506,7 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
       goto error;
    }
 
-   for (i = 0; i < 16; i++)
+   for (i = 0; i < ARRAY_SIZE(dec->render_pic_list); i++)
       dec->render_pic_list[i] = NULL;
    bs_buf_size = width * height * (512 / (16 * 16));
    for (i = 0; i < NUM_BUFFERS; ++i) {
index 00c373a6ee301ce08beed94ef908bf18713320f1..839dc25fb15237a6532a06d9f427f8a77df70f54 100644 (file)
@@ -781,7 +781,7 @@ struct radeon_decoder {
 
    unsigned bs_size;
    unsigned cur_buffer;
-   void *render_pic_list[16];
+   void *render_pic_list[32];
    bool show_frame;
    unsigned ref_idx;
    struct {