On Tue Mar 17 16:07:20 2026 -0500, Bradford Love wrote:
> When the driver was converted to VB2 the original function to fix
> green frame detection was removed and a default vb2 dqbuf function
> was used instead. This vb2 dqbuf function leads to green frames not
> being detected and correupting stream captures.
> 
> The vidioc_dqbuf function checks the greenscreen flag, and, if set
> resets the stream to discard the green frame and decode a real frame.
> 
> Signed-off-by: Bradford Love <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/usb/au0828/au0828-video.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/usb/au0828/au0828-video.c 
b/drivers/media/usb/au0828/au0828-video.c
index fbaa542c8259..3c53105f3d2b 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1671,6 +1671,27 @@ static int vidioc_log_status(struct file *file, void *fh)
        return 0;
 }
 
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+       struct au0828_dev *dev = video_drvdata(file);
+       int rc;
+
+       rc = check_dev(dev);
+       if (rc < 0)
+               return rc;
+
+       /* Workaround for a bug in the au0828 hardware design that
+        * sometimes results in the colorspace being inverted
+        */
+       if (dev->greenscreen_detected == 1) {
+               dprintk(1, "Detected green frame.  Resetting stream...\n");
+               au0828_analog_stream_reset(dev);
+               dev->greenscreen_detected = 0;
+       }
+
+       return vb2_ioctl_dqbuf(file, priv, b);
+}
+
 void au0828_v4l2_suspend(struct au0828_dev *dev)
 {
        struct urb *urb;
@@ -1764,8 +1785,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
        .vidioc_prepare_buf         = vb2_ioctl_prepare_buf,
        .vidioc_querybuf            = vb2_ioctl_querybuf,
        .vidioc_qbuf                = vb2_ioctl_qbuf,
-       .vidioc_dqbuf               = vb2_ioctl_dqbuf,
-       .vidioc_expbuf               = vb2_ioctl_expbuf,
+       .vidioc_dqbuf               = vidioc_dqbuf,
+       .vidioc_expbuf              = vb2_ioctl_expbuf,
 
        .vidioc_s_std               = vidioc_s_std,
        .vidioc_g_std               = vidioc_g_std,
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to