[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <95d99dfa-d054-4bea-83c9-b4f228d38431@xs4all.nl>
Date: Tue, 29 Oct 2024 14:20:03 +0100
From: Hans Verkuil <hverkuil@...all.nl>
To: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Raspberry Pi Kernel Maintenance <kernel-list@...pberrypi.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: linux-media@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: raspberrypi: cfe: Fix min_reqbufs_allocation
On 10/29/24 13:47, Tomi Valkeinen wrote:
> The driver checks if "vq->max_num_buffers + *nbuffers < 3", but
> vq->max_num_buffers is (by default) 32, so the check is never true. Nor
> does the check make sense.
>
> The original code in the BSP kernel was "vq->num_buffers + *nbuffers <
> 3", but got mangled along the way to upstream. The intention was to make
> sure that at least 3 buffers are allocated.
>
> Fix this by removing the bad lines and setting q->min_reqbufs_allocation
> to three.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Reviewed-by: Hans Verkuil <hverkuil@...all.nl>
> ---
> drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> index 045910de6c57..65e9c6d23416 100644
> --- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> +++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> @@ -1025,9 +1025,6 @@ static int cfe_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
> cfe_dbg(cfe, "%s: [%s] type:%u\n", __func__, node_desc[node->id].name,
> node->buffer_queue.type);
>
> - if (vq->max_num_buffers + *nbuffers < 3)
> - *nbuffers = 3 - vq->max_num_buffers;
> -
> if (*nplanes) {
> if (sizes[0] < size) {
> cfe_err(cfe, "sizes[0] %i < size %u\n", sizes[0], size);
> @@ -1999,6 +1996,7 @@ static int cfe_register_node(struct cfe_device *cfe, int id)
> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
> q->lock = &node->lock;
> q->min_queued_buffers = 1;
> + q->min_reqbufs_allocation = 3;
> q->dev = &cfe->pdev->dev;
>
> ret = vb2_queue_init(q);
>
> ---
> base-commit: 698b6e3163bafd61e1b7d13572e2c42974ac85ec
> change-id: 20241029-rp1-cfe-fixes-0270923a2f94
>
> Best regards,
Powered by blists - more mailing lists