mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
To: LMML <linux-media@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	DLOS <davinci-linux-open-source@linux.davincidsp.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Subject: [PATCH 12/15] media: davinci: vpbe: use helpers provided by core if streaming is started
Date: Sun, 12 Oct 2014 21:40:42 +0100	[thread overview]
Message-ID: <1413146445-7304-13-git-send-email-prabhakar.csengg@gmail.com> (raw)
In-Reply-To: <1413146445-7304-1-git-send-email-prabhakar.csengg@gmail.com>

this patch uses vb2_is_busy() helper to check if streaming is
actually started, instead of driver managing it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 drivers/media/platform/davinci/vpbe_display.c | 34 ++++++++-------------------
 include/media/davinci/vpbe_display.h          |  4 ----
 2 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index 378f31b..b57fa68 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -152,8 +152,8 @@ static irqreturn_t venc_isr(int irq, void *arg)
 
 	for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
 		layer = disp_dev->dev[i];
-		/* If streaming is started in this layer */
-		if (!layer->started)
+
+		if (!vb2_start_streaming_called(&layer->buffer_queue))
 			continue;
 
 		if (layer->layer_first_int) {
@@ -314,7 +314,6 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
 	 * if request format is yuv420 semiplanar, need to
 	 * enable both video windows
 	 */
-	layer->started = 1;
 	layer->layer_first_int = 1;
 
 	return ret;
@@ -829,11 +828,9 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
 			"VIDIOC_S_FMT, layer id = %d\n",
 			layer->device_id);
 
-	/* If streaming is started, return error */
-	if (layer->started) {
-		v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
+	if (vb2_is_busy(&layer->buffer_queue))
 		return -EBUSY;
-	}
+
 	if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) {
 		v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n");
 		return -EINVAL;
@@ -937,11 +934,9 @@ static int vpbe_display_s_std(struct file *file, void *priv,
 
 	v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n");
 
-	/* If streaming is started, return error */
-	if (layer->started) {
-		v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
+	if (vb2_is_busy(&layer->buffer_queue))
 		return -EBUSY;
-	}
+
 	if (NULL != vpbe_dev->ops.s_std) {
 		ret = vpbe_dev->ops.s_std(vpbe_dev, std_id);
 		if (ret) {
@@ -1021,11 +1016,10 @@ static int vpbe_display_s_output(struct file *file, void *priv,
 	int ret;
 
 	v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev,	"VIDIOC_S_OUTPUT\n");
-	/* If streaming is started, return error */
-	if (layer->started) {
-		v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
+
+	if (vb2_is_busy(&layer->buffer_queue))
 		return -EBUSY;
-	}
+
 	if (NULL == vpbe_dev->ops.set_output)
 		return -EINVAL;
 
@@ -1102,12 +1096,8 @@ vpbe_display_s_dv_timings(struct file *file, void *priv,
 
 	v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n");
 
-
-	/* If streaming is started, return error */
-	if (layer->started) {
-		v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
+	if (vb2_is_busy(&layer->buffer_queue))
 		return -EBUSY;
-	}
 
 	/* Set the given standard in the encoder */
 	if (!vpbe_dev->ops.s_dv_timings)
@@ -1212,13 +1202,9 @@ static int vpbe_display_release(struct file *file)
 	v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n");
 
 	mutex_lock(&layer->opslock);
-	/* Reset io_usrs member of layer object */
-	layer->io_usrs = 0;
 
 	osd_device->ops.disable_layer(osd_device,
 			layer->layer_info.id);
-	layer->started = 0;
-
 	/* Decrement layer usrs counter */
 	layer->usrs--;
 	/* If this file handle has initialize encoder device, reset it */
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h
index 06ea815..de0843d 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -106,12 +106,8 @@ struct vpbe_layer {
 	unsigned char window_enable;
 	/* number of open instances of the layer */
 	unsigned int usrs;
-	/* number of users performing IO */
-	unsigned int io_usrs;
 	/* Indicates id of the field which is being displayed */
 	unsigned int field_id;
-	/* Indicates whether streaming started */
-	unsigned char started;
 	/* Identifies device object */
 	enum vpbe_display_device_id device_id;
 	/* facilitation of ioctl ops lock by v4l2*/
-- 
1.9.1


  parent reply	other threads:[~2014-10-12 20:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 20:40 [PATCH 00/15] media: davinci: vpbe enhancements Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 01/15] media: davinci: vpbe: initialize vb2 queue and DMA context in probe Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 02/15] media: davinci: vpbe: drop buf_init() callback Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 03/15] media: davinci: vpbe: use vb2_ops_wait_prepare/finish helper functions Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 04/15] media: davinci: vpbe: drop buf_cleanup() callback Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 05/15] media: davinci: vpbe: improve vpbe_buffer_prepare() callback Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 06/15] media: davinci: vpbe: use vb2_fop_mmap/poll Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 07/15] media: davinci: vpbe: use fh handling provided by v4l Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 08/15] media: davinci: vpbe: use vb2_ioctl_* helpers Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 09/15] media: davinci: vpbe: add support for VB2_DMABUF Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 10/15] media: davinci: vpbe: add support for VIDIOC_CREATE_BUFS Lad, Prabhakar
2014-10-22 11:26   ` Hans Verkuil
2014-10-22 21:48     ` Prabhakar Lad
2014-10-12 20:40 ` [PATCH 11/15] media: davinci: vpbe: add support for VIDIOC_EXPBUF Lad, Prabhakar
2014-10-12 20:40 ` Lad, Prabhakar [this message]
2014-10-12 20:40 ` [PATCH 13/15] media: davinci: vpbe: drop unused member memory from vpbe_layer Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 14/15] media: davinci: vpbe: group v4l2_ioctl_ops Lad, Prabhakar
2014-10-12 20:40 ` [PATCH 15/15] media: davinci: vpbe: return -ENODATA for *dv_timings/*_std calls Lad, Prabhakar

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=1413146445-7304-13-git-send-email-prabhakar.csengg@gmail.com \
    --to=prabhakar.csengg@gmail.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.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

all inboxes | Powered by JetHome®