aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrabhakar Lad <prabhakar.csengg@gmail.com>2014-10-12 16:40:42 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-28 14:11:15 -0400
commit1b73f03cbf483dbf986cb299f6d6c4ebdfbe6ba7 (patch)
tree6580edb26a903683dde170e3d01a7930f13572f2
parentc24376f30262c5ceb26f49da34edff6512d7c671 (diff)
[media] media: davinci: vpbe: use helpers provided by core if streaming is started
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> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/platform/davinci/vpbe_display.c34
-rw-r--r--include/media/davinci/vpbe_display.h4
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 26d2335fe416..57dc4951c979 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)
152 152
153 for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { 153 for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
154 layer = disp_dev->dev[i]; 154 layer = disp_dev->dev[i];
155 /* If streaming is started in this layer */ 155
156 if (!layer->started) 156 if (!vb2_start_streaming_called(&layer->buffer_queue))
157 continue; 157 continue;
158 158
159 if (layer->layer_first_int) { 159 if (layer->layer_first_int) {
@@ -314,7 +314,6 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
314 * if request format is yuv420 semiplanar, need to 314 * if request format is yuv420 semiplanar, need to
315 * enable both video windows 315 * enable both video windows
316 */ 316 */
317 layer->started = 1;
318 layer->layer_first_int = 1; 317 layer->layer_first_int = 1;
319 318
320 return ret; 319 return ret;
@@ -829,11 +828,9 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
829 "VIDIOC_S_FMT, layer id = %d\n", 828 "VIDIOC_S_FMT, layer id = %d\n",
830 layer->device_id); 829 layer->device_id);
831 830
832 /* If streaming is started, return error */ 831 if (vb2_is_busy(&layer->buffer_queue))
833 if (layer->started) {
834 v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
835 return -EBUSY; 832 return -EBUSY;
836 } 833
837 if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) { 834 if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) {
838 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n"); 835 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n");
839 return -EINVAL; 836 return -EINVAL;
@@ -937,11 +934,9 @@ static int vpbe_display_s_std(struct file *file, void *priv,
937 934
938 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n"); 935 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n");
939 936
940 /* If streaming is started, return error */ 937 if (vb2_is_busy(&layer->buffer_queue))
941 if (layer->started) {
942 v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
943 return -EBUSY; 938 return -EBUSY;
944 } 939
945 if (NULL != vpbe_dev->ops.s_std) { 940 if (NULL != vpbe_dev->ops.s_std) {
946 ret = vpbe_dev->ops.s_std(vpbe_dev, std_id); 941 ret = vpbe_dev->ops.s_std(vpbe_dev, std_id);
947 if (ret) { 942 if (ret) {
@@ -1021,11 +1016,10 @@ static int vpbe_display_s_output(struct file *file, void *priv,
1021 int ret; 1016 int ret;
1022 1017
1023 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n"); 1018 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n");
1024 /* If streaming is started, return error */ 1019
1025 if (layer->started) { 1020 if (vb2_is_busy(&layer->buffer_queue))
1026 v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
1027 return -EBUSY; 1021 return -EBUSY;
1028 } 1022
1029 if (NULL == vpbe_dev->ops.set_output) 1023 if (NULL == vpbe_dev->ops.set_output)
1030 return -EINVAL; 1024 return -EINVAL;
1031 1025
@@ -1102,12 +1096,8 @@ vpbe_display_s_dv_timings(struct file *file, void *priv,
1102 1096
1103 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n"); 1097 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n");
1104 1098
1105 1099 if (vb2_is_busy(&layer->buffer_queue))
1106 /* If streaming is started, return error */
1107 if (layer->started) {
1108 v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
1109 return -EBUSY; 1100 return -EBUSY;
1110 }
1111 1101
1112 /* Set the given standard in the encoder */ 1102 /* Set the given standard in the encoder */
1113 if (!vpbe_dev->ops.s_dv_timings) 1103 if (!vpbe_dev->ops.s_dv_timings)
@@ -1212,13 +1202,9 @@ static int vpbe_display_release(struct file *file)
1212 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n"); 1202 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n");
1213 1203
1214 mutex_lock(&layer->opslock); 1204 mutex_lock(&layer->opslock);
1215 /* Reset io_usrs member of layer object */
1216 layer->io_usrs = 0;
1217 1205
1218 osd_device->ops.disable_layer(osd_device, 1206 osd_device->ops.disable_layer(osd_device,
1219 layer->layer_info.id); 1207 layer->layer_info.id);
1220 layer->started = 0;
1221
1222 /* Decrement layer usrs counter */ 1208 /* Decrement layer usrs counter */
1223 layer->usrs--; 1209 layer->usrs--;
1224 /* If this file handle has initialize encoder device, reset it */ 1210 /* 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 06ea81576e5f..de0843d6f05c 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -106,12 +106,8 @@ struct vpbe_layer {
106 unsigned char window_enable; 106 unsigned char window_enable;
107 /* number of open instances of the layer */ 107 /* number of open instances of the layer */
108 unsigned int usrs; 108 unsigned int usrs;
109 /* number of users performing IO */
110 unsigned int io_usrs;
111 /* Indicates id of the field which is being displayed */ 109 /* Indicates id of the field which is being displayed */
112 unsigned int field_id; 110 unsigned int field_id;
113 /* Indicates whether streaming started */
114 unsigned char started;
115 /* Identifies device object */ 111 /* Identifies device object */
116 enum vpbe_display_device_id device_id; 112 enum vpbe_display_device_id device_id;
117 /* facilitation of ioctl ops lock by v4l2*/ 113 /* facilitation of ioctl ops lock by v4l2*/