Skip to content

Commit 1b73f03

Browse files
prabhakarladmchehab
authored andcommitted
[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>
1 parent c24376f commit 1b73f03

2 files changed

Lines changed: 10 additions & 28 deletions

File tree

‎drivers/media/platform/davinci/vpbe_display.c‎

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ static irqreturn_t venc_isr(int irq, void *arg)
152152

153153
for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
154154
layer = disp_dev->dev[i];
155-
/* If streaming is started in this layer */
156-
if (!layer->started)
155+
156+
if (!vb2_start_streaming_called(&layer->buffer_queue))
157157
continue;
158158

159159
if (layer->layer_first_int) {
@@ -314,7 +314,6 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
314314
* if request format is yuv420 semiplanar, need to
315315
* enable both video windows
316316
*/
317-
layer->started = 1;
318317
layer->layer_first_int = 1;
319318

320319
return ret;
@@ -829,11 +828,9 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
829828
"VIDIOC_S_FMT, layer id = %d\n",
830829
layer->device_id);
831830

832-
/* If streaming is started, return error */
833-
if (layer->started) {
834-
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
831+
if (vb2_is_busy(&layer->buffer_queue))
835832
return -EBUSY;
836-
}
833+
837834
if (V4L2_BUF_TYPE_VIDEO_OUTPUT != fmt->type) {
838835
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "invalid type\n");
839836
return -EINVAL;
@@ -937,11 +934,9 @@ static int vpbe_display_s_std(struct file *file, void *priv,
937934

938935
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_STD\n");
939936

940-
/* If streaming is started, return error */
941-
if (layer->started) {
942-
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
937+
if (vb2_is_busy(&layer->buffer_queue))
943938
return -EBUSY;
944-
}
939+
945940
if (NULL != vpbe_dev->ops.s_std) {
946941
ret = vpbe_dev->ops.s_std(vpbe_dev, std_id);
947942
if (ret) {
@@ -1021,11 +1016,10 @@ static int vpbe_display_s_output(struct file *file, void *priv,
10211016
int ret;
10221017

10231018
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_OUTPUT\n");
1024-
/* If streaming is started, return error */
1025-
if (layer->started) {
1026-
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
1019+
1020+
if (vb2_is_busy(&layer->buffer_queue))
10271021
return -EBUSY;
1028-
}
1022+
10291023
if (NULL == vpbe_dev->ops.set_output)
10301024
return -EINVAL;
10311025

@@ -1102,12 +1096,8 @@ vpbe_display_s_dv_timings(struct file *file, void *priv,
11021096

11031097
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_S_DV_TIMINGS\n");
11041098

1105-
1106-
/* If streaming is started, return error */
1107-
if (layer->started) {
1108-
v4l2_err(&vpbe_dev->v4l2_dev, "Streaming is started\n");
1099+
if (vb2_is_busy(&layer->buffer_queue))
11091100
return -EBUSY;
1110-
}
11111101

11121102
/* Set the given standard in the encoder */
11131103
if (!vpbe_dev->ops.s_dv_timings)
@@ -1212,13 +1202,9 @@ static int vpbe_display_release(struct file *file)
12121202
v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_release\n");
12131203

12141204
mutex_lock(&layer->opslock);
1215-
/* Reset io_usrs member of layer object */
1216-
layer->io_usrs = 0;
12171205

12181206
osd_device->ops.disable_layer(osd_device,
12191207
layer->layer_info.id);
1220-
layer->started = 0;
1221-
12221208
/* Decrement layer usrs counter */
12231209
layer->usrs--;
12241210
/* If this file handle has initialize encoder device, reset it */

‎include/media/davinci/vpbe_display.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,8 @@ struct vpbe_layer {
106106
unsigned char window_enable;
107107
/* number of open instances of the layer */
108108
unsigned int usrs;
109-
/* number of users performing IO */
110-
unsigned int io_usrs;
111109
/* Indicates id of the field which is being displayed */
112110
unsigned int field_id;
113-
/* Indicates whether streaming started */
114-
unsigned char started;
115111
/* Identifies device object */
116112
enum vpbe_display_device_id device_id;
117113
/* facilitation of ioctl ops lock by v4l2*/

0 commit comments

Comments
 (0)