radeonsi/vcn: num bs_bufs must be proportional to num jpeg engines
authorSathishkumar S <sathishkumar.sundararaju@amd.com>
Thu, 20 Jul 2023 04:51:22 +0000 (10:21 +0530)
committerMarge Bot <emma+marge@anholt.net>
Fri, 21 Jul 2023 14:42:09 +0000 (14:42 +0000)
using limited number of bs buffers constraints the simultaneous
use of all available jpeg engines especially when count is lesser than
that of the available engines. make sure the number of buffers
available are more than or equal to the number of jpeg engines on the asic.

Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24240>

src/gallium/drivers/radeonsi/radeon_vcn_dec.c

index 8892e8f..0571840 100644 (file)
@@ -3115,7 +3115,14 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
          dec->h264_valid_poc_num[i] = (unsigned) -1;
    }
 
-   dec->num_dec_bufs = NUM_BUFFERS;
+   if (dec->stream_type == RDECODE_CODEC_JPEG) {
+      if (sctx->vcn_ip_ver == VCN_4_0_3)
+         dec->num_dec_bufs = dec->njctx;
+      else
+         dec->num_dec_bufs = dec->njctx * NUM_BUFFERS;
+   } else
+      dec->num_dec_bufs = NUM_BUFFERS;
+
    bs_buf_size = align(width * height / 32, 128);
    dec->msg_fb_it_probs_buffers = (struct rvid_buffer *) CALLOC(dec->num_dec_bufs, sizeof(struct rvid_buffer));
    dec->bs_buffers = (struct rvid_buffer *) CALLOC(dec->num_dec_bufs, sizeof(struct rvid_buffer));