Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1859761rdb; Thu, 7 Dec 2023 10:33:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQoc06XWN37Qltnl3JtVWNyPjUIP+bVIoZ1MEqDxQ/PRc8s9L66ghO203jmCmGeFRygDhn X-Received: by 2002:a17:90b:33d1:b0:286:ba37:3518 with SMTP id lk17-20020a17090b33d100b00286ba373518mr2595955pjb.47.1701974030273; Thu, 07 Dec 2023 10:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701974030; cv=none; d=google.com; s=arc-20160816; b=gh8vQdCs7HFEXMGc7jiglPO3J+tOTUttWe/CZBZ4AnY89LqM/frnv9YPq1HP94GzDH QGsDwHPKTe3kS45RUDWPpJKEFhx489umVmlD1Nq/n2GEtjqbJsXGHzuI4XmHgI+3t4OB ZM6h7y4d6E3XtViSGLFOoAFW+LSc/qOrnfFSTbrY/dX9/gDqFkGsuBOkrC/CdPRiA/mC kOEhAyeIRWHVSovLNmECvUlqjvIQLQd3gqvk+grFryeOpig7a0P5lv5BzwESZfg0DnsR oQP3+Dx2lGErZ3te6SbwXRWbtNOd9mPOYMhYpybDUlvSXeyQUdn90kcVauVuxtYf15qb T8Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=GZWhK495VLeN7TNOf6swobaME2YnrmvMGk89MvaYBHI=; fh=LgkEUzIgPZ1O9OR+aecHz8YG7IBy/TMvb9b2zqc7ysY=; b=eI1JKB9xbh4sFgPSWJcZnES/oery16ZADuiTNvVPMXPH7NNUN+5COp5hf+j4lyNPIl dTogn2ZhJ8nfESKdreQ9LkkfZb3wLXQ2pfCJziwHWG6VdfE4GsxO4nB4fuiwGq5O2U/l 6qhnK7mRqLcndQm2UV0KRGr8es1XAvgeahExc9yWwGhL131q6Ph/VbQATbF9kpQ8MuVv KXREBGIpml02CE0/oLly7pr0X3ih4F9DDZm74WuXSLQ9JgraoaxCpB56RzKb9sk9oCQc LEu8e75kBi14RTFLUKZnBpbnYMV0KCByXMTBNdw5zG0E1//DF3yp8BoRaVpb8QvLwslK Y8bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20230601.gappssmtp.com header.s=20230601 header.b=AJyY+Uur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u14-20020a17090a400e00b00286ac37da16si1446337pjc.181.2023.12.07.10.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:33:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ndufresne-ca.20230601.gappssmtp.com header.s=20230601 header.b=AJyY+Uur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 20147802C8E1; Thu, 7 Dec 2023 10:33:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232865AbjLGSdj (ORCPT + 99 others); Thu, 7 Dec 2023 13:33:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjLGSdi (ORCPT ); Thu, 7 Dec 2023 13:33:38 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77D4D170D for ; Thu, 7 Dec 2023 10:33:41 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-4239f5c1ec2so7660711cf.0 for ; Thu, 07 Dec 2023 10:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1701974020; x=1702578820; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=GZWhK495VLeN7TNOf6swobaME2YnrmvMGk89MvaYBHI=; b=AJyY+UurD2VyzWSnIyramL1wrfCzPSmNBHI+QAzXXvOPvucYNpbhreZo8Irf6rWwW7 /mAIhUo6ZJ/G6Dk5OwiTEzXtEJ4ZjzORjilsErCoJ88VsZbj/pX0Fs1/i5QjQfDkKvbq CdWxWXOZ/BNoLK9K5uez7XJLVSg1ea3Mc7WfmHCJjypfE3xsTQlBFDEcfJmIEu1iSOqM ShZQPG9+5iHzFqnF5bcZZPTQEXZNBzrAxdth7yqvyKE1NMJsShR1zCsdreeGbl82TIAj BAIAqbHdAVFQKSxmCleOhhHPl1qWYZymd5cHXo/k8nlxIQTViGczkxX+peucwFG+Ew3R jugQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701974020; x=1702578820; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GZWhK495VLeN7TNOf6swobaME2YnrmvMGk89MvaYBHI=; b=dLjVdnw4bkLw4CVyrLp9BaWpES0IdJn/a7NxvHPiiaHiud0baDTXB9iZNLZ3l7/ihr O7oZTiRZbF9UVuvhHTGUeWIGtyAdvpuocF7KTe1TrPGpQEwnzLgap1sGdBFdQUyXa7VX PQztJqi1/9UxXTFNxrGlfeY5XSF40VAq5BBePfjbBPGmgs5UWZcrlf8u2SaeN+ZFwTZu OyzvXNMsnw21q1isjIpxX0+WiPiq2ubkHuxkxpihvqAeQoxtt8NX/zjW/QfJ8+FsLfrj 1Cp6zK1q585/6Q7eLuDGsuIUGSixIciehghfKRMev1Tzq1nBvLUATbpmCnvWJSTJNV4s QmKA== X-Gm-Message-State: AOJu0YwiXCUuINWpY3hoqm7w23T/KZKe1Cczh+Zt7ovFC2zZnE/1inQw J2bvkj/OCXV8X29n04g7qev7MA== X-Received: by 2002:ac8:570b:0:b0:425:4043:41c7 with SMTP id 11-20020ac8570b000000b00425404341c7mr3133948qtw.115.1701974020565; Thu, 07 Dec 2023 10:33:40 -0800 (PST) Received: from nicolas-tpx395.localdomain ([2606:6d00:17:b5c::7a9]) by smtp.gmail.com with ESMTPSA id j15-20020ac8664f000000b004255e0e5962sm131926qtp.50.2023.12.07.10.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:33:40 -0800 (PST) Message-ID: <3ab3f9ea25d222c0b27e1b76f80c1abe76d27def.camel@ndufresne.ca> Subject: Re: [PATCH 07/55] media: imx8-isi: Stop abusing of min_buffers_needed field From: Nicolas Dufresne To: Laurent Pinchart , Tomasz Figa Cc: Benjamin Gaignard , 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 , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Date: Thu, 07 Dec 2023 13:33:38 -0500 In-Reply-To: <20231128103117.GF31314@pendragon.ideasonboard.com> References: <20231127165454.166373-1-benjamin.gaignard@collabora.com> <20231127165454.166373-8-benjamin.gaignard@collabora.com> <20231127170700.GC31314@pendragon.ideasonboard.com> <6fa1ec09-3e30-475e-9718-29d23586753e@collabora.com> <20231128103117.GF31314@pendragon.ideasonboard.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 10:33:49 -0800 (PST) Le mardi 28 novembre 2023 =C3=A0 12:31 +0200, Laurent Pinchart a =C3=A9crit= =C2=A0: > On Tue, Nov 28, 2023 at 06:35:51PM +0900, Tomasz Figa wrote: > > On Tue, Nov 28, 2023 at 6:31=E2=80=AFPM Benjamin Gaignard wrote: > > > Le 27/11/2023 =C3=A0 18:07, Laurent Pinchart a =C3=A9crit : > > > > Hi Benjamin, > > > >=20 > > > > Thank you for the patch. > > > >=20 > > > > 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 :-) > > >=20 > > > I have done assumption on drivers given if they use or dma_* function= s. > >=20 > > 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. >=20 > And this is anyway not related to DMA at all, but to the logic each > driver implements when it deals with buffers. There's a lower chance a > USB driver driver will have a hard requirement for more than one buffer > compared to an AMBA/platform/PCI device driver, but at the end of the > day, each driver needs to be analyzed individually to check what they > require. Benjamin, I think you'll have some more homework to do :-) Personally, I disagree that we should blindly patch drivers and actually ch= ange the framework behaviour. A patch that simply take what we have, and make it= so a human reader now understand what is going on should be acceptable. Maintain= ers or developer that have access to the hardware should be making this judgmen= t now that the current behaviour is visible, modify and test it. Asking to eye review drivers and change their behaviour without any test be= ing conducted will certainly cause regressions. I don't believe this is the rig= ht approach. Refactoring the code, making an effort to not change the behaviou= r during refactoring does make more sense to me. regards, Nicolas >=20 > > > 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 inform= ation > > > from maintainers and fix that in v2. > > > If imx8-isi driver needs a minimum number of buffers before start str= eaming > > > I will do a v2 and use min_dma_buffers_needed instead. > > >=20 > > > > > the minimum number of buffers to allocate when calling VIDIOC_REQ= BUFS. > > > > > That 'min_reqbufs_allocation' field purpose so use it. > > > > >=20 > > > > > Signed-off-by: Benjamin Gaignard > > > > > CC: Laurent Pinchart > > > > > CC: Mauro Carvalho Chehab > > > > > CC: Shawn Guo > > > > > CC: Sascha Hauer > > > > > CC: Pengutronix Kernel Team > > > > > CC: Fabio Estevam > > > > > CC: NXP Linux Team > > > > > --- > > > > > drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > >=20 > > > > > 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_p= ipe *pipe, > > > > > q->mem_ops =3D &vb2_dma_contig_memops; > > > > > q->buf_struct_size =3D sizeof(struct mxc_isi_buffer); > > > > > q->timestamp_flags =3D V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > > > > > - q->min_buffers_needed =3D 2; > > > > > + q->min_reqbufs_allocation =3D 2; > > > > > q->lock =3D &video->lock; > > > > > q->dev =3D pipe->isi->dev; > > > > >=20 >=20