From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com,
matt.ranostay@konsulko.com
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev, kernel@collabora.com
Subject: Re: [PATCH 03/55] media: usb: cx231xx: Stop abusing of min_buffers_needed field
Date: Tue, 28 Nov 2023 11:23:46 +0100 [thread overview]
Message-ID: <f1402052-f688-4f4b-98ef-e65fdbec3d51@collabora.com> (raw)
In-Reply-To: <44ca55bf-978d-47e8-abd2-8e3adb5071a2@xs4all.nl>
Le 28/11/2023 à 11:18, Hans Verkuil a écrit :
> On 27/11/2023 17:54, Benjamin Gaignard wrote:
>> 'min_buffers_needed' is suppose to be used to indicate the number
>> of buffers needed by DMA engine to start streaming.
>> cx231xx driver doesn't use DMA engine and just want to specify
>> the minimum number of buffers to allocate when calling VIDIOC_REQBUFS.
>> That 'min_reqbufs_allocation' field purpose so use it.
>>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
>> ---
>> drivers/media/usb/cx231xx/cx231xx-417.c | 2 +-
>> drivers/media/usb/cx231xx/cx231xx-video.c | 4 ++--
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
>> index 45973fe690b2..66043ed50c8e 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx-417.c
>> +++ b/drivers/media/usb/cx231xx/cx231xx-417.c
>> @@ -1782,7 +1782,7 @@ int cx231xx_417_register(struct cx231xx *dev)
>> q->ops = &cx231xx_video_qops;
>> q->mem_ops = &vb2_vmalloc_memops;
>> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>> - q->min_buffers_needed = 1;
>> + q->min_reqbufs_allocation = 1;
> There is no point setting min_reqbufs_allocation to 1: you can't allocate
> less than 1 buffer after all.
Does that mean I should just remove this line ?
>
> It is different in that respect from min_buffers_needed: you can call
> VIDIOC_STREAMON (and thus start_streaming) without any buffers queued.
>
> This also suggests a better name for min_buffers_needed: min_queued_buffers
>
> So 'min_queued_buffers' buffers have to be queued before start_streaming can
> be called.
Ok I will change that in V2
Regards,
Benjamin
>
> The old min_buffers_needed mixed up the two requirements of the minimum
> number of buffers to allocate in REQBUFS and the minimum number of buffers
> that need to be queued before you can start streaming. Separating these two
> meanings should make things easier to understand.
>
> The only relationship between the two is that min_reqbufs_allocation >
> min_queued_buffers, otherwise you would end up in a state where the
> driver would just cycle buffers and never be able to return a buffer
> to userspace to process.
>
> Regards,
>
> Hans
>
>> q->lock = &dev->lock;
>> err = vb2_queue_init(q);
>> if (err)
>> diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
>> index c8eb4222319d..df572c466bfb 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx-video.c
>> +++ b/drivers/media/usb/cx231xx/cx231xx-video.c
>> @@ -1811,7 +1811,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
>> q->ops = &cx231xx_video_qops;
>> q->mem_ops = &vb2_vmalloc_memops;
>> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>> - q->min_buffers_needed = 1;
>> + q->min_reqbufs_allocation = 1;
>> q->lock = &dev->lock;
>> ret = vb2_queue_init(q);
>> if (ret)
>> @@ -1871,7 +1871,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
>> q->ops = &cx231xx_vbi_qops;
>> q->mem_ops = &vb2_vmalloc_memops;
>> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>> - q->min_buffers_needed = 1;
>> + q->min_reqbufs_allocation = 1;
>> q->lock = &dev->lock;
>> ret = vb2_queue_init(q);
>> if (ret)
>
next prev parent reply other threads:[~2023-11-28 10:23 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 16:53 [PATCH 00/55] Clean up queue_setup()/min_buffers_needed (ab)use Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 01/55] videobuf2: Add min_reqbufs_allocation field to vb2_queue structure Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 02/55] media: test-drivers: Stop abusing of min_buffers_needed field Benjamin Gaignard
2023-11-27 17:00 ` Shuah Khan
2023-11-28 9:27 ` Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 03/55] media: usb: cx231xx: " Benjamin Gaignard
2023-11-28 10:18 ` Hans Verkuil
2023-11-28 10:23 ` Benjamin Gaignard [this message]
2023-11-27 16:54 ` [PATCH 04/55] media: usb: dvb-usb: cxusb-analog: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 05/55] media: usb: gspca: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 06/55] media: atmel: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 07/55] media: imx8-isi: " Benjamin Gaignard
2023-11-27 17:07 ` Laurent Pinchart
2023-11-28 9:31 ` Benjamin Gaignard
2023-11-28 9:35 ` Tomasz Figa
2023-11-28 10:26 ` Benjamin Gaignard
2023-11-29 4:17 ` Tomasz Figa
2023-11-29 8:28 ` Benjamin Gaignard
2023-11-29 8:39 ` Tomasz Figa
2023-11-29 10:24 ` Laurent Pinchart
2023-11-28 10:31 ` Laurent Pinchart
2023-12-07 18:33 ` Nicolas Dufresne
2023-11-27 16:54 ` [PATCH 08/55] media: imx7-media-csi: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 09/55] media: chips-media: coda: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 10/55] media: nuvoton: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 11/55] media: sti: hva: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 12/55] media: rockchip: rkisp1: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 13/55] media: aspeed: " Benjamin Gaignard
2023-11-27 19:26 ` Eddie James
2023-11-27 16:54 ` [PATCH 14/55] media: microchip: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 15/55] media: amphion: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 16/55] media: qcom: venus: " Benjamin Gaignard
2023-11-28 10:26 ` Hans Verkuil
2023-11-29 9:48 ` Tomasz Figa
2023-11-27 16:54 ` [PATCH 17/55] media: sun4i-csi: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 18/55] media: sunxi: sun8i-di: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 19/55] media: sun8i-rotate: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 20/55] media: sunxi: sun6i-csi: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 21/55] media: i2c: video-i2c: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 22/55] media: dvb-core: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 23/55] media: imx: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 24/55] media: atmel: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 25/55] media: ipu3: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 26/55] media: starfive: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 27/55] media: sun6i-isp: " Benjamin Gaignard
2023-11-29 13:40 ` Paul Kocialkowski
2023-11-29 14:03 ` Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 28/55] media: tegra-video: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 29/55] media: ti: am437x: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 30/55] media: ti: cal: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 31/55] media: ti: davinci: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 32/55] media: saa7146: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 33/55] input: touchscreen: atmel: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 34/55] input: touchscreen: sur40: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 35/55] videobuf2: core: Add min_dma_buffers_needed field to vb2_queue Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 36/55] media: stm32: stm32-dcmi: Use min_dma_buffers_needed field Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 37/55] media: renesas: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 38/55] media: ti: j721e-csi2rx: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 39/55] media: ti: omap: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 40/55] samples: v4l2: pci: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 41/55] media: pci: intel: ipu3: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 42/55] media: pci: dt3155: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 43/55] media: pci: bt8xx: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 44/55] media: pci: cx18: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 45/55] media: pci: mgb4: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 46/55] media: pci: tw68: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 47/55] media: pci: cx25821: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 48/55] media: pci: tw5864: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 49/55] media: pci: tw686x: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 50/55] media: pci: cx88: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 51/55] media: pci: cx23885: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 52/55] media: pci: zoran: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 53/55] media: pci: cobalt: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 54/55] media: meson: vdec: " Benjamin Gaignard
2023-11-27 16:54 ` [PATCH 55/55] media: videobuf2: core: Remove 'min_buffers_needed' field Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1402052-f688-4f4b-98ef-e65fdbec3d51@collabora.com \
--to=benjamin.gaignard@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=m.szyprowski@samsung.com \
--cc=matt.ranostay@konsulko.com \
--cc=mchehab@kernel.org \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox