linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] media: davinci: vpif fixes
@ 2014-09-06 15:26 Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 1/5] media: davinci: vpif_display: drop setting of vb2 buffer state to ACTIVE Lad, Prabhakar
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2014-09-06 15:26 UTC (permalink / raw)
  To: LMML; +Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Lad, Prabhakar

this patch series fixes several small issues in VPIF driver.

Lad, Prabhakar (5):
  media: davinci: vpif_display: drop setting of vb2 buffer state to
    ACTIVE
  media: davinci: vpif_capture: drop setting of vb2 buffer state to
    ACTIVE
  media: videobuf2-core.h: add a helper to get status of
    start_streaming()
  media: davinci: vpif_display: fix the check on suspend/resume
    callbacks
  media: davinci: vpif_capture: fix the check on suspend/resume
    callbacks

 drivers/media/platform/davinci/vpif_capture.c | 7 ++-----
 drivers/media/platform/davinci/vpif_display.c | 8 ++------
 include/media/videobuf2-core.h                | 9 +++++++++
 3 files changed, 13 insertions(+), 11 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] media: davinci: vpif_display: drop setting of vb2 buffer state to ACTIVE
  2014-09-06 15:26 [PATCH 0/5] media: davinci: vpif fixes Lad, Prabhakar
@ 2014-09-06 15:26 ` Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 2/5] media: davinci: vpif_capture: " Lad, Prabhakar
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2014-09-06 15:26 UTC (permalink / raw)
  To: LMML; +Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Lad, Prabhakar

this patch drops setting of vb2 buffer state to VB2_BUF_STATE_ACTIVE,
as any buffer queued to the driver is marked ACTIVE by the vb2 core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 2ce3ddf..76f829d 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -196,8 +196,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	list_del(&common->cur_frm->list);
 	spin_unlock_irqrestore(&common->irqlock, flags);
-	/* Mark state of the current frame to active */
-	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
 
 	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
 	common->set_addr((addr + common->ytop_off),
@@ -306,8 +304,6 @@ static void process_progressive_mode(struct common_obj *common)
 	/* Remove that buffer from the buffer queue */
 	list_del(&common->next_frm->list);
 	spin_unlock(&common->irqlock);
-	/* Mark status of the buffer as active */
-	common->next_frm->vb.state = VB2_BUF_STATE_ACTIVE;
 
 	/* Set top and bottom field addrs in VPIF registers */
 	addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] media: davinci: vpif_capture: drop setting of vb2 buffer state to ACTIVE
  2014-09-06 15:26 [PATCH 0/5] media: davinci: vpif fixes Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 1/5] media: davinci: vpif_display: drop setting of vb2 buffer state to ACTIVE Lad, Prabhakar
@ 2014-09-06 15:26 ` Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming() Lad, Prabhakar
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2014-09-06 15:26 UTC (permalink / raw)
  To: LMML; +Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Lad, Prabhakar

this patch drops setting of vb2 buffer state to VB2_BUF_STATE_ACTIVE,
as any buffer queued to the driver is marked ACTIVE by the vb2 core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index cf15bb1..881efcd 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -213,8 +213,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 	/* Remove buffer from the buffer queue */
 	list_del(&common->cur_frm->list);
 	spin_unlock_irqrestore(&common->irqlock, flags);
-	/* Mark state of the current frame to active */
-	common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
 
 	addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
 
@@ -350,7 +348,6 @@ static void vpif_schedule_next_buffer(struct common_obj *common)
 	/* Remove that buffer from the buffer queue */
 	list_del(&common->next_frm->list);
 	spin_unlock(&common->irqlock);
-	common->next_frm->vb.state = VB2_BUF_STATE_ACTIVE;
 	addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0);
 
 	/* Set top and bottom field addresses in VPIF registers */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming()
  2014-09-06 15:26 [PATCH 0/5] media: davinci: vpif fixes Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 1/5] media: davinci: vpif_display: drop setting of vb2 buffer state to ACTIVE Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 2/5] media: davinci: vpif_capture: " Lad, Prabhakar
