Message ID | 20240314153226.197445-4-benjamin.gaignard@collabora.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Hans Verkuil |
Headers |
Received: from ny.mirrors.kernel.org ([147.75.199.223]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-7083-patchwork=linuxtv.org@vger.kernel.org>) id 1rkn4t-0004tl-1G for patchwork@linuxtv.org; Thu, 14 Mar 2024 15:33:08 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2A3971C208D6 for <patchwork@linuxtv.org>; Thu, 14 Mar 2024 15:33:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF6927350A; Thu, 14 Mar 2024 15:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="skQ3eSMA" X-Original-To: linux-media@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 009AE71B3D; Thu, 14 Mar 2024 15:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710430358; cv=none; b=JoTaZb751EYHCfgs9z96WRlRhLsKxF539Ql2Q23R7nCqXWDS4XChtAa6aYNf/V+Nh9Fv7Z2JyLhuSYzib0JsOGm7B4u6rGEIY328NP17LtzCDensnDtTir5cO/YvLJpDYkaNqt1eSUdv72r8bXKslkDOJltXUWu4B0NbCjqs7Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710430358; c=relaxed/simple; bh=qivh6TydDKfcZbVPYc7spMw2cRqVCzEb9YVNhr43HUY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=liMxT0q8YIodmiyv96FtjsvAbDRNHjpFnRfzeREV8YS0b+vnC+UeolvOcMWGgQ8G/ZLU9zUZ38aFlXO6iia/t3cwawZcmh7Noj9FkJeURTu26x3TQBT7ZF+V/y4GpLtrzc74iCDHo9hFUlin86oTYeDN+HOWQjwSm4fxBXQQlfE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=skQ3eSMA; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1710430355; bh=qivh6TydDKfcZbVPYc7spMw2cRqVCzEb9YVNhr43HUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=skQ3eSMAXzuXhHKCUz0EJJybjE9cehdLr00xV0RTimHvr10PXRK1D4ZWbNlaWilKV 9P1raRucv9swWQ9KoPju8oAPf/sAw4/9/bEQllpueFb58McYx8CgMjPUiJBJMJjmBp tYXGT4xi6JcGM/0lmwapjepEqOdgOihd0qGKMgnqtu01TMeJahhVXqEC+6/jNnE4Rv v2dtiG7N0786AElgrzhESIQ+ktAVVtfqX1J1wR8n5IMxsEB54Io/28vZWPU2qzoBwp zXZo1Ttpr7gFIB31az/955kYixHy9o/Kk6/bnV5Y3X0VMkgyTRUOWRcfD8bErcpw9k bw9x+OgOvq8/A== Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madrid.collaboradmins.com (Postfix) with ESMTPSA id C613337820F8; Thu, 14 Mar 2024 15:32:34 +0000 (UTC) From: Benjamin Gaignard <benjamin.gaignard@collabora.com> To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, hverkuil-cisco@xs4all.nl, nicolas@ndufresne.ca Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, kernel@collabora.com, Benjamin Gaignard <benjamin.gaignard@collabora.com> Subject: [PATCH v21 3/9] media: test-drivers: Set REQBUFS minimum number of buffers Date: Thu, 14 Mar 2024 16:32:20 +0100 Message-Id: <20240314153226.197445-4-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240314153226.197445-1-benjamin.gaignard@collabora.com> References: <20240314153226.197445-1-benjamin.gaignard@collabora.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-LSpam-Score: -3.3 (---) X-LSpam-Report: No, score=-3.3 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_PASS=-0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_LOW=-0.7,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no |
Series |
Add REMOVE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
March 14, 2024, 3:32 p.m. UTC
Instead of using 'min_queued_buffers' field to specify the
minimum number of buffers to be allocated when calling REQBUF
use 'min_reqbufs_allocation' field which is dedicated to this
purpose.
While at it rename vivid_create_queue() parameter.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/test-drivers/vimc/vimc-capture.c | 2 +-
drivers/media/test-drivers/vivid/vivid-core.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
Hi Benjamin, On 14/03/2024 4:32 pm, Benjamin Gaignard wrote: > Instead of using 'min_queued_buffers' field to specify the > minimum number of buffers to be allocated when calling REQBUF > use 'min_reqbufs_allocation' field which is dedicated to this > purpose. > > While at it rename vivid_create_queue() parameter. > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > --- > drivers/media/test-drivers/vimc/vimc-capture.c | 2 +- > drivers/media/test-drivers/vivid/vivid-core.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c > index 2a2d19d23bab..97693561f1e4 100644 > --- a/drivers/media/test-drivers/vimc/vimc-capture.c > +++ b/drivers/media/test-drivers/vimc/vimc-capture.c > @@ -432,7 +432,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc, > q->mem_ops = vimc_allocator == VIMC_ALLOCATOR_DMA_CONTIG > ? &vb2_dma_contig_memops : &vb2_vmalloc_memops; > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > - q->min_queued_buffers = 2; > + q->min_reqbufs_allocation = 2; > q->lock = &vcapture->lock; > q->dev = v4l2_dev->dev; > > diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c > index 159c72cbb5bf..11b8520d9f57 100644 > --- a/drivers/media/test-drivers/vivid/vivid-core.c > +++ b/drivers/media/test-drivers/vivid/vivid-core.c > @@ -861,7 +861,7 @@ static const struct media_device_ops vivid_media_ops = { > static int vivid_create_queue(struct vivid_dev *dev, > struct vb2_queue *q, > u32 buf_type, > - unsigned int min_queued_buffers, > + unsigned int min_reqbufs_allocation, > const struct vb2_ops *ops) > { > if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->multiplanar) > @@ -898,7 +898,7 @@ static int vivid_create_queue(struct vivid_dev *dev, > q->mem_ops = allocators[dev->inst] == 1 ? &vb2_dma_contig_memops : > &vb2_vmalloc_memops; > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > - q->min_queued_buffers = supports_requests[dev->inst] ? 0 : min_queued_buffers; > + q->min_reqbufs_allocation = min_reqbufs_allocation; > q->lock = &dev->mutex; > q->dev = dev->v4l2_dev.dev; > q->supports_requests = supports_requests[dev->inst]; How did you test this series? If I run the test-media script using the patch v4l2-compliance (the v9 series) I get two failures. Both are traced to code in vivid: meta_out_queue_setup() and touch_cap_queue_setup(): Both have this code: if (*nplanes) { if (sizes[0] < size) return -EINVAL; } else { sizes[0] = size; } if (q_num_bufs + *nbuffers < 2) *nbuffers = 2 - q_num_bufs; *nplanes = 1; return 0; It's the *nbuffers assignment that is wrong. Looking at vivid-core.c I see that vivid_create_queue() is called with min_reqbufs_allocation set to 1 for these two devices. I think that should be 2, and then the code above can be dropped. It is probably best to post a v21.1 3/9 patch only. Regards, Hans
On 18/03/2024 11:06 am, Hans Verkuil wrote: > Hi Benjamin, > > On 14/03/2024 4:32 pm, Benjamin Gaignard wrote: >> Instead of using 'min_queued_buffers' field to specify the >> minimum number of buffers to be allocated when calling REQBUF >> use 'min_reqbufs_allocation' field which is dedicated to this >> purpose. >> >> While at it rename vivid_create_queue() parameter. >> >> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> >> --- >> drivers/media/test-drivers/vimc/vimc-capture.c | 2 +- >> drivers/media/test-drivers/vivid/vivid-core.c | 4 ++-- >> 2 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c >> index 2a2d19d23bab..97693561f1e4 100644 >> --- a/drivers/media/test-drivers/vimc/vimc-capture.c >> +++ b/drivers/media/test-drivers/vimc/vimc-capture.c >> @@ -432,7 +432,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc, >> q->mem_ops = vimc_allocator == VIMC_ALLOCATOR_DMA_CONTIG >> ? &vb2_dma_contig_memops : &vb2_vmalloc_memops; >> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; >> - q->min_queued_buffers = 2; >> + q->min_reqbufs_allocation = 2; >> q->lock = &vcapture->lock; >> q->dev = v4l2_dev->dev; >> >> diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c >> index 159c72cbb5bf..11b8520d9f57 100644 >> --- a/drivers/media/test-drivers/vivid/vivid-core.c >> +++ b/drivers/media/test-drivers/vivid/vivid-core.c >> @@ -861,7 +861,7 @@ static const struct media_device_ops vivid_media_ops = { >> static int vivid_create_queue(struct vivid_dev *dev, >> struct vb2_queue *q, >> u32 buf_type, >> - unsigned int min_queued_buffers, >> + unsigned int min_reqbufs_allocation, >> const struct vb2_ops *ops) >> { >> if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->multiplanar) >> @@ -898,7 +898,7 @@ static int vivid_create_queue(struct vivid_dev *dev, >> q->mem_ops = allocators[dev->inst] == 1 ? &vb2_dma_contig_memops : >> &vb2_vmalloc_memops; >> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; >> - q->min_queued_buffers = supports_requests[dev->inst] ? 0 : min_queued_buffers; >> + q->min_reqbufs_allocation = min_reqbufs_allocation; >> q->lock = &dev->mutex; >> q->dev = dev->v4l2_dev.dev; >> q->supports_requests = supports_requests[dev->inst]; > > How did you test this series? If I run the test-media script using the patch > v4l2-compliance (the v9 series) I get two failures. Both are traced to code > in vivid: meta_out_queue_setup() and touch_cap_queue_setup(): > > Both have this code: > > if (*nplanes) { > if (sizes[0] < size) > return -EINVAL; > } else { > sizes[0] = size; > } > > if (q_num_bufs + *nbuffers < 2) > *nbuffers = 2 - q_num_bufs; > > *nplanes = 1; > return 0; > > It's the *nbuffers assignment that is wrong. Looking at vivid-core.c I see > that vivid_create_queue() is called with min_reqbufs_allocation set to 1 for > these two devices. I think that should be 2, and then the code above can > be dropped. Note that if that 'if (q_num_bufs + *nbuffers < 2)' is dropped, then you should also drop the q_num_bufs assignment at the beginning of the function since that is now no longer used. Regards, Hans > > It is probably best to post a v21.1 3/9 patch only. > > Regards, > > Hans > > >
Em Thu, 14 Mar 2024 16:32:20 +0100 Benjamin Gaignard <benjamin.gaignard@collabora.com> escreveu: > Instead of using 'min_queued_buffers' field to specify the > minimum number of buffers to be allocated when calling REQBUF > use 'min_reqbufs_allocation' field which is dedicated to this > purpose. > > While at it rename vivid_create_queue() parameter. LGTM. Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > --- > drivers/media/test-drivers/vimc/vimc-capture.c | 2 +- > drivers/media/test-drivers/vivid/vivid-core.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c > index 2a2d19d23bab..97693561f1e4 100644 > --- a/drivers/media/test-drivers/vimc/vimc-capture.c > +++ b/drivers/media/test-drivers/vimc/vimc-capture.c > @@ -432,7 +432,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc, > q->mem_ops = vimc_allocator == VIMC_ALLOCATOR_DMA_CONTIG > ? &vb2_dma_contig_memops : &vb2_vmalloc_memops; > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > - q->min_queued_buffers = 2; > + q->min_reqbufs_allocation = 2; > q->lock = &vcapture->lock; > q->dev = v4l2_dev->dev; > > diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c > index 159c72cbb5bf..11b8520d9f57 100644 > --- a/drivers/media/test-drivers/vivid/vivid-core.c > +++ b/drivers/media/test-drivers/vivid/vivid-core.c > @@ -861,7 +861,7 @@ static const struct media_device_ops vivid_media_ops = { > static int vivid_create_queue(struct vivid_dev *dev, > struct vb2_queue *q, > u32 buf_type, > - unsigned int min_queued_buffers, > + unsigned int min_reqbufs_allocation, > const struct vb2_ops *ops) > { > if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->multiplanar) > @@ -898,7 +898,7 @@ static int vivid_create_queue(struct vivid_dev *dev, > q->mem_ops = allocators[dev->inst] == 1 ? &vb2_dma_contig_memops : > &vb2_vmalloc_memops; > q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > - q->min_queued_buffers = supports_requests[dev->inst] ? 0 : min_queued_buffers; > + q->min_reqbufs_allocation = min_reqbufs_allocation; > q->lock = &dev->mutex; > q->dev = dev->v4l2_dev.dev; > q->supports_requests = supports_requests[dev->inst]; Thanks, Mauro
diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c index 2a2d19d23bab..97693561f1e4 100644 --- a/drivers/media/test-drivers/vimc/vimc-capture.c +++ b/drivers/media/test-drivers/vimc/vimc-capture.c @@ -432,7 +432,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc, q->mem_ops = vimc_allocator == VIMC_ALLOCATOR_DMA_CONTIG ? &vb2_dma_contig_memops : &vb2_vmalloc_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - q->min_queued_buffers = 2; + q->min_reqbufs_allocation = 2; q->lock = &vcapture->lock; q->dev = v4l2_dev->dev; diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 159c72cbb5bf..11b8520d9f57 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -861,7 +861,7 @@ static const struct media_device_ops vivid_media_ops = { static int vivid_create_queue(struct vivid_dev *dev, struct vb2_queue *q, u32 buf_type, - unsigned int min_queued_buffers, + unsigned int min_reqbufs_allocation, const struct vb2_ops *ops) { if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->multiplanar) @@ -898,7 +898,7 @@ static int vivid_create_queue(struct vivid_dev *dev, q->mem_ops = allocators[dev->inst] == 1 ? &vb2_dma_contig_memops : &vb2_vmalloc_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - q->min_queued_buffers = supports_requests[dev->inst] ? 0 : min_queued_buffers; + q->min_reqbufs_allocation = min_reqbufs_allocation; q->lock = &dev->mutex; q->dev = dev->v4l2_dev.dev; q->supports_requests = supports_requests[dev->inst];