All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugen Hristev <eugen.hristev@microchip.com>
To: <robh+dt@kernel.org>, <linux-media@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<jacopo+renesas@jmondi.org>, <hverkuil-cisco@xs4all.nl>
Cc: Eugen Hristev <eugen.hristev@microchip.com>,
	sakari.ailus@iki.fi, laurent.pinchart@ideasonboard.com
Subject: [PATCH v4 02/11] media: atmel: atmel-isc-base: use streaming status when queueing buffers
Date: Fri, 21 Jan 2022 15:14:07 +0200	[thread overview]
Message-ID: <20220121131416.603972-3-eugen.hristev@microchip.com> (raw)
In-Reply-To: <20220121131416.603972-1-eugen.hristev@microchip.com>

During experiments with libcamera, it looks like vb2_is_streaming returns
true before our start streaming is called.
Order of operations is streamon -> queue -> start_streaming
ISC would have started the DMA immediately when a buffer is being added
to the vbqueue if the queue is streaming.
It is more safe to start the DMA after the start streaming of the driver is
called.
Thus, even if vb2queue is streaming, add the buffer to the dma queue of the
driver instead of actually starting the DMA process, if the start streaming
has not been called yet.
Tho achieve this, we have to use vb2_start_streaming_called instead of
vb2_is_streaming.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
Changes in v4:
- changed to using vb2_start_streaming_called instead of stop variable

 drivers/media/platform/atmel/atmel-isc-base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
index 9c62d0ae7887..6b0005987a17 100644
--- a/drivers/media/platform/atmel/atmel-isc-base.c
+++ b/drivers/media/platform/atmel/atmel-isc-base.c
@@ -439,7 +439,7 @@ static void isc_buffer_queue(struct vb2_buffer *vb)
 
 	spin_lock_irqsave(&isc->dma_queue_lock, flags);
 	if (!isc->cur_frm && list_empty(&isc->dma_queue) &&
-		vb2_is_streaming(vb->vb2_queue)) {
+		vb2_start_streaming_called(vb->vb2_queue)) {
 		isc->cur_frm = buf;
 		isc_start_dma(isc);
 	} else
@@ -1532,7 +1532,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)
 
 		isc_update_awb_ctrls(isc);
 
-		if (vb2_is_streaming(&isc->vb2_vidq)) {
+		if (vb2_start_streaming_called(&isc->vb2_vidq)) {
 			/*
 			 * If we are streaming, we can update profile to
 			 * have the new settings in place.
@@ -1549,7 +1549,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)
 
 		/* if we have autowhitebalance on, start histogram procedure */
 		if (ctrls->awb == ISC_WB_AUTO &&
-		    vb2_is_streaming(&isc->vb2_vidq) &&
+		    vb2_start_streaming_called(&isc->vb2_vidq) &&
 		    ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code))
 			isc_set_histogram(isc, true);
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Eugen Hristev <eugen.hristev@microchip.com>
To: <robh+dt@kernel.org>, <linux-media@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<jacopo+renesas@jmondi.org>, <hverkuil-cisco@xs4all.nl>
Cc: <nicolas.ferre@microchip.com>, <sakari.ailus@iki.fi>,
	<laurent.pinchart@ideasonboard.com>,
	Eugen Hristev <eugen.hristev@microchip.com>
Subject: [PATCH v4 02/11] media: atmel: atmel-isc-base: use streaming status when queueing buffers
Date: Fri, 21 Jan 2022 15:14:07 +0200	[thread overview]
Message-ID: <20220121131416.603972-3-eugen.hristev@microchip.com> (raw)
In-Reply-To: <20220121131416.603972-1-eugen.hristev@microchip.com>

During experiments with libcamera, it looks like vb2_is_streaming returns
true before our start streaming is called.
Order of operations is streamon -> queue -> start_streaming
ISC would have started the DMA immediately when a buffer is being added
to the vbqueue if the queue is streaming.
It is more safe to start the DMA after the start streaming of the driver is
called.
Thus, even if vb2queue is streaming, add the buffer to the dma queue of the
driver instead of actually starting the DMA process, if the start streaming
has not been called yet.
Tho achieve this, we have to use vb2_start_streaming_called instead of
vb2_is_streaming.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
Changes in v4:
- changed to using vb2_start_streaming_called instead of stop variable

 drivers/media/platform/atmel/atmel-isc-base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
index 9c62d0ae7887..6b0005987a17 100644
--- a/drivers/media/platform/atmel/atmel-isc-base.c
+++ b/drivers/media/platform/atmel/atmel-isc-base.c
@@ -439,7 +439,7 @@ static void isc_buffer_queue(struct vb2_buffer *vb)
 
 	spin_lock_irqsave(&isc->dma_queue_lock, flags);
 	if (!isc->cur_frm && list_empty(&isc->dma_queue) &&
-		vb2_is_streaming(vb->vb2_queue)) {
+		vb2_start_streaming_called(vb->vb2_queue)) {
 		isc->cur_frm = buf;
 		isc_start_dma(isc);
 	} else
@@ -1532,7 +1532,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)
 
 		isc_update_awb_ctrls(isc);
 
