Module: Mesa
Branch: main
Commit: 0195e1204b6c49cd7851c590c93bb1a3dcf1d6ee
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0195e1204b6c49cd7851c590c93bb1a3dcf1d6ee

Author: Sathishkumar S <[email protected]>
Date:   Thu Jul 20 10:39:22 2023 +0530

radeonsi/vcn: num bs_bufs must be proportional to num jpeg engines

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 <[email protected]>
Reviewed-by: Leo Liu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24240>

---

 src/gallium/drivers/radeonsi/radeon_vcn_dec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c 
b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c
index 8892e8fe4b4..05718404a23 100644
--- a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c
@@ -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));

Reply via email to