[PATCH v7 30/49] media: mediatek: vcodec: Stop direct calls to queue num_buffers field
Benjamin Gaignard
benjamin.gaignard at collabora.com
Thu Sep 14 06:33:04 PDT 2023
Use vb2_get_num_buffers() to avoid using queue num_buffer field directly.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard at collabora.com>
---
.../platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 2 +-
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
index 3d2ae0e1b5b6..a04003d20b1d 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c
@@ -1695,7 +1695,7 @@ static int vdec_vp9_slice_setup_core_buffer(struct vdec_vp9_slice_instance *inst
return -EINVAL;
/* update internal buffer's width/height */
- for (i = 0; i < vq->num_buffers; i++) {
+ for (i = 0; i < VB2_MAX_FRAME; i++) {
if (vb == vb2_get_buffer(vq, i)) {
instance->dpb[i].width = w;
instance->dpb[i].height = h;
diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
index 04948d3eb011..ff183c9142a3 100644
--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
@@ -923,7 +923,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
mtk_v4l2_venc_err(ctx, "pm_runtime_put fail %d", pm_ret);
err_start_stream:
- for (i = 0; i < q->num_buffers; ++i) {
+ for (i = 0; i < q->max_allowed_buffers; ++i) {
struct vb2_buffer *buf = vb2_get_buffer(q, i);
/*
--
2.39.2
More information about the Linux-rockchip
mailing list