[PATCH 0/2] staging: media: davinci_vpfe: fixes and enhancement

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/2] staging: media: davinci_vpfe: fixes and enhancement

Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

The first patch adds v4l2_fh for priority handling and the second
patch makes sure that the buffers are released if start_streaming()
callback fails.

Lad, Prabhakar (2):
  staging: media: davinci: vpfe: use v4l2_fh for priority handling
  staging: media: davinci: vpfe: release buffers in case
    start_streaming call back fails

 .../staging/media/davinci_vpfe/vpfe_mc_capture.h   |    2 --
 drivers/staging/media/davinci_vpfe/vpfe_video.c    |   18 ++++++++++++------
 drivers/staging/media/davinci_vpfe/vpfe_video.h    |    2 --
 3 files changed, 12 insertions(+), 10 deletions(-)

--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] staging: media: davinci: vpfe: use v4l2_fh for priority handling

Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 .../staging/media/davinci_vpfe/vpfe_mc_capture.h   |    2 --
 drivers/staging/media/davinci_vpfe/vpfe_video.c    |    8 +++-----
 drivers/staging/media/davinci_vpfe/vpfe_video.h    |    2 --
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h
index 68f6fe4..2632a80 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h
@@ -87,8 +87,6 @@ struct vpfe_fh {
  struct vpfe_video_device *video;
  /* Indicates whether this file handle is doing IO */
  u8 io_allowed;
- /* Used to keep track priority of this instance */
- enum v4l2_priority prio;
 };
 
 void mbus_to_pix(const struct v4l2_mbus_framefmt *mbus,
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index acc8184..c86ab84 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -415,7 +415,6 @@ static int vpfe_open(struct file *file)
  video->usrs++;
  /* Set io_allowed member to false */
  handle->io_allowed = 0;
- v4l2_prio_open(&video->prio, &handle->prio);
  handle->video = video;
  file->private_data = &handle->vfh;
  mutex_unlock(&video->lock);
@@ -532,8 +531,8 @@ static int vpfe_release(struct file *file)
  }
  /* Decrement device users counter */
  video->usrs--;
- /* Close the priority */
- v4l2_prio_close(&video->prio, fh->prio);
+ v4l2_fh_del(&fh->vfh);
+ v4l2_fh_exit(&fh->vfh);
  /* If this is the last file handle */
  if (!video->usrs)
  video->initialized = 0;
@@ -1590,8 +1589,6 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name)
  snprintf(video->video_dev.name, sizeof(video->video_dev.name),
  "DAVINCI VIDEO %s %s", name, direction);
 
- /* Initialize prio member of device object */
- v4l2_prio_init(&video->prio);
  spin_lock_init(&video->irqlock);
  spin_lock_init(&video->dma_queue_lock);
  mutex_init(&video->lock);
@@ -1600,6 +1597,7 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name)
  if (ret < 0)
  return ret;
 
+ set_bit(V4L2_FL_USE_FH_PRIO, &video->video_dev.flags);
  video_set_drvdata(&video->video_dev, video);
 
  return 0;
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h b/drivers/staging/media/davinci_vpfe/vpfe_video.h
index df0aeec..eed0864 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.h
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h
@@ -102,8 +102,6 @@ struct vpfe_video_device {
  * user has selected
  */
  enum v4l2_memory memory;
- /* Used to keep track of state of the priority */
- struct v4l2_prio_state prio;
  /* number of open instances of the channel */
  u32 usrs;
  /* flag to indicate whether decoder is initialized */
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] staging: media: davinci: vpfe: release buffers in case start_streaming call back fails

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch releases the buffer bu calling vb2_buffer_done(),
with state marked as VB2_BUF_STATE_QUEUED if start_streaming()
call back fails.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index c86ab84..9337d92 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -1218,8 +1218,16 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count)
  video->state = VPFE_VIDEO_BUFFER_QUEUED;
 
  ret = vpfe_start_capture(video);
- if (ret)
+ if (ret) {
+ struct vpfe_cap_buffer *buf, *tmp;
+
+ vb2_buffer_done(&video->cur_frm->vb, VB2_BUF_STATE_QUEUED);
+ list_for_each_entry_safe(buf, tmp, &video->dma_queue, list) {
+ list_del(&buf->list);
+ vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+ }
  goto unlock_out;
+ }
 
  mutex_unlock(&video->lock);
 
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source