[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <31a67704-373a-407e-88c7-e079c7260e82@collabora.com>
Date: Thu, 9 Nov 2023 12:12:26 +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, Steve Longerbeam <slongerbeam@...il.com>
Subject: Re: [PATCH v14 31/56] media: imx: 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: Steve Longerbeam <slongerbeam@...il.com>
> CC: Philipp Zabel <p.zabel@...gutronix.de>
> ---
> drivers/staging/media/imx/imx-media-capture.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index 4846078315ff..ce02199e7b1b 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -605,6 +605,7 @@ static int capture_queue_setup(struct vb2_queue *vq,
> {
> struct capture_priv *priv = vb2_get_drv_priv(vq);
> struct v4l2_pix_format *pix = &priv->vdev.fmt;
> + unsigned int q_num_bufs = vb2_get_num_buffers(vq);
> unsigned int count = *nbuffers;
>
> if (vq->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> @@ -613,14 +614,14 @@ static int capture_queue_setup(struct vb2_queue *vq,
> if (*nplanes) {
> if (*nplanes != 1 || sizes[0] < pix->sizeimage)
> return -EINVAL;
> - count += vq->num_buffers;
> + count += q_num_bufs;
> }
>
> count = min_t(__u32, VID_MEM_LIMIT / pix->sizeimage, count);
>
> if (*nplanes)
> - *nbuffers = (count < vq->num_buffers) ? 0 :
> - count - vq->num_buffers;
> + *nbuffers = (count < q_num_bufs) ? 0 :
> + count - q_num_bufs;
> else
> *nbuffers = count;
>
Powered by blists - more mailing lists