From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: Tomasz Figa <tfiga@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
hverkuil@xs4all.nl, mchehab@kernel.org, m.szyprowski@samsung.com,
matt.ranostay@konsulko.com, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
kernel@collabora.com, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>
Subject: Re: [PATCH 07/55] media: imx8-isi: Stop abusing of min_buffers_needed field
Date: Wed, 29 Nov 2023 09:28:26 +0100 [thread overview]
Message-ID: <b68b3fa5-a152-4b23-9451-61a89530512c@collabora.com> (raw)
In-Reply-To: <CAAFQd5Bv5kc9TfNM5CkKowvaoRndTmkmU6+0LyCG8YbOKy=hxQ@mail.gmail.com>
Le 29/11/2023 à 05:17, Tomasz Figa a écrit :
> On Tue, Nov 28, 2023 at 7:26 PM Benjamin Gaignard
> <benjamin.gaignard@collabora.com> wrote:
>>
>> Le 28/11/2023 à 10:35, Tomasz Figa a écrit :
>>> On Tue, Nov 28, 2023 at 6:31 PM Benjamin Gaignard
>>> <benjamin.gaignard@collabora.com> wrote:
>>>> Le 27/11/2023 à 18:07, Laurent Pinchart a écrit :
>>>>> Hi Benjamin,
>>>>>
>>>>> Thank you for the patch.
>>>>>
>>>>> On Mon, Nov 27, 2023 at 05:54:06PM +0100, Benjamin Gaignard wrote:
>>>>>> 'min_buffers_needed' is suppose to be used to indicate the number
>>>>>> of buffers needed by DMA engine to start streaming.
>>>>>> imx8-isi driver doesn't use DMA engine and just want to specify
>>>>> What do you mean, "doesn't use DMA engine" ? The ISI surely has DMA
>>>>> engines :-)
>>>> I have done assumption on drivers given if they use or dma_* functions.
>>> I suspect the use of vb2_dma_sg_plane_desc() and
>>> vb2_dma_contig_plane_dma_addr() may be more correlated to whether
>>> there is a DMA involved or not. Usually V4L2 drivers don't really have
>>> to deal with the DMA API explicitly, because the vb2 framework handles
>>> most of the work.
>> Unfortunately isn't not true either, for example verisilicon driver use
>> these function but doesn't need DMA engine.
> That sounds weird. Why would a driver that doesn't have a DMA engine
> need to obtain a scatterlist or the DMA address of the buffer?
Just because the hardware needs the physical address of the buffer to access it.
>
>> I haven't found yet a 100% criteria to decide if driver use or not DMA engine
>> so I plan to fix case by case given maintainers remarks.
> Yeah, there probably wouldn't be a way that would give one a 100%
> certainty, although I'd still insist that the two functions I
> mentioned should be close to that. Of course a driver can use those
> functions for some queues, while other queues would be pure software
> queues, e.g. for some metadata - a simple grep is not enough. Is that
> perhaps the case for the verisilicon driver?
Verisilicon hardware block doesn't have IOMMU so it needs the physical
addresses of all the buffers it use (input buffer, reference frame buffers, etc...).
No DMA engine involved here it is just how the hardware is working.
Expect functions like dma_release_channel() or being in PCI directory,
I don't have found any magical way to know if a driver needs a minimum number of buffers before start streaming.
I can only read the code and do assumptions for the other cases.
I hope maintainers, like Laurent or you, will answer to this question for each driver.
Regards,
Benjamin
>
> Best regards,
> Tomasz
>
>> Regards,
>> Benjamin
>>
>>> Best regards,
>>> Tomasz
>>>
>>>> I have considers that all PCI drivers are using DMA engine and
>>>> I don't know the design for each drivers so I hope to get this information
>>>> from maintainers and fix that in v2.
>>>> If imx8-isi driver needs a minimum number of buffers before start streaming
>>>> I will do a v2 and use min_dma_buffers_needed instead.
>>>>
>>>> Regards,
>>>> Benjamin
>>>>
>>>>>> 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>
>>>>>> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>>>>> CC: Mauro Carvalho Chehab <mchehab@kernel.org>
>>>>>> CC: Shawn Guo <shawnguo@kernel.org>
>>>>>> CC: Sascha Hauer <s.hauer@pengutronix.de>
>>>>>> CC: Pengutronix Kernel Team <kernel@pengutronix.de>
>>>>>> CC: Fabio Estevam <festevam@gmail.com>
>>>>>> CC: NXP Linux Team <linux-imx@nxp.com>
>>>>>> ---
>>>>>> drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 2 +-
>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
>>>>>> index 49bca2b01cc6..81673ff9084b 100644
>>>>>> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
>>>>>> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
>>>>>> @@ -1453,7 +1453,7 @@ int mxc_isi_video_register(struct mxc_isi_pipe *pipe,
>>>>>> q->mem_ops = &vb2_dma_contig_memops;
>>>>>> q->buf_struct_size = sizeof(struct mxc_isi_buffer);
>>>>>> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>>>>>> - q->min_buffers_needed = 2;
>>>>>> + q->min_reqbufs_allocation = 2;
>>>>>> q->lock = &video->lock;
>>>>>> q->dev = pipe->isi->dev;
>>>>>>
next prev parent reply other threads:[~2023-11-29 8:28 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
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 [this message]
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=b68b3fa5-a152-4b23-9451-61a89530512c@collabora.com \
--to=benjamin.gaignard@collabora.com \
--cc=festevam@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel@collabora.com \
--cc=kernel@pengutronix.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-imx@nxp.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=s.hauer@pengutronix.de \
--cc=shawnguo@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