-		if (vb2_is_streaming(&isc->vb2_vidq)) {
+		if (vb2_start_streaming_called(&isc->vb2_vidq)) {
 			/*
 			 * If we are streaming, we can update profile to
 			 * have the new settings in place.
@@ -1549,7 +1549,7 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)
 
 		/* if we have autowhitebalance on, start histogram procedure */
 		if (ctrls->awb == ISC_WB_AUTO &&
-		    vb2_is_streaming(&isc->vb2_vidq) &&
+		    vb2_start_streaming_called(&isc->vb2_vidq) &&
 		    ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code))
 			isc_set_histogram(isc, true);
 
-- 
2.25.1


  parent reply	other threads:[~2022-01-21 13:16 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 13:14 [PATCH v4 00/11] media: atmel: atmel-isc: implement media controller Eugen Hristev
2022-01-21 13:14 ` Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 01/11] media: atmel: atmel-isc: replace 'stop' variable with vb2 calls Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-02-07 10:46   ` Jacopo Mondi
2022-02-07 10:46     ` Jacopo Mondi
2022-02-08 12:50     ` Eugen.Hristev
2022-02-08 12:50       ` Eugen.Hristev
2022-01-21 13:14 ` Eugen Hristev [this message]
2022-01-21 13:14   ` [PATCH v4 02/11] media: atmel: atmel-isc-base: use streaming status when queueing buffers Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 03/11] media: atmel: atmel-isc: implement media controller Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-02-07 12:44   ` Jacopo Mondi
2022-02-07 12:44     ` Jacopo Mondi
2022-02-07 13:40     ` Eugen.Hristev
2022-02-07 13:40       ` Eugen.Hristev
2022-02-08  8:59       ` Jacopo Mondi
2022-02-08  8:59         ` Jacopo Mondi
2022-02-08 10:33         ` Eugen.Hristev
2022-02-08 10:33           ` Eugen.Hristev
2022-02-08 19:30           ` Jacopo Mondi
2022-02-08 19:30             ` Jacopo Mondi
2022-02-09  6:59             ` Eugen.Hristev
2022-02-09  6:59               ` Eugen.Hristev
2022-02-10 17:49               ` Jacopo Mondi
2022-02-10 17:49                 ` Jacopo Mondi
2022-02-11 10:32                 ` Eugen.Hristev
2022-02-11 10:32                   ` Eugen.Hristev
2022-02-11 11:55                   ` Jacopo Mondi
2022-02-11 11:55                     ` Jacopo Mondi
2022-02-11 12:32                     ` Eugen.Hristev
2022-02-11 12:32                       ` Eugen.Hristev
2022-02-11 13:23                       ` Jacopo Mondi
2022-02-11 13:23                         ` Jacopo Mondi
2022-01-21 13:14 ` [PATCH v4 04/11] media: atmel: atmel-sama5d2-isc: fix wrong mask in YUYV format check Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 05/11] media: atmel: atmel-isc-base: use mutex to lock awb workqueue from streaming Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 06/11] media: atmel: atmel-isc: compact the controller formats list Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 07/11] media: atmel: atmel-isc: change format propagation to subdev into only verification Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-02-10 18:43   ` Jacopo Mondi
2022-02-10 18:43     ` Jacopo Mondi
2022-02-11 10:38     ` Eugen.Hristev
2022-02-11 10:38       ` Eugen.Hristev
2022-02-11 11:59       ` Jacopo Mondi
2022-02-11 11:59         ` Jacopo Mondi
2022-01-21 13:14 ` [PATCH v4 08/11] dt-bindings: media: microchip, xisc: add bus-width of 14 Eugen Hristev
2022-01-21 13:14   ` [PATCH v4 08/11] dt-bindings: media: microchip,xisc: " Eugen Hristev
2022-02-04 22:59   ` Rob Herring
2022-02-04 22:59     ` Rob Herring
2022-01-21 13:14 ` [PATCH v4 09/11] ARM: dts: at91: sama7g5: add nodes for video capture Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 10/11] ARM: configs: at91: sama7: add xisc and csi2dc Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev
2022-01-21 13:14 ` [PATCH v4 11/11] ARM: multi_v7_defconfig: add atmel video pipeline modules Eugen Hristev
2022-01-21 13:14   ` Eugen Hristev

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=20220121131416.603972-3-eugen.hristev@microchip.com \
    --to=eugen.hristev@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.