media: vb2/au0828: move the v4l_vb2q_enable_media_source to the au0828 driver
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 22 Jun 2022 09:31:45 +0000 (10:31 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 25 Nov 2022 07:41:40 +0000 (07:41 +0000)
With the new prepare_streaming op it is possible to move the ugly
v4l_vb2q_enable_media_source() call in vb2_core_streamon to the
driver. It was called incorrectly in vb2 as well: it was only
called if sufficient buffers were queued at STREAMON time, but not
if more buffers were queued later. This was not an issue with the
au0828 driver since it never set min_buffers_needed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/common/videobuf2/videobuf2-core.c
drivers/media/usb/au0828/au0828-vbi.c
drivers/media/usb/au0828/au0828-video.c

index 17e2463c054c51110e62fe7d5ba1a0df7635c58b..2cb2a3b544a142abccf528f1d0ccba3fd01ccfb0 100644 (file)
@@ -2121,9 +2121,6 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type)
         * are available.
         */
        if (q->queued_count >= q->min_buffers_needed) {
-               ret = v4l_vb2q_enable_media_source(q);
-               if (ret)
-                       goto unprepare;
                ret = vb2_start_streaming(q);
                if (ret)
                        goto unprepare;
index 97f5e8733c2a407a38953068bf4ce9e7d53486a3..b0333637b747d7777ed6f87f7d556e80c6cad377 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <media/v4l2-mc.h>
 
 /* ------------------------------------------------------------------ */
 
@@ -70,6 +71,7 @@ const struct vb2_ops au0828_vbi_qops = {
        .queue_setup     = vbi_queue_setup,
        .buf_prepare     = vbi_buffer_prepare,
        .buf_queue       = vbi_buffer_queue,
+       .prepare_streaming = v4l_vb2q_enable_media_source,
        .start_streaming = au0828_start_analog_streaming,
        .stop_streaming  = au0828_stop_vbi_streaming,
        .wait_prepare    = vb2_ops_wait_prepare,
index eb303e94ccebf3a05103fe501a489465df6e3376..fd9fc43d47e0feacfa98d6d9603ebba95ed255ab 100644 (file)
@@ -915,6 +915,7 @@ static const struct vb2_ops au0828_video_qops = {
        .queue_setup     = queue_setup,
        .buf_prepare     = buffer_prepare,
        .buf_queue       = buffer_queue,
+       .prepare_streaming = v4l_vb2q_enable_media_source,
        .start_streaming = au0828_start_analog_streaming,
        .stop_streaming  = au0828_stop_streaming,
        .wait_prepare    = vb2_ops_wait_prepare,