@@ -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 */
0 commit comments