On Wed, 12 Mar 2025 14:26:49 +0100,
Landry Breuil <[email protected]> wrote:
> 
> Le Wed, Mar 12, 2025 at 01:47:09PM +0100, Marcus Glocker a écrit :
> > On Wed, Mar 12, 2025 at 11:30:03AM GMT, Marcus Glocker wrote:
> > 
> > > On Wed, Mar 12, 2025 at 10:24:04AM GMT, Landry Breuil wrote:
> > > 
> > > > Le Wed, Mar 12, 2025 at 10:05:30AM +0100, Landry Breuil a ?crit :
> > > > > hi,
> > > > > 
> > > > > updated my t470s from '#564: Tue Feb 25 21:20:18 MST 2025' to '#591: 
> > > > > Tue
> > > > > Mar 11 20:48:18 MDT 2025' and my webcam now shows weird 'stripes' on 
> > > > > top
> > > > > of the image (that works).
> > > > 
> > > > the 'weird stripes' only show up from some webrtc clients (ive noticed
> > > > it with jitsi in firefox 137.0b4), using video(1) i havent been able to
> > > > replicate (yet)..
> > > > 
> > > > no issue in https://mozilla.github.io/webrtc-landing/gum_test.html so
> > > > might be the way jitsi queries the video device.
> > > > 
> > > > Landry
> > > 
> > > I have the same cam in my X1 Carbon.  I can't reproduce the issue on
> > > video(1) either, because it's using YUYV422 as the default input format.
> > > When using ffplay with MJPEG as input format, I can reproduce the issue.
> > > 
> > > I'll try to figure out which of the recent commits has introduced the
> > > regression.
> > 
> > The issue was introduced by:
> > 
> > ***
> > 
> > Revision 1.247 / (download) - annotate - [select for diffs], Sat Mar 1 
> > 12:30:19 2025 UTC (11 days ago) by mglocker
> > Branch: MAIN
> > Changes since 1.246: +55 -32 lines
> > Diff to previous 1.246 (colored)
> > 
> > Copy frames directly in to the mmap'ed buffer.  This saves us one bcopy()
> > down the frame queuing path.
> > 
> > Original idea and diff from kirill@, with some modifications.
> > 
> > ok kirill@
> > 
> > ***
> > 
> > Unfortunately, I couldn't figure out yet what the issue is with this
> > commit.  Hence, following the back out diff for uvideo.c 1.247.  It
> > fixes the issue for me.  What about you?
> 
> that diff fixes the issue for me, yes.


May I ask you to try this diff?

Index: sys/dev/usb/uvideo.c
===================================================================
RCS file: /home/cvs/src/sys/dev/usb/uvideo.c,v
diff -u -p -r1.248 uvideo.c
--- sys/dev/usb/uvideo.c        1 Mar 2025 14:44:09 -0000       1.248
+++ sys/dev/usb/uvideo.c        4 Mar 2025 18:39:09 -0000
@@ -2331,12 +2331,6 @@ uvideo_vs_cb(struct usbd_xfer *xfer, voi
        if (len == 0)
                goto skip;
 
-       if (sc->sc_mmap_flag) {
-               if ((buf = uvideo_mmap_getbuf(sc)) == NULL)
-                       goto skip;
-       } else
-               buf = sc->sc_frame_buffer.buf;
-
        for (i = 0; i < sc->sc_nframes; i++) {
                frame = ixfer->buf + (i * sc->sc_vs_cur->psize);
                frame_size = ixfer->size[i];
@@ -2345,6 +2339,12 @@ uvideo_vs_cb(struct usbd_xfer *xfer, voi
                        /* frame is empty */
                        continue;
 
+               if (sc->sc_mmap_flag) {
+                       if ((buf = uvideo_mmap_getbuf(sc)) == NULL)
+                               goto skip;
+               } else
+                       buf = sc->sc_frame_buffer.buf;
+
                sc->sc_decode_stream_header(sc, frame, frame_size, buf);
        }
 
@@ -2514,6 +2514,13 @@ uint8_t *
 uvideo_mmap_getbuf(struct uvideo_softc *sc)
 {
        int i;
+
+       /*
+        * Section 2.4.3.2 explicitly allows multiple frames per one
+        * transfer and multiple transfers per one frame.
+        */
+       if (sc->sc_mmap_cur != NULL)
+               return sc->sc_mmap_cur->buf;
 
        if (sc->sc_mmap_count == 0 || sc->sc_mmap_buffer == NULL)
                panic("%s: mmap buffers not allocated", __func__);

Reply via email to