[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20023047-775a-4bd3-8bdb-932347e91c66@collabora.com>
Date: Thu, 9 Nov 2023 12:17:58 +0100
From: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
To: Benjamin Gaignard <benjamin.gaignard@...labora.com>,
mchehab@...nel.org, tfiga@...omium.org, m.szyprowski@...sung.com,
ming.qian@....com, ezequiel@...guardiasur.com.ar,
p.zabel@...gutronix.de, gregkh@...uxfoundation.org,
hverkuil-cisco@...all.nl, nicolas.dufresne@...labora.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-staging@...ts.linux.dev,
kernel@...labora.com, Neil Armstrong <neil.armstrong@...aro.org>
Subject: Re: [PATCH v14 32/56] media: meson: vdec: Stop direct calls to queue
num_buffers field
W dniu 31.10.2023 o 17:30, Benjamin Gaignard pisze:
> Use vb2_get_num_buffers() to avoid using queue num_buffers field directly.
> This allows us to change how the number of buffers is computed in the
> future.
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.com>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
> CC: Neil Armstrong <neil.armstrong@...aro.org>
> ---
> drivers/staging/media/meson/vdec/vdec.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c
> index 219185aaa588..1e2369f104c8 100644
> --- a/drivers/staging/media/meson/vdec/vdec.c
> +++ b/drivers/staging/media/meson/vdec/vdec.c
> @@ -167,22 +167,23 @@ static void process_num_buffers(struct vb2_queue *q,
> bool is_reqbufs)
> {
> const struct amvdec_format *fmt_out = sess->fmt_out;
> - unsigned int buffers_total = q->num_buffers + *num_buffers;
> + unsigned int q_num_bufs = vb2_get_num_buffers(q);
> + unsigned int buffers_total = q_num_bufs + *num_buffers;
> u32 min_buf_capture = v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture);
>
> - if (q->num_buffers + *num_buffers < min_buf_capture)
> - *num_buffers = min_buf_capture - q->num_buffers;
> + if (q_num_bufs + *num_buffers < min_buf_capture)
> + *num_buffers = min_buf_capture - q_num_bufs;
> if (is_reqbufs && buffers_total < fmt_out->min_buffers)
> - *num_buffers = fmt_out->min_buffers - q->num_buffers;
> + *num_buffers = fmt_out->min_buffers - q_num_bufs;
> if (buffers_total > fmt_out->max_buffers)
> - *num_buffers = fmt_out->max_buffers - q->num_buffers;
> + *num_buffers = fmt_out->max_buffers - q_num_bufs;
>
> /* We need to program the complete CAPTURE buffer list
> * in registers during start_streaming, and the firmwares
> * are free to choose any of them to write frames to. As such,
> * we need all of them to be queued into the driver
> */
> - sess->num_dst_bufs = q->num_buffers + *num_buffers;
> + sess->num_dst_bufs = q_num_bufs + *num_buffers;
> q->min_buffers_needed = max(fmt_out->min_buffers, sess->num_dst_bufs);
> }
>
Powered by blists - more mailing lists