@ 2014-09-06 15:26 ` Lad, Prabhakar
  2014-09-08  8:06   ` Hans Verkuil
  2014-09-06 15:26 ` [PATCH 4/5] media: davinci: vpif_display: fix the check on suspend/resume callbacks Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 5/5] media: davinci: vpif_capture: " Lad, Prabhakar
  4 siblings, 1 reply; 7+ messages in thread
From: Lad, Prabhakar @ 2014-09-06 15:26 UTC (permalink / raw)
  To: LMML
  Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Lad, Prabhakar,
	Pawel Osciak, Marek Szyprowski, Kyungmin Park

this patch adds a helper to get the status if start_streaming()
was called successfully.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
---
 include/media/videobuf2-core.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 5a10d8d..b3c9973 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -590,6 +590,15 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
 	return 0;
 }
 
+/**
+ * vb2_start_streaming_called() - return streaming status of driver
+ * @q:		videobuf queue
+ */
+static inline bool vb2_start_streaming_called(struct vb2_queue *q)
+{
+	return q->start_streaming_called;
+}
+
 /*
  * The following functions are not part of the vb2 core API, but are simple
  * helper functions that you can use in your struct v4l2_file_operations,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] media: davinci: vpif_display: fix the check on suspend/resume callbacks
  2014-09-06 15:26 [PATCH 0/5] media: davinci: vpif fixes Lad, Prabhakar
                   ` (2 preceding siblings ...)
  2014-09-06 15:26 ` [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming() Lad, Prabhakar
@ 2014-09-06 15:26 ` Lad, Prabhakar
  2014-09-06 15:26 ` [PATCH 5/5] media: davinci: vpif_capture: " Lad, Prabhakar
  4 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2014-09-06 15:26 UTC (permalink / raw)
  To: LMML; +Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Lad, Prabhakar

It is possible to call STREAMON without having any buffers queued.
So vb2_is_streaming() can return true without start_streaming()
having been called. Only after at least one buffer has been
queued will start_streaming be called.

The check vb2_is_streaming() is incorrect as this would start
the DMA without having proper DMA pointers set up. this patch
uses vb2_start_streaming_called() instead to check is streaming
was called.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 76f829d..8d6ced5 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1400,7 +1400,7 @@ static int vpif_suspend(struct device *dev)
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
 
-		if (!vb2_is_streaming(&common->buffer_queue))
+		if (!vb2_start_streaming_called(&common->buffer_queue))
 			continue;
 
 		mutex_lock(&common->lock);
@@ -1432,7 +1432,7 @@ static int vpif_resume(struct device *dev)
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
 
-		if (!vb2_is_streaming(&common->buffer_queue))
+		if (!vb2_start_streaming_called(&common->buffer_queue))
 			continue;
 
 		mutex_lock(&common->lock);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] media: davinci: vpif_capture: fix the check on suspend/resume callbacks
  2014-09-06 15:26 [PATCH 0/5] media: davinci: vpif fixes Lad, Prabhakar
                   ` (3 preceding siblings ...)
  2014-09-06 15:26 ` [PATCH 4/5] media: davinci: vpif_display: fix the check on suspend/resume callbacks Lad, Prabhakar
@ 2014-09-06 15:26 ` Lad, Prabhakar
  4 siblings, 0 replies; 7+ messages in thread
From: Lad, Prabhakar @ 2014-09-06 15:26 UTC (permalink / raw)
  To: LMML; +Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Lad, Prabhakar

It is possible to call STREAMON without having any buffers queued.
So vb2_is_streaming() can return true without start_streaming()
having been called. Only after at least one buffer has been
queued will start_streaming be called.

The check vb2_is_streaming() is incorrect as this would start
the DMA without having proper DMA pointers set up. this patch
uses vb2_start_streaming_called() instead to check is streaming
was called.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpif_capture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 881efcd..3ccb26f 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1596,7 +1596,7 @@ static int vpif_suspend(struct device *dev)
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
 
-		if (!vb2_is_streaming(&common->buffer_queue))
+		if (!vb2_start_streaming_called(&common->buffer_queue))
 			continue;
 
 		mutex_lock(&common->lock);
@@ -1630,7 +1630,7 @@ static int vpif_resume(struct device *dev)
 		ch = vpif_obj.dev[i];
 		common = &ch->common[VPIF_VIDEO_INDEX];
 
-		if (!vb2_is_streaming(&common->buffer_queue))
+		if (!vb2_start_streaming_called(&common->buffer_queue))
 			continue;
 
 		mutex_lock(&common->lock);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming()
  2014-09-06 15:26 ` [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming() Lad, Prabhakar
@ 2014-09-08  8:06   ` Hans Verkuil
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Verkuil @ 2014-09-08  8:06 UTC (permalink / raw)
  To: Lad, Prabhakar, LMML
  Cc: LKML, DLOS, Mauro Carvalho Chehab, Hans Verkuil, Pawel Osciak,
	Marek Szyprowski, Kyungmin Park

On 09/06/2014 05:26 PM, Lad, Prabhakar wrote:
> this patch adds a helper to get the status if start_streaming()
> was called successfully.

Nice! I've had the same idea for quite some time now, but for some reason
I never got around to actually adding it.

	Hans

> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> Cc: Pawel Osciak <pawel@osciak.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  include/media/videobuf2-core.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
> index 5a10d8d..b3c9973 100644
> --- a/include/media/videobuf2-core.h
> +++ b/include/media/videobuf2-core.h
> @@ -590,6 +590,15 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
>  	return 0;
>  }
>  
> +/**
> + * vb2_start_streaming_called() - return streaming status of driver
> + * @q:		videobuf queue
> + */
> +static inline bool vb2_start_streaming_called(struct vb2_queue *q)
> +{
> +	return q->start_streaming_called;
> +}
> +
>  /*
>   * The following functions are not part of the vb2 core API, but are simple
>   * helper functions that you can use in your struct v4l2_file_operations,
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-08  8:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-06 15:26 [PATCH 0/5] media: davinci: vpif fixes Lad, Prabhakar
2014-09-06 15:26 ` [PATCH 1/5] media: davinci: vpif_display: drop setting of vb2 buffer state to ACTIVE Lad, Prabhakar
2014-09-06 15:26 ` [PATCH 2/5] media: davinci: vpif_capture: " Lad, Prabhakar
2014-09-06 15:26 ` [PATCH 3/5] media: videobuf2-core.h: add a helper to get status of start_streaming() Lad, Prabhakar
2014-09-08  8:06   ` Hans Verkuil
2014-09-06 15:26 ` [PATCH 4/5] media: davinci: vpif_display: fix the check on suspend/resume callbacks Lad, Prabhakar
2014-09-06 15:26 ` [PATCH 5/5] media: davinci: vpif_capture: " Lad, Prabhakar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).